forked from williame/hellepoll
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (45 loc) · 1.22 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
# (c) William Edwards, 2011
# Using the Simplified BSD License. See LICENSE file for details
CC = gcc
CPP = g++
LD = g++
HYGIENE = -g3 -Wall #-pedantic-errors -std=c++98 -Wno-long-long -fdiagnostics-show-option
DEBUG = -O0
OPTIMISATIONS = #-O9 -fomit-frame-pointer -fno-rtti -march=native # etc -fprofile-generate/-fprofile-use
# default flags
CFLAGS = ${HYGIENE} ${DEBUG} ${OPTIMISATIONS} ${C_EXT_FLAGS}
CPPFLAGS = ${CFLAGS}
LDFLAGS = ${HYGIENE} ${DEBUG} ${OPTIMISATIONS}
#target binary names
TRG_HELLO = helloworld
OBJ_HELLO_CPP = \
helloworld.opp \
http.opp \
task.opp \
out.opp \
error.opp \
time.opp \
listener.opp \
console.opp
OBJ_HELLO_C =
OBJ_CPP = ${OBJ_HELLO_CPP}
OBJ_C = ${OBJ_HELLO_C}
OBJ = ${OBJ_CPP} ${OBJ_C}
TARGETS = ${TRG_HELLO}
all: ${TARGETS}
${TRG_HELLO}: ${OBJ_HELLO_CPP} ${OBJ_HELLO_C}
${LD} ${CPPFLAGS} -o $@ $^ ${LDFLAGS}
# compile c files
%.o: %.c
${CC} ${CFLAGS} -c $< -MD -MF $(<:%.c=%.dep) -o $@
# compile c++ files
%.opp: %.cpp
${CPP} ${CPPFLAGS} -c $< -MD -MF $(<:%.cpp=%.dep) -o $@
#misc
.PHONY: clean all
clean:
rm -f ${TARGETS}
rm -f *.[hc]pp~ Makefile~ core
rm -f ${OBJ}
rm -f $(OBJ_C:%.o=%.dep) $(OBJ_CPP:%.opp=%.dep)
-include $(OBJ_C:%.o=%.dep) $(OBJ_CPP:%.opp=%.dep)