-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (44 loc) · 1.49 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
CC = clang++-6.0
CCFLAGS = -O3 -std=c++11 -fopenmp=libiomp5
DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td
MATLIB = ~/dlib-19.2/
SRCS := $(wildcard *.cc)
MAIN := optimize.cc analyze.cc match.cc getxyz.cc ico-subgraph.cc global.cc eigenvectorFollowing.cc $(wildcard app-*)
APPS := $(wildcard apps/*.cc)
EXES := $(patsubst %.cc, %, $(MAIN))
EXES += $(patsubst %.cc, %, $(APPS))
SRCS := $(filter-out $(MAIN), $(SRCS))
LFLAGS = -lconfig++ -llapack
INCLUDE =-I $(MATLIB)
SRCS := $(filter-out gsl%, $(SRCS))
OBJS = $(patsubst %.cc, %.o, $(SRCS))
$(info SRCS = $(SRCS))
$(info OBJS = $(OBJS))
$(info EXES = $(EXES))
$(info APPS = $(APPS))
OBJDIR = objects
DEPDIR = .dep
$(shell mkdir -p $(OBJDIR) >/dev/null)
$(shell mkdir -p $(OBJDIR)/apps >/dev/null)
$(shell mkdir -p $(DEPDIR) >/dev/null)
$(shell mkdir -p $(DEPDIR)/apps >/dev/null)
FLAGS = $(CCFLAGS) $(LFLAGS) $(INCLUDE)
COMPILE.cc = $(CC) $(DEPFLAGS) $(CCFLAGS) $(INCLUDE)
POSTCOMPILE = mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d
.PHONY: all
all: $(EXES)
$(EXES): %: $(OBJDIR)/%.o $(addprefix $(OBJDIR)/,$(OBJS))
$(CC) $(FLAGS) -o $@ $^
%.o: %.cc
$(OBJDIR)/%.o: %.cc
$(OBJDIR)/%.o: %.cc | $(DEPDIR)/%.d
$(COMPILE.cc) -c -o $@ $<
$(POSTCOMPILE)
$(DEPDIR)/%.d: ;
.PRECIOUS: $(DEPDIR)/%.d
.PHONY: distclean
distclean:
rm $(EXES) $(OBJDIR)/*.o $(DEPDIR)/*.d $(OBJDIR)/apps/*.o $(DEPDIR)/apps/*.d
-include $(patsubst %,$(DEPDIR)/%.d,$(basename $(SRCS)))
-include $(patsubst %,$(DEPDIR)/%.d,$(basename $(MAIN)))
-include $(patsubst %,$(DEPDIR)/apps/%.d,$(basename $(APPS)))