forked from anobin/3DMagic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (44 loc) · 1.17 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
CXX = g++
CXXFLAGS=-g -Wall -I./include -I/usr/include/GL
PACKER=ar rcs
# collect all source in src folder
SRC=$(wildcard ./src/*.cpp ./src/*/*.cpp ./src/*/*/*.cpp)
OBJ=$(subst .cpp,.o,$(SRC))
# collect all headers
HEADS=$(wildcard ./include/*.h ./include/*/*.h ./include/*/*/*.h)
# output
OUTPUT_DIR=./
PACKAGE=lib3DMagic.a
#default build, normal build
all : normal
# implicit compiling rule for .cc files
%.o: %.cc
$(CXX) $(CXXFLAGS) -I $(<D) -c $< -o $@
# implicit compiling rule for .cpp files
%.o: %.cpp
$(CXX) $(CXXFLAGS) -I $(<D) -c $< -o $@
########################
#### normal builds
########################
# list all files under makefile's supervison
list:
@echo "######## Source #########"
@echo $(SRC) | sed -e "s/\s\+/\n/g"
@echo ""
@echo "######## Headers ########"
@echo $(HEADS) | sed -e "s/\s\+/\n/g"
normal: package
# make static library
package: $(OBJ) $(HEADS)
${PACKER} $(OUTPUT_DIR)/${PACKAGE} $(OBJ)
@echo "package placed at ${OUTPUT_DIR}/${PACKAGE}"
###################
### phony targets
###################
.PHONY: clean
clean:
rm -f $(OBJ) 2> /dev/null > /dev/null
rm -f $(OUTPUT_DIR)/${PACKAGE}
.PHONY: love
love:
@echo "not war?"