1 |
douglas |
2 |
# Truck Computer Dooom! |
2 |
|
|
# |
3 |
|
|
# Douglas Thrift |
4 |
|
|
# |
5 |
|
|
# $Id$ |
6 |
|
|
|
7 |
douglas |
15 |
SHELL :=/usr/local/bin/bash -O extglob -O xpg_echo |
8 |
douglas |
23 |
CPPFLAGS := -MD -I$(common) $(shell pcre-config --cflags) |
9 |
douglas |
17 |
CXXFLAGS := -Wall -pedantic -g -O2 $(shell $(common)/cpu.sh) |
10 |
douglas |
23 |
LDFLAGS := -L$(common) |
11 |
|
|
LDLIBS := -ltruck $(shell pcre-config --libs) |
12 |
douglas |
2 |
|
13 |
douglas |
15 |
reset :=\e[0m |
14 |
|
|
bright :=\e[1m |
15 |
|
|
dim :=\e[2m |
16 |
|
|
underscore :=\e[4m |
17 |
|
|
blink :=\e[5m |
18 |
|
|
reverse :=\e[7m |
19 |
|
|
hidden :=\e[8m |
20 |
|
|
black :=\e[30m |
21 |
|
|
red :=\e[31m |
22 |
|
|
green :=\e[32m |
23 |
|
|
yellow :=\e[33m |
24 |
|
|
blue :=\e[34m |
25 |
|
|
magenta :=\e[35m |
26 |
|
|
cyan :=\e[36m |
27 |
|
|
white :=\e[37m |
28 |
|
|
black_ :=\e[40m |
29 |
|
|
red_ :=\e[41m |
30 |
|
|
green_ :=\e[42m |
31 |
|
|
yellow_ :=\e[43m |
32 |
|
|
blue_ :=\e[44m |
33 |
|
|
magenta_ :=\e[45m |
34 |
|
|
cyan_ :=\e[46m |
35 |
|
|
white_ :=\e[47m |
36 |
douglas |
2 |
|
37 |
douglas |
7 |
%.o: %.cpp |
38 |
douglas |
22 |
@echo "$(bright)$(white)compile\t$(blue)[$(reset)$(<F)$(bright)$(blue)]$(reset)" |
39 |
douglas |
7 |
@$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< |
40 |
douglas |
22 |
@echo "$(bright)$(white)compile\t$(green)[$(reset)$(@F)$(bright)$(green)]$(reset)" |
41 |
douglas |
16 |
|
42 |
|
|
%: %.o |
43 |
|
|
@echo "$(bright)$(white)link\t$(blue)[$(reset)$(^F)$(bright)$(blue)]$(reset)" |
44 |
|
|
@$(CXX) $(LDFLAGS) -o $@ $^ $(LOADLIBES) $(LDLIBS) |
45 |
|
|
@echo "$(bright)$(white)link\t$(green)[$(reset)$(@F)$(bright)$(green)]$(reset)" |
46 |
|
|
|
47 |
|
|
lib%.a: %.o |
48 |
|
|
@echo "$(bright)$(white)archive\t$(blue)[$(reset)$(^F)$(bright)$(blue)]$(reset)" |
49 |
|
|
@$(AR) cr $@ $^ |
50 |
|
|
@echo "$(bright)$(white)archive\t$(green)[$(reset)$(@F)$(bright)$(green)]$(reset)" |
51 |
douglas |
22 |
|
52 |
|
|
define recurse |
53 |
|
|
@echo "$(bright)$(white)enter\t$(blue)[$(reset)$(1)$(bright)$(blue)]$(reset)" |
54 |
|
|
@+$(MAKE) --no-print-directory -C $(1) $(2) |
55 |
|
|
@echo "$(bright)$(white)leave\t$(green)[$(reset)$(1)$(bright)$(green)]$(reset)" |
56 |
|
|
endef |
57 |
|
|
|
58 |
|
|
define clean |
59 |
|
|
clean: |
60 |
|
|
@echo "$(bright)$(white)clean\t$(blue)[$(reset)$(1)$(bright)$(blue)]$(reset)" |
61 |
|
|
@rm -frv $(1) |
62 |
|
|
@echo "$(bright)$(white)clean\t$(green)[$(reset)$(1)$(bright)$(green)]$(reset)" |
63 |
|
|
endef |