-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
39 lines (31 loc) · 999 Bytes
/
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
COPTS= -I. -Iexternal
CXX := g++
CXXFLAGS := -g -Wall -Wextra -std=c++11 -fdiagnostics-color $(COPTS)
LDFLAGS :=
# Rule for building .o from .cpp with dependency generation
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $*.cpp -o $*.o
$(CXX) -MM $(CXXFLAGS) $*.cpp > $*.d
@mv -f $*.d $*.d.tmp
@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
@rm -f $*.d.tmp
default: autotype
AUTOTYPE_SRC =\
src/class.h src/class.cpp\
src/code.h src/code.cpp\
src/enum.h src/enum.cpp\
src/parser.h src/parser.cpp\
src/type.h src/type.cpp\
src/typedef.h src/typedef.cpp\
src/utility.h src/utility.cpp\
src/main.cpp
AUTOTYPE_CPP = $(filter %.cpp,$(AUTOTYPE_SRC))
AUTOTYPE_OBJ = $(AUTOTYPE_CPP:.cpp=.o)
autotype: $(AUTOTYPE_OBJ) $(AUTOTYPE_SRC)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o autotype $(AUTOTYPE_OBJ)
clean:
-rm -f autotype $(AUTOTYPE_OBJ)
-find -iname "*.d" -exec rm -f {} \; -print
-include $(AUTOTYPE_OBJ:.o=.d)