-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (59 loc) · 1.76 KB
/
Makefile
File metadata and controls
72 lines (59 loc) · 1.76 KB
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
include buildsystem/func.mk
# Host OS
export HOSTOS := $(call TOUPPER,$(call USCORESUB,$(shell uname -s)))
# Verbose Option
ifeq ($(VERBOSE),1)
export Q :=
export VERBOSE := 1
else
export Q := @
export VERBOSE := 0
endif
# Machine Name and Tool Versions
export MACHINE := $(call USCORESUB,$(shell uname -sm))
export CCNAME := $(call USCORESUB,$(notdir $(realpath $(shell which $(CC)))))
# Build Directory
BUILDDIR_ROOT := buildresults
export BUILDDIR := $(BUILDDIR_ROOT)/$(MACHINE)/$(CCNAME)
# Target Directory
TARGETDIR := targets
# Build Target List
TARGETS := $(basename $(notdir $(wildcard $(TARGETDIR)/*.mk)))
ifeq ($(TARGETMK),)
.DEFAULT_GOAL := help
else
.DEFAULT_GOAL := buildtarget
endif
.PHONY : help
help :
@echo "usage: make <target[.config]>"
@echo " make TARGETMK=<target makefile> [CONFIG=<config>]"
@echo " make all"
@echo " make clean"
@echo "other options:"
@echo " VERBOSE setting this to 1 enables verbose output"
@echo " INSTALL setting this to 1 runs the install script for"
@echo " each goal specified"
@echo " ANALYZE run static analysis (only works with clang)"
@echo "targets:"
$(call PRINTLIST,$(TARGETS), * )
all : $(TARGETS)
# <target> rule (all configs)
.PHONY : $(TARGETS)
$(TARGETS) :
$(Q)$(MAKE) -f buildsystem/target.mk \
TARGETMK="$(TARGETDIR)/$@.mk"
# <target>.<config> rule
$(addsuffix .%,$(TARGETS)) :
$(Q)$(MAKE) -f buildsystem/target.mk \
CONFIG=$(call EXTRACT_CONFIG,$@) \
TARGETMK="$(TARGETDIR)/$(call EXTRACT_TARGET,$@).mk"
# Rule for situations where environment is passed in
.PHONY : buildtarget
buildtarget :
$(Q)$(MAKE) -f buildsystem/target.mk
### Utility Rules ###
.PHONY : clean
clean :
$(Q)-rm -rf $(BUILDDIR_ROOT)
$(call OUTPUTINFO,CLEAN,$(BUILDDIR_ROOT))