-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
61 lines (40 loc) · 1.07 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
PNAME = pixam
TARGETS = $(PNAME)
# sources
COMMON_SRC = src/ColorHist.cpp \
src/Color.cpp \
src/HSVColor.cpp \
src/Triplet.cpp
COMMON_INCLUDE = $(COMMON_SRC:src/%.cpp=include/%.h)
CLI_SRC = src/pixam.cpp src/pixam-cli.cpp
# object files
COMMON_OBJ = $(COMMON_SRC:src/%.cpp=obj/%.o)
CLI_OBJ = $(CLI_SRC:src/%.cpp=obj/%.o)
ALL_OBJ = $(COMMON_OBJ) $(CLI_OBJ)
# dependencies
ALL_DEPS = $(ALL_OBJ:%.o=%.d)
CPPFLAGS = \
-g -Wall -W -ansi -pedantic \
-Dcimg_use_vt100 -Dcimg_use_png \
-Iinclude -I/usr/X11R6/include
LDFLAGS = \
-lboost_filesystem -lboost_system \
-L/usr/X11R6/lib \
-lpthread -lpng -lz -lX11 -lm
STRIP = -s
# general targets
all: $(TARGETS)
clean:
rm -rf $(ALL_OBJ) $(TARGETS) obj
dist_clean: clean
rm -fr $(TARGETS)
# specific targets
$(PNAME): $(ALL_OBJ)
g++ -o $@ $^ $(LDFLAGS) $(STRIP)
# include dependencies (if they exist)
-include $(ALL_DEPS)
# generic rules (with automatic generation of dependencies and automagic
# creation of obj directory)
obj/%.o: src/%.cpp
@mkdir obj 2>/dev/null || true
g++ -MMD $(CPPFLAGS) -c -o $@ $<