-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile.global
39 lines (28 loc) · 915 Bytes
/
Makefile.global
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
CXX = g++
CXXFLAGS = -g -Wall -std=c++0x -I../include
LDFLAGS = -lfst -ldl
#LDFLAGS = -lprofiler -ltcmalloc -lfst -ldl
TOP := $(dir $(lastword $(MAKEFILE_LIST)))
-include $(TOP)/Makefile.paths
SOURCES:=$(shell ls *.cpp)
#These are the dependency files, which make will clean up after it creates them
DEPFILES:=$(patsubst %.cpp,.deps/%.P,$(SOURCES))
OBJFILES:=$(patsubst %.cpp,.objs/%.o,$(SOURCES))
.PHONY: clean all dist
all : CXXFLAGS += -O0
all : $(ALL_EXTRA_DEPS) $(EXEC)
dist : CXXFLAGS += -O3
dist : $(ALL_EXTRA_DEPS) $(EXEC)
$(EXEC) : $(OBJFILES)
$(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
.objs/%.o : %.cpp
@mkdir -p .objs
@mkdir -p .deps
$(CXX) -MMD -c -o $@ $< $(CXXFLAGS)
@cp .objs/$*.d .deps/$*.P; \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
-e '/^$$/ d' -e 's/$$/ :/' < .objs/$*.d >> .deps/$*.P; \
rm -f .objs/$*.d
-include $(DEPFILES)
clean :
rm -r .objs .deps $(EXEC)