-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefuncs.mk
More file actions
40 lines (29 loc) · 874 Bytes
/
makefuncs.mk
File metadata and controls
40 lines (29 loc) · 874 Bytes
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
CC=g++
IFLAGS = -I. -I$(PRJSRC)
define eyecatcher
@echo ==== $(1) ==== $(shell date +%T)
endef
define ensure-output-dir
@mkdir -p $(dir $(1))
endef
define buildrecipe-basic-unittest
$(call eyecatcher, Build Unit Test:${notdir $@})
$(call ensure-output-dir, $@)
$(CC) -g -ggdb -O0 -o $@ $(IFLAGS) $^
endef
define exec-basic-unittest
$(call eyecatcher, Run Test Target:$(notdir $@) Binary:$(notdir $(1)))
$(1) $(2)
endef
#Function: Build a unit test and add it to the list of tests to run
#Parameter 1: Name of test executable
#Parameter 2: (space separated) source files
define build-basic-unittest
TEST-TARGETS += $(BINDIR)/$(strip $(1))
$(BINDIR)/$(strip $(1)): $2
$$(call buildrecipe-basic-unittest)
EXEC-TEST-TARGETS += exec_$(strip $(1))
exec_$(strip $(1)): $(BINDIR)/$(strip $(1))
$$(call exec-basic-unittest, $$<)
.PHONY:: exec_$(strip $(1))
endef