-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
66 lines (49 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
##########################
# Makefile template.
##########################
# config your c++ compiler.
export CC=g++
# Using -Ofast instead of -O3 might result in faster code,
# but is only supported by newer GCC versions
CFLAGS = -pthread -O3 -Wall -fPIC
#-shared
#DEBUG_CFLAGS= -lm -pthread -O0 -Wall -g
# flag for linker.
LDFLAGS= -pthread -lm -fPIC
# libs
LIBS= -lm
# includes.
INCLUDES=
# output obejcts.
OBJECTS=
TARGETS=
SCRIPTS=
# common function for make.
define notice_log
@echo -e "\033[40;32;1m --> $(1) <-- \033[0m"
endef
# fake object.
.PHONY: all clean
all: $(TARGETS) output
$(call notice_log, 'MAKE ALL!')
output:
rm -rf output
mkdir output
#cp $(SCRIPTS) output/
clean:
rm -rf $(OBJECTS) $(TARGETS) *~ .*.swp *.pyc
# common object.
$(OBJECTS): %.o:%.cc
$(call notice_log, '[[ $@ ]]'
$(CC) -c $^ -o $@ $(CFLAGS) $(INCLUDES)
#
# Example of a bin.
#bin : a.cc b.cc
# $(call notice_log, "make : [[ $@ ]]")
# $(CC) $^ -o $@ $(CFLAGS) $(LIBS) $(INCLUDES)
#
# Example of a so.
#some.so: some.cc some.o
# $(call notice_log, "make [[ $@ ]]")
# $(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDES) -o $@ $(filter %.cpp %.o %.c %.cc, $^)
#