| 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 autobuild
|
|---|
| 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 cleandir distclean image_clean target_clean
|
|---|
| 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 | package_index:
|
|---|
| 36 | (cd $(PACKAGE_DIR); $(STAGING_DIR)/usr/bin/ipkg-make-index . > 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 |
|
|---|
| 47 | package/%:
|
|---|
| 48 | @$(TRACE) $@
|
|---|
| 49 | $(MAKE) -C package $(patsubst package/%,%,$@)
|
|---|
| 50 |
|
|---|
| 51 | target/%:
|
|---|
| 52 | @$(TRACE) $@
|
|---|
| 53 | $(MAKE) -C target $(patsubst target/%,%,$@)
|
|---|
| 54 |
|
|---|
| 55 | toolchain/%:
|
|---|
| 56 | @$(TRACE) $@
|
|---|
| 57 | $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
|
|---|
| 58 |
|
|---|
| 59 | tools/%:
|
|---|
| 60 | @$(TRACE) $@
|
|---|
| 61 | $(MAKE) -C tools $(patsubst tools/%,%,$@)
|
|---|
| 62 |
|
|---|
| 63 | #############################################################
|
|---|
| 64 | #
|
|---|
| 65 | # Cleanup and misc junk
|
|---|
| 66 | #
|
|---|
| 67 | #############################################################
|
|---|
| 68 | root_clean:
|
|---|
| 69 | @$(TRACE) root_clean
|
|---|
| 70 | rm -rf $(BUILD_DIR)/linux-*/root $(BUILD_DIR)/root
|
|---|
| 71 |
|
|---|
| 72 | target_clean: root_clean
|
|---|
| 73 | rm -f $(STAMP_DIR)/.*-compile
|
|---|
| 74 | rm -f $(STAMP_DIR)/.*-install
|
|---|
| 75 | rm -rf $(BIN_DIR)
|
|---|
| 76 |
|
|---|
| 77 | clean:
|
|---|
| 78 | @$(TRACE) clean
|
|---|
| 79 | @$(MAKE) -C $(CONFIG) clean
|
|---|
| 80 | rm -rf $(BUILD_DIR) $(BIN_DIR)
|
|---|
| 81 |
|
|---|
| 82 | cleandir:
|
|---|
| 83 | @$(TRACE) cleandir
|
|---|
| 84 | @$(MAKE) -C $(CONFIG) clean
|
|---|
| 85 | rm -rf $(BUILD_DIR) $(BIN_DIR)
|
|---|
| 86 | rm -rf $(TOOLS_BUILD_DIR) $(TOOLCHAIN_BUILD_DIR) $(STAGING_DIR)
|
|---|
| 87 | rm -rf $(STAMP_DIR) $(TOOLS_STAMP_DIR) $(TOOLCHAIN_STAMP_DIR)
|
|---|
| 88 | rm -f .tmpconfig.h
|
|---|
| 89 |
|
|---|
| 90 | distclean:
|
|---|
| 91 | @$(TRACE) distclean
|
|---|
| 92 | @$(MAKE) -C $(CONFIG) clean
|
|---|
| 93 | rm -rf $(BUILD_DIR) $(BIN_DIR) $(DL_DIR)
|
|---|
| 94 | rm -rf $(TOOLS_BUILD_DIR) $(TOOLCHAIN_BUILD_DIR) $(STAGING_DIR)
|
|---|
| 95 | rm -rf $(STAMP_DIR) $(TOOLS_STAMP_DIR) $(TOOLCHAIN_STAMP_DIR)
|
|---|
| 96 | rm -f .config* .tmpconfig.h
|
|---|
| 97 |
|
|---|
| 98 | else # ifeq ($(strip $(FWRT_HAVE_DOT_CONFIG)),y)
|
|---|
| 99 |
|
|---|
| 100 | include $(TOPDIR)/lbin/prereq.mk
|
|---|
| 101 |
|
|---|
| 102 | all: menuconfig
|
|---|
| 103 | @echo "Start the build with \"make\" or with \"make v\" to be verbose"
|
|---|
| 104 |
|
|---|
| 105 | # configuration
|
|---|
| 106 | # ---------------------------------------------------------------------------
|
|---|
| 107 |
|
|---|
| 108 | $(CONFIG)/conf:
|
|---|
| 109 | @$(MAKE) -C $(CONFIG) conf
|
|---|
| 110 | $(CONFIG)/mconf:
|
|---|
| 111 | @$(MAKE) -C $(CONFIG)
|
|---|
| 112 |
|
|---|
| 113 | menuconfig: $(CONFIG)/mconf
|
|---|
| 114 | @-touch .config
|
|---|
| 115 | @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
|
|---|
| 116 |
|
|---|
| 117 | config: $(CONFIG)/conf
|
|---|
| 118 | @-touch .config
|
|---|
| 119 | @$(CONFIG)/conf $(CONFIG_CONFIG_IN)
|
|---|
| 120 |
|
|---|
| 121 | oldconfig: $(CONFIG)/conf
|
|---|
| 122 | @-touch .config
|
|---|
| 123 | @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
|
|---|
| 124 |
|
|---|
| 125 | autobuild: $(CONFIG)/conf
|
|---|
| 126 | @-touch .config
|
|---|
| 127 | @$(CONFIG)/conf -m $(CONFIG_CONFIG_IN)
|
|---|
| 128 | @grep -v ^BUSYBOX .config > .config.autobuild
|
|---|
| 129 | @cat .busybox-config .config.autobuild > .config
|
|---|
| 130 |
|
|---|
| 131 | tools/install-lbin:
|
|---|
| 132 | $(MAKE) -C tools install-lbin
|
|---|
| 133 |
|
|---|
| 134 | endif # ifeq ($(strip $(FWRT_HAVE_DOT_CONFIG)),y)
|
|---|