-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
59 lines (49 loc) · 1.2 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
TARGET = i7-highlighter
SOURCES = \
annotation \
annotation_fact \
base_class \
buffer \
codepoints \
deduction \
delimiters \
io \
language \
lexer \
lexer_monoid \
lexical_highlights \
main \
parser \
relexer \
session \
token
CC = g++
CFLAGS = -std=c++11 -Wall -Wno-switch -Werror -g
LFLAGS =
DFLAGS = -MM
all: $(TARGET) TAGS
$(TARGET): $(SOURCES:%=%.o)
$(CC) -o $@ $(filter %.o,$^) $(LFLAGS)
$(SOURCES:%=%.o): Makefile
$(CC) -c -o $@ $(@:%.o=%.cpp) $(CFLAGS)
$(SOURCES:%=%.d): %.d:%.cpp Makefile
$(CC) $(DFLAGS) $(@:%.d=%.cpp) $(CFLAGS) | sed 's,.*\.o:,$(@:%.d=%.o) $@: ,g' > $@
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),distclean)
-include $(SOURCES:%=%.d)
endif
endif
Dependencies: $(SOURCES:%=%.d)
sed -e 's/://g' -e 's/[^ ][^ ]*\.d//g' -e 's/[^ ][^ ]*\.o//g' -e 's/[ \\][ \\]*/ /g' $(SOURCES:%=%.d) | tr ' ' "\n" | sort | uniq | tr "\n" ' ' | sed 's/^/ALL_INPUTS =/' > $@
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),distclean)
-include Dependencies
endif
endif
TAGS: $(ALL_INPUTS)
etags $^
clean:
-$(RM) $(TARGET) $(SOURCES:%=%.o)
distclean: clean
-$(RM) $(SOURCES:%=%.d) Dependencies TAGS
.PHONY: all clean distclean