next round of cleanup, convert target/ - make -j works now ;)

SVN-Revision: 8242
This commit is contained in:
Felix Fietkau 2007-07-30 21:14:08 +00:00
parent a7b635f075
commit d7f2cb1642
13 changed files with 64 additions and 88 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)),)

View File

@ -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:

View File

@ -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: <subdir> <name> <target>
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

View File

@ -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

View File

@ -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:

View File

@ -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)))

View File

@ -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)))

View File

@ -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) $@

View File

@ -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

View File

@ -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))