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