aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile24
1 files changed, 16 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 5af440e..5256634 100644
--- a/Makefile
+++ b/Makefile
@@ -1,22 +1,28 @@
1# Set this if CUDA is installed in a different location
2CUDA ?= /usr/local/cuda
1# Note that CXX and CC are predefined as g++ and cc (respectively) by Make 3# Note that CXX and CC are predefined as g++ and cc (respectively) by Make
2NVCC ?= nvcc 4NVCC ?= $(CUDA)/bin/nvcc
3# -fPIC is needed in all cases, as we may be linked into another shared library 5# Everything has to have -lcuda, as it's needed for libsmctrl
4CFLAGS = -fPIC 6LDFLAGS := -lcuda -I$(CUDA)/include -L$(CUDA)/lib64
5LDFLAGS = -lcuda -I/usr/local/cuda/include
6 7
7.PHONY: clean tests 8.PHONY: clean tests all
8 9
10# ----- Main Library -----
9libsmctrl.so: libsmctrl.c libsmctrl.h 11libsmctrl.so: libsmctrl.c libsmctrl.h
10 $(CC) $< -shared -o $@ $(CFLAGS) $(LDFLAGS) 12 $(CC) $< -shared -o $@ -fPIC $(CFLAGS) $(LDFLAGS)
11 13
14# -fPIC is needed even if built as a static library, in case we are linked into
15# another shared library
12libsmctrl.a: libsmctrl.c libsmctrl.h 16libsmctrl.a: libsmctrl.c libsmctrl.h
13 $(CC) $< -c -o libsmctrl.o $(CFLAGS) $(LDFLAGS) 17 $(CC) $< -c -o libsmctrl.o -fPIC $(CFLAGS) $(LDFLAGS)
14 ar rcs $@ libsmctrl.o 18 ar rcs $@ libsmctrl.o
15 19
20# ----- Utilities -----
16# Use static linking with tests to avoid LD_LIBRARY_PATH issues 21# Use static linking with tests to avoid LD_LIBRARY_PATH issues
17libsmctrl_test_gpc_info: libsmctrl_test_gpc_info.c libsmctrl.a testbench.h 22libsmctrl_test_gpc_info: libsmctrl_test_gpc_info.c libsmctrl.a testbench.h
18 $(CC) $< -o $@ -g -L. -l:libsmctrl.a $(LDFLAGS) 23 $(CC) $< -o $@ -g -L. -l:libsmctrl.a $(CFLAGS) $(LDFLAGS)
19 24
25# ----- Tests -----
20libsmctrl_test_mask_shared.o: libsmctrl_test_mask_shared.cu testbench.h 26libsmctrl_test_mask_shared.o: libsmctrl_test_mask_shared.cu testbench.h
21 $(NVCC) -ccbin $(CXX) $< -c -g 27 $(NVCC) -ccbin $(CXX) $< -c -g
22 28
@@ -37,6 +43,8 @@ libsmctrl_test_next_mask_override: libsmctrl_test_next_mask_override.c libsmctrl
37 43
38tests: libsmctrl_test_gpc_info libsmctrl_test_global_mask libsmctrl_test_stream_mask libsmctrl_test_stream_mask_override libsmctrl_test_next_mask libsmctrl_test_next_mask_override 44tests: libsmctrl_test_gpc_info libsmctrl_test_global_mask libsmctrl_test_stream_mask libsmctrl_test_stream_mask_override libsmctrl_test_next_mask libsmctrl_test_next_mask_override
39 45
46all: libsmctrl.so tests
47
40clean: 48clean:
41 rm -f libsmctrl.so libsmctrl.a libsmctrl_test_gpu_info \ 49 rm -f libsmctrl.so libsmctrl.a libsmctrl_test_gpu_info \
42 libsmctrl_test_mask_shared.o libmsctrl_test_global_mask \ 50 libsmctrl_test_mask_shared.o libmsctrl_test_global_mask \