From: Felix Fietkau Date: Mon, 30 Jul 2007 21:14:08 +0000 (+0000) Subject: next round of cleanup, convert target/ - make -j works now ;) X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=d7f2cb164209468046dc093a35d4f10c7350944b;p=openwrt%2Fstaging%2Fblocktrron.git next round of cleanup, convert target/ - make -j works now ;) SVN-Revision: 8242 --- diff --git a/Makefile b/Makefile index fbed1297a1..50cf8c985b 100644 --- a/Makefile +++ b/Makefile @@ -25,10 +25,17 @@ else include rules.mk include $(INCLUDE_DIR)/depends.mk include $(INCLUDE_DIR)/subdir.mk + include $(INCLUDE_DIR)/target.mk + include target/Makefile include package/Makefile include tools/Makefile include toolchain/Makefile +$(toolchain/stamp-compile): $(tools/stamp-compile) +$(target/stamp-compile): $(toolchain/stamp-install) $(tools/stamp-install) +$(package/stamp-compile): $(target/stamp-compile) +$(target/stamp-install): $(package/stamp-compile) $(package/stamp-install) + clean: FORCE rm -rf build_* bin tmp @@ -38,32 +45,13 @@ dirclean: clean distclean: dirclean config-clean symlinkclean docs/clean rm -rf dl -target/%: FORCE - $(MAKE) -C $(patsubst %/$*,%,$@) $* - # check prerequisites before starting to build -prereq: tmp/.prereq-target $(package/stamp-prereq) ; +prereq: $(package/stamp-prereq) $(target/stamp-prereq) ; -world: .config $(tools/stamp-install) $(toolchain/stamp-install) FORCE - $(MAKE) target/compile - $(MAKE) package/compile - $(MAKE) package/install - $(MAKE) target/install +world: .config $(tools/stamp-install) $(toolchain/stamp-install) $(target/stamp-compile) $(package/stamp-compile) $(package/stamp-install) $(target/stamp-install) FORCE $(MAKE) package/index package/symlinks: $(SCRIPT_DIR)/feeds.sh $(CONFIG_SOURCE_FEEDS) $(CONFIG_SOURCE_FEEDS_REV) -# FIXME: remove after converting target/ to new structure -tmp/.prereq-target: tmp/.targetinfo .config -tmp/.prereq-target: include/prereq.mk - mkdir -p tmp - rm -f tmp/.host.mk - @+$(NO_TRACE_MAKE) -s -C target prereq 2>/dev/null || { \ - echo "Prerequisite check failed. Use FORCE=1 to override."; \ - false; \ - } - touch $@ -.SILENT: tmp/.prereq-target - endif diff --git a/include/host-build.mk b/include/host-build.mk index 2950ec7217..d83446558e 100644 --- a/include/host-build.mk +++ b/include/host-build.mk @@ -1,5 +1,5 @@ # -# Copyright (C) 2006 OpenWrt.org +# Copyright (C) 2006-2007 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -12,6 +12,7 @@ include $(INCLUDE_DIR)/depends.mk STAMP_PREPARED:=$(PKG_BUILD_DIR)/.prepared_$(shell find ${CURDIR} $(PKG_FILE_DEPEND) $(DEP_FINDPARAMS) | md5s) STAMP_CONFIGURED:=$(PKG_BUILD_DIR)/.configured STAMP_BUILT:=$(PKG_BUILD_DIR)/.built +override MAKEFLAGS= include $(INCLUDE_DIR)/quilt.mk diff --git a/include/kernel-build.mk b/include/kernel-build.mk index 7a02d5553d..24c538fbb1 100644 --- a/include/kernel-build.mk +++ b/include/kernel-build.mk @@ -11,6 +11,8 @@ include $(INCLUDE_DIR)/host.mk include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/prereq.mk +override MAKEFLAGS= + GENERIC_LINUX_CONFIG:=$(GENERIC_PLATFORM_DIR)/config-$(shell [ -f "$(GENERIC_PLATFORM_DIR)/config-$(KERNEL_PATCHVER)" ] && echo "$(KERNEL_PATCHVER)" || echo template ) LINUX_CONFIG_DIR ?= ./config$(shell [ -d "./config-$(KERNEL_PATCHVER)" ] && printf -- "-$(KERNEL_PATCHVER)" || true ) LINUX_CONFIG ?= $(LINUX_CONFIG_DIR)/default @@ -172,6 +174,7 @@ oldconfig menuconfig: $(STAMP_PREPARED) FORCE $(SCRIPT_DIR)/config.pl '>' $(GENERIC_LINUX_CONFIG) $(LINUX_DIR)/.config > $(LINUX_CONFIG) install: $(LINUX_DIR)/.image + $(MAKE) -C image install clean: FORCE rm -f $(STAMP_DIR)/.linux-compile @@ -184,4 +187,7 @@ rebuild: FORCE fi @$(MAKE) compile +image-prereq: + $(MAKE) -C image prereq +prereq: image-prereq diff --git a/include/package.mk b/include/package.mk index e322cb908c..c68bd10652 100644 --- a/include/package.mk +++ b/include/package.mk @@ -1,5 +1,5 @@ # -# Copyright (C) 2006,2007 OpenWrt.org +# Copyright (C) 2006-2007 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -24,6 +24,7 @@ include $(INCLUDE_DIR)/package-defaults.mk include $(INCLUDE_DIR)/package-dumpinfo.mk include $(INCLUDE_DIR)/package-ipkg.mk +override MAKEFLAGS= export CONFIG_SITE:=$(INCLUDE_DIR)/site/$(REAL_GNU_TARGET_NAME) ifeq ($(DUMP)$(filter prereq clean refresh update,$(MAKECMDGOALS)),) diff --git a/include/prereq.mk b/include/prereq.mk index 8a08be8e68..660f67cb1b 100644 --- a/include/prereq.mk +++ b/include/prereq.mk @@ -1,5 +1,5 @@ # -# Copyright (C) 2006 OpenWrt.org +# Copyright (C) 2006-2007 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -47,3 +47,4 @@ define RequireCommand $$(eval $$(call Require,$(1),$(2))) endef +.NOTPARALLEL: diff --git a/include/subdir.mk b/include/subdir.mk index da37573c78..4348c7b93d 100644 --- a/include/subdir.mk +++ b/include/subdir.mk @@ -24,7 +24,8 @@ define subdir $(call warn,$(1),d,BD $(1)/$(bd)) $(foreach target,$(SUBTARGETS), $(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(target): $($(1)/$(bd)/$(target)) $(call $(1)//$(target),$(1)/$(bd))) - @+$$(MAKE) -j1 -C $(1)/$(bd) $(target) + +$$(MAKE) -j1 -C $(1)/$(bd) $(target) + $$(if $(call debug,$(1)/$(bd),v),,.SILENT: $(1)/$(bd)/$(target)) # legacy targets $(call warn_eval,$(1)/$(bd),l,T,$(1)/$(bd)-$(target): $(1)/$(bd)/$(target)) @@ -36,12 +37,18 @@ endef # Parameters: define stampfile $(1)/stamp-$(3):=$(STAGING_DIR)/stampfiles/.$(2)_$(3) - $(call rdep,$(1),$$($(1)/stamp-$(3)),) + $(if __rdep_$(1),, + $(call rdep,$(1),$$($(1)/stamp-$(3)),) + __rdep_$(1):=1 + ) $$($(1)/stamp-$(3)): - @+$(MAKE) $(1)/$(3) + @+$(MAKE) $$($(1)/flags-$(3)) $(1)/$(3) @mkdir -p $$$$(dirname $$($(1)/stamp-$(3))) @touch $$($(1)/stamp-$(3)) + + $$(if $(call debug,$(1),v),,.SILENT: $$($(1)/stamp-$(3))) + .PRECIOUS: $$($(1)/stamp-$(3)) # work around a make bug $(1)//clean:=$(1)/stamp-$(3)/clean diff --git a/include/target.mk b/include/target.mk index 1718a869c1..b0a178e306 100644 --- a/include/target.mk +++ b/include/target.mk @@ -1,11 +1,10 @@ # -# Copyright (C) 2006 OpenWrt.org +# Copyright (C) 2007 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. # - define AddProfile ifeq ($(CONFIG_LINUX_$(1)),y) $(call Profile/$(1)) @@ -13,13 +12,10 @@ define AddProfile endif endef -include $(TMP_DIR)/.target.mk +-include $(TMP_DIR)/.target.mk ifeq ($(IB),1) $(TMP_DIR)/.target.mk: $(TOPDIR)/.target.mk $(CP) $< $@ -else -$(TMP_DIR)/.target.mk: $(TMP_DIR)/.targetinfo - $(SCRIPT_DIR)/metadata.pl target_mk < $(TMP_DIR)/.targetinfo > $@ endif diff --git a/include/toplevel.mk b/include/toplevel.mk index 33b318abb7..af4b390e4e 100644 --- a/include/toplevel.mk +++ b/include/toplevel.mk @@ -30,7 +30,7 @@ endif SCAN_COOKIE?=$(shell echo $$$$) export SCAN_COOKIE -tmp/.packageinfo tmp/.targetinfo prepare-tmpinfo: FORCE +prepare-tmpinfo: FORCE mkdir -p tmp/info +$(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPS="$(TOPDIR)/include/package*.mk" SCAN_DEPTH=4 SCAN_EXTRA="" +$(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPS="profiles/*.mk $(TOPDIR)/include/kernel*.mk" SCAN_DEPTH=2 SCAN_EXTRA="" @@ -39,6 +39,8 @@ tmp/.packageinfo tmp/.targetinfo prepare-tmpinfo: FORCE [ "$$t" -nt "$$f" ] || ./scripts/metadata.pl $${type}_config < "$$f" > "$$t" || { rm -f "$$t"; echo "Failed to build $$t"; false; break; }; \ done ./scripts/metadata.pl package_mk < tmp/.packageinfo > tmp/.packagedeps || { rm -f tmp/.packagedeps; false; } + ./scripts/metadata.pl target_mk < $(TMP_DIR)/.targetinfo > tmp/.target.mk + touch $(TOPDIR)/tmp/.build .config: ./scripts/config/conf prepare-tmpinfo @+if [ \! -f .config ]; then \ @@ -101,7 +103,7 @@ prereq:: .config %:: @+$(PREP_MK) $(NO_TRACE_MAKE) -s prereq - @+$(MAKE) $@ + @+$(MAKE) -r $@ help: cat README @@ -117,7 +119,7 @@ symlinkclean: rm -rf tmp ifeq ($(findstring v,$(DEBUG)),) - .SILENT: symlinkclean clean dirclean distclean config-clean download help tmpinfo-clean .config scripts/config/mconf scripts/config/conf menuconfig tmp/.prereq-build tmp/.prereq-package tmp/.prereq-target tmp/.packageinfo tmp/.targetinfo prepare-tmpinfo + .SILENT: symlinkclean clean dirclean distclean config-clean download help tmpinfo-clean .config scripts/config/mconf scripts/config/conf menuconfig tmp/.prereq-build tmp/.prereq-package tmp/.prereq-target prepare-tmpinfo endif .PHONY: help FORCE .NOTPARALLEL: diff --git a/package/Makefile b/package/Makefile index 78ea070681..e94b90d4a1 100644 --- a/package/Makefile +++ b/package/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2006 OpenWrt.org +# Copyright (C) 2006-2007 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -8,14 +8,14 @@ curdir:=package -include .config -include $(TMP_DIR)/.packagedeps $(curdir)/builddirs:=$(sort $(package-) $(package-y) $(package-m)) $(curdir)/builddirs-default:=. $(sort $(package-y) $(package-m)) $(curdir)/builddirs-prereq:=. $(sort $(prereq-y) $(prereq-m)) $(curdir)/builddirs-install:=. $(sort $(package-y)) -$(curdir)//compile:=.config prereq +$(curdir)//compile = $(1)/prepare +$(curdir)//install = $(1)/compile $(curdir)/install:=$(curdir)/install-cleanup $(curdir)/install-cleanup: rm -rf $(BUILD_DIR)/root @@ -39,5 +39,12 @@ $(curdir)/install-cleanup: $(curdir)/index: FORCE (cd $(PACKAGE_DIR); $(SCRIPT_DIR)/ipkg-make-index.sh . > Packages) +$(curdir)/flags-install:= -j1 + $(eval $(call stampfile,$(curdir),package,prereq)) +$(eval $(call stampfile,$(curdir),package,compile)) +$(eval $(call stampfile,$(curdir),package,install)) + +$($(curdir)/stamp-install): $($(curdir)/stamp-compile) + $(eval $(call subdir,$(curdir))) diff --git a/target/Makefile b/target/Makefile index 4885ab98d3..fef3d82e4c 100644 --- a/target/Makefile +++ b/target/Makefile @@ -1,55 +1,23 @@ # -# Copyright (C) 2006 OpenWrt.org +# Copyright (C) 2007 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. # -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/target.mk +curdir:=target -all: install +$(curdir)/builddirs:=linux sdk imagebuilder +$(curdir)/builddirs-prereq:=linux +$(curdir)/builddirs-default:=linux $(if $(CONFIG_SDK),sdk) $(if $(CONFIG_IB),imagebuilder) -$(BIN_DIR): - mkdir -p $(BIN_DIR) +$(curdir)/imagebuilder/prepare:=$(curdir)/linux/install -linux-install: $(BIN_DIR) -image_install: linux-install +$(eval $(call stampfile,$(curdir),target,prereq)) +$(eval $(call stampfile,$(curdir),target,compile)) +$(eval $(call stampfile,$(curdir),target,install)) -IMAGE_DIR:=linux/$(BOARD)-$(KERNEL)/image +$($(curdir)/stamp-prereq): .config +$($(curdir)/stamp-compile): $(TMP_DIR)/.build +$($(curdir)/stamp-install): $($(curdir)/stamp-compile) -download: $(patsubst %,%-download,$(TARGETS-y)) -prepare: linux-prepare -compile: linux-compile image_compile -install: linux-install image_install - -ifeq ($(CONFIG_SDK),y) -install: sdk_install -endif -ifeq ($(CONFIG_IB),y) -install: imagebuilder_install -endif - -clean: linux-clean sdk-clean imagebuilder-clean image_clean - -prereq: FORCE - $(MAKE) -C linux/$(BOARD)-$(KERNEL) prereq - [ \! -f $(IMAGE_DIR)/Makefile ] || $(MAKE) -C $(IMAGE_DIR) prereq - -sdk_install: FORCE - $(MAKE) -C sdk install - -image_clean: FORCE - $(MAKE) -C $(IMAGE_DIR) clean - rm -f $(BIN_DIR)/openwrt-* - -image_compile: FORCE - $(MAKE) -C $(IMAGE_DIR) compile - -image_install: image_compile - $(MAKE) -C $(IMAGE_DIR) install - -imagebuilder_install: image_install - $(MAKE) -C imagebuilder install - -%-prereq %-prepare %-download %-clean %-compile %-install %-refresh %-update: FORCE - $(MAKE) -C $* $(patsubst $*-%,%,$@) +$(eval $(call subdir,$(curdir))) diff --git a/target/linux/Makefile b/target/linux/Makefile index 5a1ca723a6..608cfa8eb0 100644 --- a/target/linux/Makefile +++ b/target/linux/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2006 OpenWrt.org +# Copyright (C) 2006-2007 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -7,6 +7,6 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/target.mk -clean download prepare compile install menuconfig oldconfig update refresh: FORCE +prereq clean download prepare compile install menuconfig oldconfig update refresh: FORCE $(MAKE) -C $(BOARD)-$(KERNEL) $@ diff --git a/toolchain/Makefile b/toolchain/Makefile index b7a45047ae..9e3a781384 100644 --- a/toolchain/Makefile +++ b/toolchain/Makefile @@ -21,7 +21,7 @@ endif $(curdir)/gcc/install:=$(curdir)/uClibc/install # prerequisites for the individual targets -$(curdir)/ := .config $(tools/stamp-install) prereq +$(curdir)/ := .config prereq $(curdir)//prepare = $(STAGING_DIR)/include-host/.done $(curdir)//compile = $(1)/prepare $(curdir)//install = $(1)/compile diff --git a/tools/Makefile b/tools/Makefile index 5ad4bfd723..07944af2bc 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -26,7 +26,6 @@ $(eval $(call copy_include,$(curdir))) # prerequisites for the individual targets $(curdir)/ := .config prereq -$(curdir)//compile = $(1)/prepare $(curdir)//install = $(1)/compile $(eval $(call stampfile,$(curdir),tools,install))