-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
67 lines (52 loc) · 1.39 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
CC=gcc
OPT=-O2
GPROF=#-pg
GDB=#-g
W= -Wall -Wextra \
-Wno-sign-compare\
-Wno-pointer-sign\
-Wformat=0\
-Warray-bounds\
-Wfloat-equal\
-Wimplicit\
-Wmaybe-uninitialized\
-Wmissing-braces\
-Wparentheses\
-Wsequence-point\
-Wtype-limits\
-Wundef\
-Wuninitialized\
-Wunused\
-Wunused-but-set-variable\
-Wunused-parameter\
-Wempty-body\
-Wmemset-elt-size\
-Wduplicated-branches\
-Wswitch-unreachable\
-Winline\
STDFLAG= -std=gnu11 # -std=gnu99 can be used
CFLAGS= -c $(STDFLAG) -MMD $(OPT) $(GPROF) $(W) $(GDB) $(ASM)
OFLAGS= -lm $(GPROF)
INCL= -I$(SRCDIR)/mol -I$(SRCDIR)/math -I$(SRCDIR)/q -I$(SRCDIR)/qap
OBJDIR=./obj
SRCDIR=./src
molsrc=$(wildcard $(SRCDIR)/mol/*.c)
molobj=$(molsrc:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
mathsrc=$(wildcard $(SRCDIR)/math/*.c)
mathobj=$(mathsrc:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
qsrc=$(wildcard $(SRCDIR)/q/*.c)
qobj=$(qsrc:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
qapsrc=$(wildcard $(SRCDIR)/qap/*.c)
qapobj=$(qapsrc:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
all : q qap
q : $(molobj) $(mathobj) $(qobj) $(OBJDIR)/q.o
$(CC) $^ -o $@ $(OFLAGS)
qap : $(molobj) $(mathobj) $(qobj) $(qapobj) $(OBJDIR)/qap.o
$(CC) $^ -o $@ $(OFLAGS) -lpthread
$(OBJDIR)/%.o : $(SRCDIR)/%.c
$(CC) $(CFLAGS) $< -o $@ $(INCL)
clean :
rm -f $(OBJDIR)/*/*.o $(OBJDIR)/*.o q qap
cleand :
rm -f $(OBJDIR)/*/*.d $(OBJDIR)/*.d
include $(wildcard $(OBJDIR)/*/*.d $(OBJDIR)/*.d)