-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
66 lines (48 loc) · 1.14 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
60
61
62
63
64
65
# Libraries to link against
LIBS=-ltidy -lboost_filesystem
LIBS+=$(shell pkg-config --libs libcurl libxml-2.0)
# Local include paths
INCLUDE=-I.
# Compilation flags
CFLAGS=-Wall
## example:
CFLAGS+=$(shell pkg-config --cflags libcurl libxml-2.0)
# Target binaries
PROGS=ekhem
# Source files' extension
EXT=cc
# Compiler
GCC=g++
######################################
# You shouldn't need to modify these #
######################################
CC=${GCC} ${INCLUDE} ${CFLAGS}
LINK=${GCC}
GENDEP=${GCC} -MM ${INCLUDE} ${CFLAGS}
OBJS:=$(patsubst %.${EXT},%.o, $(wildcard *.${EXT}))
DEPS:=$(patsubst %.${EXT},.%.d, $(wildcard *.${EXT}))
.PHONY: all
all: ${PROGS}
@ echo Build complete
.%.d: %.${EXT}
@ echo DEP $<
@ ${GENDEP} $< | sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' > $@
${PROGS}: ${DEPS} ${OBJS}
@ echo LINK $@
@ ${LINK} ${OBJS} ${LIBS} ${LFLAGS} -o $@
@ strip $@
${OBJS}: %.o: %.${EXT}
@ echo CC $<
@ ${CC} -c $<
REALDEPS:=$(wildcard .*.d)
ifneq ($(strip $(REALDEPS)),)
include ${REALDEPS}
endif
.PHONY: clean
clean:
@ echo CLEAN ${PROGS}
@ rm -f ${PROGS}
@ echo CLEAN ${OBJS}
@ rm -f ${OBJS}
@ echo CLEAN ${DEPS}
@ rm -f ${DEPS}