blob: 290c142c92e4d8a0ea1484c0bccb50404de506c4 (
plain)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
# If no .config on main folder i have to create one
NONE := $(shell touch .config)
include .config
# Verbose build output:
# V=0: minimal output
# V=1: verbose output from latex tools (like latexmk)
# V=2: verbose output from all commands and make as well
ifeq ("$(origin V)", "command line")
BUILD_VERBOSE = $(V)
endif
ifndef BUILD_VERBOSE
BUILD_VERBOSE = 0
endif
ifeq ($(BUILD_VERBOSE),2)
Q =
else
Q = @
endif
TOP_DIR := $(CURDIR)
PATHS :=
CONFIG_PATH := $(CURDIR)
CONFIG_FILE := .config
CONFIG := $(CONFIG_PATH)/$(CONFIG_FILE)
CONFIG_OLD := $(CONFIG).old
DEPLOY_FOLDER := deploy
DEPLOY := $(CONFIG_PATH)/$(DEPLOY_FOLDER)
HANDOUT_FOLDER := handouts
HANDOUT :=$(DEPLOY)/$(HANDOUT_FOLDER)
DEFCONF_FOLDER := $(CURDIR)/configs
BUILD_COMMAND := latexmk
BUILD_ARGS := -f -halt-on-error -xelatex -bibtex -pdf
ifeq ($(BUILD_VERBOSE),0)
BUILD_ARGS += --interaction=batchmode -silent
else
BUILD_ARGS += --interaction=errorstopmode -verbose
endif
BUILD := $(BUILD_COMMAND) $(BUILD_ARGS)
KCONFIG_PATH := ./kconfig-frontends/frontends
KCONFIG := $(KCONFIG_PATH)/conf/conf
KMCONFIG := $(KCONFIG_PATH)/mconf/mconf
MODMK = $(MAKE) -f $(TOP_DIR)/modules.mk
ifneq ($(BUILD_VERBOSE),2)
MODMK += --quiet
endif
# Folder that should not include to build paths
EXCLUDE_PATH := \
grep -v ./kconfig-frontends | \
grep -v ./.git | \
grep -v ./kernel-devel/module-basics/vain | \
grep -v ./kernel-devel/module-basics/vain_pci | \
grep -v ./kernel-devel/module-basics/vain_plat | \
grep -v ./examples
# Search for all folders with Makfile
MAKE_FILES = $(shell find . -mindepth 2 -name Makefile | $(EXCLUDE_PATH))
PATHS = $(dir $(MAKE_FILES))
export
build: $(BUILD_REQ)
$(Q)mkdir -p $(HANDOUT)
$(Q)$(foreach dir,$(PATHS),$(MODMK) -C $(dir) $@;)
$(KMCONFIG):
cd kconfig-frontends/ && ./configure && make
$(KCONFIG):
cd kconfig-frontends/ && ./configure && make
menuconfig: $(KMCONFIG)
$(Q)$(KMCONFIG) Kconfig
config: $(KCONFIG)
$(Q)$(KCONFIG) --oldaskconfig Kconfig
oldconfig: $(KCONFIG)
$(Q)cp $@ $(CONFIG_FILE)
$(Q)$(KCONFIG) --oldconfig Kconfig
clean:
$(Q)$(foreach dir,$(PATHS),$(MODMK) -C $(dir) $@_texfiles;)
$(Q)rm -rf $(DEPLOY_FOLDER)
mrproper: clean
$(Q)echo [CLEAN] $@
$(Q)rm -f $(CONFIG)
$(Q)rm -f $(CONFIG_OLD)
distclean: mrproper
$(Q)echo [CLEAN] $@
$(Q)find -name "tmp*" -exec rm -f {} \;
%_defconfig: $(KCONFIG)
$(Q)cp $(DEFCONF_FOLDER)/$@ $(CONFIG_FILE)
$(Q)$(KCONFIG) --oldconfig Kconfig
.PHONY: config oldconfig menuconfig build clean mrproper distclean
|