-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (32 loc) · 1.06 KB
/
Makefile
File metadata and controls
47 lines (32 loc) · 1.06 KB
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
CC=g++
CPPFLAGS= -w -O3 -c -static
LDFLAGS= -O3
SRCS= TaxonSet.cpp Tree.cpp Random.cpp StateSpace.cpp CodonStateSpace.cpp ReadMapTree.cpp
OBJS=$(patsubst %.cpp,%.o,$(SRCS))
ALL_SRCS=$(wildcard *.cpp)
ALL_OBJS=$(patsubst %.cpp,%.o,$(ALL_SRCS))
PROGSDIR=../data
ALL= readmap readaamap
PROGS=$(addprefix $(PROGSDIR)/, $(ALL))
.PHONY: all clean
all: $(PROGS)
# Rules for generate the dependencies automatically
%.d: %.cpp
@echo "Generating dependencies for $<..."; \
set -e; rm -f $@; $(CC) -MM $(CPPFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; rm -f $@.$$$$
# Rules to create .o files from .cpp files
%.o: %.cpp %.d
$(CC) -c $(CPPFLAGS) $*.cpp
# Include the dependencies unless the request was to clean eveything up
ifneq ($(MAKECMDGOALS),clean)
-include $(ALL_OBJS:.o=.d)
endif
# Targets
$(PROGSDIR)/readmap: ReadMapping.o $(OBJS)
$(CC) ReadMapping.o $(OBJS) $(LDFLAGS) $(LIBS) -o $@
$(PROGSDIR)/readaamap: ReadAAMapping.o $(OBJS)
$(CC) ReadAAMapping.o $(OBJS) $(LDFLAGS) $(LIBS) -o $@
clean:
-rm -f *.o *.d *.d.*
-rm -f $(PROGS)