-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
50 lines (36 loc) · 1.49 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
# makefile for parallel kernel builds, sorry for my primitive
# skills, I'm sure it can be written in a simpler way
CROSS_COMPILE_arm = arm-unknown-linux-gnueabi-
CROSS_COMPILE_arm64 = aarch64-unknown-linux-gnu-
CROSS_COMPILE_x86 = x86_64-pc-linux-gnu-
CROSS_COMPILE_i386 = x86_64-pc-linux-gnu-
CROSS_COMPILE_riscv = riscv64-unknown-linux-gnu-
O := obj-tmp
CC ?= "$(CROSS_COMPILE)gcc"
export O
ALLCONFIGS := $(wildcard arch/$(ARCH)/configs/*config)
ALLTARGETS := $(patsubst arch/$(ARCH)/configs/%,build-$(ARCH)-%,$(ALLCONFIGS))
LOGDIR ?= .
%:
+@$(MAKE) -f Makefile O=$(O) $@
all:
+@$(MAKE) -f Makefile O=$(O)
.PHONY: buildall
build/%:
@mkdir -p build/$*
define buildrules
build-$(1)-%: build/$(1)-%
@touch $(LOGDIR)/buildall.$(1).$$*.log.started
+@$(MAKE) -f Makefile ARCH=$(1) CROSS_COMPILE="$$(CROSS_COMPILE_$(1))" O=$$< $$* > /dev/null
+@$(MAKE) -f Makefile ARCH=$(1) CROSS_COMPILE="$$(CROSS_COMPILE_$(1))" O=$$< olddefconfig > /dev/null
+@$(MAKE) -sk -f Makefile ARCH=$(1) CROSS_COMPILE="$$(CROSS_COMPILE_$(1))" O=$$< 2> buildall.$(1).$$*.log \
&& mv buildall.$(1).$$*.log $(LOGDIR)/buildall.$(1).$$*.log.passed \
|| mv buildall.$(1).$$*.log $(LOGDIR)/buildall.$(1).$$*.log.failed
rm -rf $(LOGDIR)/buildall.$(1).$$*.log.started $$<
endef
ARCHES:=arm arm64 x86 i386 riscv
$(foreach arch,$(ARCHES),$(eval $(call buildrules,$(arch))))
tcinfo-%:
@$(CROSS_COMPILE_$*)gcc -v 2>&1 | tail -1 > $(LOGDIR)/tc.$*
tcinfo: $(foreach arch,$(ARCHES),t-$(arch))
buildall: tcinfo $(ALLTARGETS)