-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
43 lines (30 loc) · 899 Bytes
/
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
#CC = gcc
#RM = rm
#AR = ar
LN = ln
INSTALL = install
MKDIR = mkdir
DIR_BUILD = .build
prefix = /usr/local
PPFLAGS = -MT $@ -MMD -MP -MF $(patsubst %.o, %.d, $@)
CFLAGS_LOCAL = -Wall -g -std=c++11 -coverage -Wno-unused-private-field -O3
CFLAGS_LOCAL += $(CFLAGS)
APP_SOURCES = $(wildcard sources/*.cc)
APP_OBJECTS = $(patsubst %.cc, %.o, $(APP_SOURCES))
APPS = $(basename $(APP_SOURCES))
DEPFILES = $(patsubst %.o, %.d, $(addprefix $(DIR_BUILD)/, $(APP_OBJECTS)))
.PHONY : all clean test
all : $(addprefix $(DIR_BUILD)/, $(APPS))
$(addprefix $(DIR_BUILD)/, $(APPS)) : $(DIR_BUILD)/% : ./%.cc Makefile | $(DIR_BUILD)
$(MKDIR) -p $(@D)
$(CXX) $(CFLAGS_LOCAL) -o $@ $<
$(DIR_BUILD)/%.d : ;
.PRECIOUS : $(DIR_BUILD)/%.d
$(DIR_BUILD) :
$(MKDIR) -p $@
test : all
for app in $(APPS); do ./$(DIR_BUILD)/$${app}; done
clean :
$(RM) -rf $(DIR_BUILD)
$(RM) *.gcda *.gcno
include $(DEPFILES)