-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
60 lines (47 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
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
#####
# vars
#####
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
MKFILE_DIR := $(dir $(MKFILE_PATH))
#####
# Functions
#####
# Make does not offer a recursive wildcard function, so here's one:
rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))
define check_cmd_path
$(eval
_EXECUTABLE = $(1)
_EXPECTED_PATH = $(2)
ifndef _EXECUTABLE
$$(error Missing argument on 'check_cmd' call)
endif
_CMD_PATH = $$(shell PATH="$$(PATH)" which $$(_EXECUTABLE))
ifdef _CMD_PATH
ifdef _EXPECTED_PATH
ifneq ($$(_CMD_PATH),$$(_EXPECTED_PATH))
$$(error Expecting '$$(_EXECUTABLE)' to be in '$$(_EXPECTED_PATH)' but found in '$$(_CMD_PATH)')
endif
endif
else
$$(error '$$(_EXECUTABLE)' not found in $$$$PATH)
endif
)
endef
#####
# Targets
#####
.PHONY: all
all: test
.PHONY: clean
clean:
rm -rf $(CLEAN)
.SECONDARY: $(CLEAN)
# invoking make V=1 will print everything
$(V).SILENT:
#####
# Includes
#####
dir := test
include $(dir)/Rules.mk