-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
46 lines (32 loc) · 1.09 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Brian Chrzanowski
# Tue Jan 01, 2019 13:51
#
# MOLT Specific (GNU) Makefile
CC=gcc
LINKER=-lm -ldl -lpthread
CFLAGS=-Wall -g3 -march=native
SRC=src/lump.c src/main.c src/sys_linux.c src/molttest.c
OBJ=$(SRC:.c=.o)
DEP=$(OBJ:.o=.d) # one dependency file for each source
all: molt molttest moltthreaded.so moltcuda.so experiments/test
%.d: %.c
@$(CC) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
%.o: %.c
$(CC) -c $(CFLAGS) -o $@ $<
-include $(DEP)
molt: src/lump.o src/main.o src/sys_linux.o
$(CC) $(CFLAGS) -o $@ $^ $(LINKER)
molttest: src/molttest.c
$(CC) $(CFLAGS) -o $@ $^ $(LINKER)
# this is where we have individual targets for our modules
moltthreaded.so: src/custom/moltthreaded.c src/custom/thpool.c src/sys_linux.c
$(CC) -fPIC -shared $(CFLAGS) -o $@ $^ -lm -lpthread
moltcuda.so: src/custom/moltcuda.cu
nvcc --compiler-options '-fPIC' --shared -g -G -o $@ src/custom/moltcuda.cu -lm
experiments/test: experiments/test.c
$(CC) $(CFLAGS) -o $@ $^ $(LINKER)
clean: clean-obj clean-bin
clean-obj:
rm -f src/*.o src/*.d
clean-bin:
rm -f molt molttest moltthreaded.so moltcuda.so experiments/test