source: freewrt/mk/build.mk@ 18face91

freewrt_2_0
Last change on this file since 18face91 was 1b2d56f, checked in by Waldemar Brodkorb <wbx@…>, 4 months ago

linux: update to 6.12, cleanup

  • Property mode set to 100644
File size: 3.7 KB
Line 
1# This file is part of the FreeWRT project. FreeWRT is copyrighted
2# material, please see the LICENCE file in the top-level directory
3
4TOPDIR=${shell pwd}
5export TOPDIR
6
7CONFIG_CONFIG_IN = Config.in
8CONFIG = package/config
9
10noconfig_targets := menuconfig config tags allnoconfig allmodconfig snapshotconfig
11
12# Pull in the user's configuration file
13ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
14-include $(TOPDIR)/.config
15endif
16
17ifeq ($(strip $(FWRT_HAVE_DOT_CONFIG)),y)
18include $(TOPDIR)/rules.mk
19
20all: world
21
22.NOTPARALLEL:
23.PHONY: all world clean cleanbuild cleandir distclean image_clean target_clean allpackages
24
25# In this section, we need .config
26-include .config.cmd
27
28world: $(DL_DIR) $(BUILD_DIR) $(STAMP_DIR)
29 ${BASH} ${TOPDIR}/scripts/scan-pkgs.sh
30 $(MAKE) -f mk/build.mk tools/install toolchain/install target/compile package/compile root_clean package/install target/install package_index
31
32allpackages: $(DL_DIR) $(BUILD_DIR) $(STAMP_DIR)
33 $(MAKE) -f mk/build.mk package/compile
34
35package_index:
36 (cd $(PACKAGE_DIR); $(TOPDIR)/scripts/ipkg-make-index.sh . > Packages)
37
38$(DL_DIR):
39 @mkdir -p $(DL_DIR)
40
41$(BUILD_DIR):
42 @mkdir -p $(BUILD_DIR)
43
44$(STAMP_DIR):
45 @mkdir -p $(STAMP_DIR)
46
47package/%:
48 @$(TRACE) $@
49 $(MAKE) -C package $(patsubst package/%,%,$@)
50
51target/%:
52 @$(TRACE) $@
53 $(MAKE) -C target $(patsubst target/%,%,$@)
54
55toolchain/%:
56 @$(TRACE) $@
57 $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
58
59tools/%:
60 @$(TRACE) $@
61 $(MAKE) -C tools $(patsubst tools/%,%,$@)
62
63#############################################################
64#
65# Cleanup and misc junk
66#
67#############################################################
68root_clean:
69 @$(TRACE) root_clean
70 rm -rf $(BUILD_DIR)/linux-*/root $(BUILD_DIR)/root
71
72target_clean: root_clean
73 rm -f $(STAMP_DIR)/.*-compile
74 rm -f $(STAMP_DIR)/.*-install
75 rm -rf $(BIN_DIR)
76
77clean:
78 @$(TRACE) clean
79 @$(MAKE) -C $(CONFIG) clean
80 rm -rf $(BUILD_DIR) $(BIN_DIR)
81
82cleanbuild:
83 @$(TRACE) clean
84 rm -rf $(BUILD_DIR)
85
86cleandir:
87 @$(TRACE) cleandir
88 @$(MAKE) -C $(CONFIG) clean
89 rm -rf $(BUILD_DIR) $(BIN_DIR)
90 rm -rf $(TOOLS_BUILD_DIR) $(TOOLCHAIN_BUILD_DIR) $(STAGING_DIR)
91 rm -rf $(STAMP_DIR) $(TOOLS_STAMP_DIR) $(TOOLCHAIN_STAMP_DIR)
92 rm -f .tmpconfig.h
93
94distclean:
95 @$(TRACE) distclean
96 @$(MAKE) -C $(CONFIG) clean
97 rm -rf $(BUILD_DIR) $(BIN_DIR) $(DL_DIR)
98 rm -rf $(TOOLS_BUILD_DIR) $(TOOLCHAIN_BUILD_DIR) $(STAGING_DIR)
99 rm -rf $(STAMP_DIR) $(TOOLS_STAMP_DIR) $(TOOLCHAIN_STAMP_DIR)
100 rm -f .config* .tmpconfig.h
101
102else # ifeq ($(strip $(FWRT_HAVE_DOT_CONFIG)),y)
103
104include $(TOPDIR)/lbin/prereq.mk
105
106all: menuconfig
107 @echo "Start the build with \"make\" or with \"make v\" to be verbose"
108
109# configuration
110# ---------------------------------------------------------------------------
111
112$(CONFIG)/conf:
113 @$(MAKE) -C $(CONFIG) conf
114$(CONFIG)/mconf:
115 @$(MAKE) -C $(CONFIG)
116
117menuconfig: $(CONFIG)/mconf
118 @-touch .config
119 @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
120
121config: $(CONFIG)/conf
122 @-touch .config
123 @$(CONFIG)/conf $(CONFIG_CONFIG_IN)
124
125allnoconfig: $(CONFIG)/conf
126 @-touch .config
127 @$(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
128
129# add patterns for config symbols to always restore from default here
130RESTORE_PATTERNS := BUSYBOX
131allmodconfig: $(CONFIG)/conf
132 @$(CONFIG)/conf -m $(CONFIG_CONFIG_IN)
133 scripts/restore-defaultconf.sh $(RESTORE_PATTERNS)
134
135snapshotconfig: $(CONFIG)/conf
136 @$(CONFIG)/conf -m Config.in.snapshot
137 scripts/restore-defaultconf.sh $(RESTORE_PATTERNS)
138
139tools/%:
140 @$(MAKE) -C tools $(patsubst tools/%,%,$@)
141
142distclean:
143 @$(MAKE) -C $(CONFIG) clean
144 @rm -rf $(BUILD_DIR) $(BIN_DIR) $(DL_DIR)
145 @rm -rf $(TOOLS_BUILD_DIR) $(TOOLCHAIN_BUILD_DIR) $(STAGING_DIR)
146 @rm -rf $(STAMP_DIR) $(TOOLS_STAMP_DIR) $(TOOLCHAIN_STAMP_DIR)
147 @rm -rf staging_dir_ tools_build
148 @rm -f .config* .tmpconfig.h
149
150endif # ifeq ($(strip $(FWRT_HAVE_DOT_CONFIG)),y)
Note: See TracBrowser for help on using the repository browser.