-
Notifications
You must be signed in to change notification settings - Fork 84
/
Makefile
58 lines (42 loc) · 1.86 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
TC_DIR := .
SDK_DIR := $(abspath $(TC_DIR)/sdk)
include Makefile.platform
USERSPACE_DEPS := vm stir firmware
TEST_DEPS := emulator
DOCS := docs/doxygen
USERSPACE := launcher sdk/examples extras
TOOLS := tools/fwdeploy swiss
SDK_VERSION := $(shell git describe --tags)
# Default parallelization for make. Override on the command line
PARALLEL := -j 4
# Build order matters
ALL_SUBDIRS := $(USERSPACE_DEPS) $(DOCS) $(TOOLS) $(USERSPACE) $(TEST_DEPS) test
NONUSER_SUBDIRS := $(USERSPACE_DEPS) $(DOCS) $(TOOLS) $(TEST_DEPS) test
.PHONY: clean _userspace_clean $(ALL_SUBDIRS)
all: sdk-deps $(ALL_SUBDIRS)
# Set up SDK environment vars for userspace code
# NOTE: We totally replace $PATH here, as well as in 'clean' below,
# and in the similar build rules in our SDK tests. This is primarily to
# work around a bug in our 'make' on Windows when parenthesis are in $PATH,
# but it also helps keep us honest about our SDK build being self-contained.
$(USERSPACE):
PATH="$(SDK_DIR)/bin:/bin:/usr/bin:/usr/local/bin" SDK_DIR="$(SDK_DIR)" CCFLAGS="-DSDK_VERSION=$(SDK_VERSION)" make -C $@
# Plain subdir builds (Don't parallelize tests, docs, firmware)
$(DOCS) test firmware $(TOOLS):
@$(MAKE) -C $@
# Parallelize our large builds
vm stir emulator:
@$(MAKE) $(PARALLEL) -C $@
clean: sdk-deps-clean docs-clean nonuser-clean userspace-clean
.PHONY: sdk-deps-clean docs-clean nonuser-clean userspace-clean
docs-clean:
rm -Rf sdk/doc/*
nonuser-clean:
@for dir in $(NONUSER_SUBDIRS); do $(MAKE) -C $$dir clean; done
userspace-clean:
@PATH="$(SDK_DIR)/bin:/bin:/usr/bin:/usr/local/bin" SDK_DIR="$(SDK_DIR)" make _userspace_clean
# Internal target for 'clean', with userspace environment vars set up. I couldn't
# see a better way to set up environment vars and do the 'for' loop in one step.
_userspace_clean:
@for dir in $(USERSPACE); do $(MAKE) -C $$dir clean; done
include Makefile.sdk-deps