-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
79 lines (55 loc) · 1.98 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
CC := g++
CFLAGS := -g -Wall -Wno-sign-compare -Wno-deprecated-declarations -Wno-unused-function -Wno-int-in-bool-context -std=c++0x -I src -I ../LedBurnBBB
LIBS := -lm #-lyaml-cpp -lboost_program_options -lzmq
ifdef DEBUG
CFLAGS += -O0
else
CFLAGS += -O3 -DNDEBUG
endif
GIT_VERSION := $(shell git describe --abbrev=7 --dirty --always --tags)
CFLAGS += -DVERSION=\"$(GIT_VERSION)\"
# filter source files containing main() function
MAIN_SRCS = src/test_ledscape.cc src/test_linpix.cc src/test_animation.cc
OBJECTS_SRC = $(wildcard src/*.cc)
OBJECTS_SRC_FILTERED = $(filter-out $(MAIN_SRCS), $(OBJECTS_SRC))
OBJECTS = $(OBJECTS_SRC_FILTERED:.cc=.o)
HEADERS = $(wildcard src/*.h)
OBJDIR := obj
OBJECTS := $(addprefix $(OBJDIR)/,$(OBJECTS))
TARGETOBJ := $(OBJDIR)/src/
TARGETDIR := bin
TRG_test_animation = $(TARGETDIR)/test_animation
TRG_test_linpix = $(TARGETDIR)/test_linpix
TRG_test_ledscape = $(TARGETDIR)/test_ledscape
.PHONY: default all clean
.PRECIOUS: $(OBJECTS)
default: all
.PHONY: test_ledscape test_linpix test_animation
#rgb2hsv: $(TRG_rgb2hsv)
test_animation: $(TRG_test_animation)
test_linpix: $(TRG_test_linpix)
test_ledscape: $(TRG_test_ledscape)
all: test_linpix test_animation
%.o: %.cc $(HEADERS)
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/%.o: %.cc $(HEADERS)
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c $< -o $@
#$(TRG_rgb2hsv): $(OBJECTS) $(TARGETOBJ)/rgb2hsv.o
# @mkdir -p $(@D)
# $(CC) $(OBJECTS) $(TARGETOBJ)/rgb2hsv.o $(LIBS) -o $@
$(TRG_test_animation): $(OBJECTS) $(TARGETOBJ)/test_animation.o
@mkdir -p $(@D)
$(CC) $(OBJECTS) $(TARGETOBJ)/test_animation.o $(LIBS) -o $@
$(TRG_test_linpix): $(OBJECTS) $(TARGETOBJ)/test_linpix.o
@mkdir -p $(@D)
$(CC) $(OBJECTS) $(TARGETOBJ)/test_linpix.o $(LIBS) -o $@
$(TRG_test_ledscape): $(OBJECTS) $(TARGETOBJ)/test_ledscape.o
@mkdir -p $(@D)
$(CC) $(OBJECTS) $(TARGETOBJ)/test_ledscape.o $(LIBS) -o $@
clean:
rm -rf $(OBJDIR)
rm -f $(TRG_test_animation)
rm -f $(TRG_test_linpix)
rm -f $(TRG_test_ledscape)