mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-23 23:16:16 +02:00
clean up recursive dependency handling, use timestamp.pl again, because it saves memory and execution time
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@8558 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
3a065a453f
commit
40aa2d8b06
2
Makefile
2
Makefile
@ -14,12 +14,12 @@ export TOPDIR LC_ALL LANG IS_TTY
|
|||||||
|
|
||||||
world:
|
world:
|
||||||
|
|
||||||
include $(TOPDIR)/include/debug.mk
|
|
||||||
include $(TOPDIR)/include/host.mk
|
include $(TOPDIR)/include/host.mk
|
||||||
|
|
||||||
ifneq ($(OPENWRT_BUILD),1)
|
ifneq ($(OPENWRT_BUILD),1)
|
||||||
override OPENWRT_BUILD=1
|
override OPENWRT_BUILD=1
|
||||||
export OPENWRT_BUILD
|
export OPENWRT_BUILD
|
||||||
|
include $(TOPDIR)/include/debug.mk
|
||||||
include $(TOPDIR)/include/toplevel.mk
|
include $(TOPDIR)/include/toplevel.mk
|
||||||
else
|
else
|
||||||
include rules.mk
|
include rules.mk
|
||||||
|
@ -10,12 +10,15 @@
|
|||||||
# d: show subdirectory tree
|
# d: show subdirectory tree
|
||||||
# t: show added targets
|
# t: show added targets
|
||||||
# l: show legacy targets
|
# l: show legacy targets
|
||||||
|
# r: show autorebuild messages
|
||||||
# v: verbose (no .SILENCE for common targets)
|
# v: verbose (no .SILENCE for common targets)
|
||||||
|
|
||||||
ifeq ($(DEBUG),all)
|
ifeq ($(DUMP),)
|
||||||
build_debug:=dltv
|
ifeq ($(DEBUG),all)
|
||||||
else
|
build_debug:=dltvr
|
||||||
|
else
|
||||||
build_debug:=$(DEBUG)
|
build_debug:=$(DEBUG)
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
define debug
|
define debug
|
||||||
@ -26,6 +29,10 @@ define warn
|
|||||||
$$(if $(call debug,$(1),$(2)),$$(warning $(3)))
|
$$(if $(call debug,$(1),$(2)),$$(warning $(3)))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define debug_eval
|
||||||
|
$$(if $(call debug,$(1),$(2)),$(3))
|
||||||
|
endef
|
||||||
|
|
||||||
define warn_eval
|
define warn_eval
|
||||||
$(call warn,$(1),$(2),$(3) $(4))
|
$(call warn,$(1),$(2),$(3) $(4))
|
||||||
$(4)
|
$(4)
|
||||||
|
@ -6,26 +6,42 @@
|
|||||||
#
|
#
|
||||||
# define a dependency on a subtree
|
# define a dependency on a subtree
|
||||||
# parameters:
|
# parameters:
|
||||||
# 1: directory
|
# 1: directories/files
|
||||||
# 2: directory dependency
|
# 2: directory dependency
|
||||||
# 3: tempfile for file listings
|
# 3: tempfile for file listings
|
||||||
# 4: find options
|
# 4: find options
|
||||||
|
|
||||||
DEP_FINDPARAMS := -type f -not -name ".*" -and -not -path "*.svn*" -type f -not -name ".*" -and -not -path "*.svn*" -and -not -path "*:*" -and -not -path "*!*" -and -not -path "* *" -and -not -path "*\\\#*"
|
DEP_FINDPARAMS := -x "*.svn*" -x ".*" -x "*.svn*" -x "*:*" -x "*\!*" -x "* *" -x "*\\\#*" -x "*/.*_check"
|
||||||
|
|
||||||
|
find_md5=find $(1) -type f $(patsubst -x,-and -not -path,$(DEP_FINDPARAMS) $(2)) | md5s
|
||||||
|
|
||||||
define rdep
|
define rdep
|
||||||
$(foreach file,$(shell find $(1) $(DEP_FINDPARAMS) $(4)),
|
.PRECIOUS: $(2)
|
||||||
$(2): $(file)
|
.SILENT: $(2)_check
|
||||||
$(file): ;
|
|
||||||
)
|
|
||||||
|
|
||||||
ifneq ($(3),)
|
$(2): $(2)_check
|
||||||
ifneq ($$(shell find $(1) $(DEP_FINDPARAMS) $(4) 2>/dev/null | md5s),$(if $(3),$(shell cat $(3) || touch $(3) 2>/dev/null)))
|
$(2)_check::
|
||||||
$(2): $(3)
|
if [ -f "$(2)" ]; then \
|
||||||
endif
|
$(if $(3), \
|
||||||
|
$(call find_md5,$(1),$(4)) > $(3).1; \
|
||||||
|
{ [ \! -f "$(3)" ] || diff $(3) $(3).1 >/dev/null; } && \
|
||||||
|
) \
|
||||||
|
{ \
|
||||||
|
[ -f "$(2)_check.1" ] && mv "$(2)_check.1"; \
|
||||||
|
$(SCRIPT_DIR)/timestamp.pl $(DEP_FINDPARAMS) $(4) -n $(2) $(1) && { \
|
||||||
|
$(call debug_eval,$(SUBDIR),r,echo "No need to rebuild $(2)";) \
|
||||||
|
touch -r "$(2)" "$(2)_check"; \
|
||||||
|
} \
|
||||||
|
} || { \
|
||||||
|
$(call debug_eval,$(SUBDIR),r,echo "Need to rebuild $(2)";) \
|
||||||
|
touch "$(2)_check"; \
|
||||||
|
}; \
|
||||||
|
$(if $(3), mv $(3).1 $(3);) \
|
||||||
|
else \
|
||||||
|
$(if $(3), rm -f $(3) $(3).1;) \
|
||||||
|
$(call debug_eval,$(SUBDIR),r,echo "Target $(2) not built";) \
|
||||||
|
true; \
|
||||||
|
fi
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
$(3): FORCE
|
|
||||||
@-find $(1) $(DEP_FINDPARAMS) $(4) 2>/dev/null | md5s > $$@
|
|
||||||
.PRECIOUS: $(3)
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/host.mk
|
|||||||
include $(INCLUDE_DIR)/unpack.mk
|
include $(INCLUDE_DIR)/unpack.mk
|
||||||
include $(INCLUDE_DIR)/depends.mk
|
include $(INCLUDE_DIR)/depends.mk
|
||||||
|
|
||||||
STAMP_PREPARED:=$(PKG_BUILD_DIR)/.prepared_$(shell find ${CURDIR} $(PKG_FILE_DEPEND) $(DEP_FINDPARAMS) | md5s)
|
STAMP_PREPARED:=$(PKG_BUILD_DIR)/.prepared_$(shell $(call find_md5,${CURDIR} $(PKG_FILE_DEPEND),))
|
||||||
STAMP_CONFIGURED:=$(PKG_BUILD_DIR)/.configured
|
STAMP_CONFIGURED:=$(PKG_BUILD_DIR)/.configured
|
||||||
STAMP_BUILT:=$(PKG_BUILD_DIR)/.built
|
STAMP_BUILT:=$(PKG_BUILD_DIR)/.built
|
||||||
STAMP_INSTALLED:=$(STAGING_DIR_HOST)/stamp/.$(PKG_NAME)_installed
|
STAMP_INSTALLED:=$(STAGING_DIR_HOST)/stamp/.$(PKG_NAME)_installed
|
||||||
@ -82,9 +82,8 @@ endif
|
|||||||
|
|
||||||
ifneq ($(if $(QUILT),,$(CONFIG_AUTOREBUILD)),)
|
ifneq ($(if $(QUILT),,$(CONFIG_AUTOREBUILD)),)
|
||||||
define HostBuild/Autoclean
|
define HostBuild/Autoclean
|
||||||
$(PKG_BUILD_DIR)/.dep_files: $(STAMP_PREPARED)
|
|
||||||
$(call rdep,${CURDIR} $(PKG_FILE_DEPEND),$(STAMP_PREPARED))
|
$(call rdep,${CURDIR} $(PKG_FILE_DEPEND),$(STAMP_PREPARED))
|
||||||
$(if $(if $(Build/Compile),$(filter prepare,$(MAKECMDGOALS)),1),,$(call rdep,$(PKG_BUILD_DIR),$(STAMP_BUILT),$(PKG_BUILD_DIR)/.dep_files, -and -not -path "/.*" -and -not -path "*/ipkg*"))
|
$(if $(if $(Build/Compile),$(filter prepare,$(MAKECMDGOALS)),1),,$(call rdep,$(PKG_BUILD_DIR),$(STAMP_BUILT)))
|
||||||
endef
|
endef
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ include $(INCLUDE_DIR)/host.mk
|
|||||||
include $(INCLUDE_DIR)/unpack.mk
|
include $(INCLUDE_DIR)/unpack.mk
|
||||||
include $(INCLUDE_DIR)/depends.mk
|
include $(INCLUDE_DIR)/depends.mk
|
||||||
|
|
||||||
STAMP_PREPARED:=$(PKG_BUILD_DIR)/.prepared$(if $(DUMP),,_$(shell find ${CURDIR} $(PKG_FILE_DEPEND) $(DEP_FINDPARAMS) | md5s))
|
STAMP_PREPARED:=$(PKG_BUILD_DIR)/.prepared$(if $(DUMP),,_$(shell $(call find_md5,${CURDIR} $(PKG_FILE_DEPEND),)))
|
||||||
STAMP_CONFIGURED:=$(PKG_BUILD_DIR)/.configured
|
STAMP_CONFIGURED:=$(PKG_BUILD_DIR)/.configured
|
||||||
STAMP_BUILT:=$(PKG_BUILD_DIR)/.built
|
STAMP_BUILT:=$(PKG_BUILD_DIR)/.built
|
||||||
|
|
||||||
@ -32,8 +32,8 @@ ifeq ($(DUMP)$(filter prereq clean refresh update,$(MAKECMDGOALS)),)
|
|||||||
ifneq ($(if $(QUILT),,$(CONFIG_AUTOREBUILD)),)
|
ifneq ($(if $(QUILT),,$(CONFIG_AUTOREBUILD)),)
|
||||||
define Build/Autoclean
|
define Build/Autoclean
|
||||||
$(PKG_BUILD_DIR)/.dep_files: $(STAMP_PREPARED)
|
$(PKG_BUILD_DIR)/.dep_files: $(STAMP_PREPARED)
|
||||||
$(call rdep,${CURDIR} $(PKG_FILE_DEPEND),$(STAMP_PREPARED))
|
$(call rdep,${CURDIR} $(PKG_FILE_DEPEND),$(STAMP_PREPARED),$(PKG_BUILD_DIR)/.dep_files,-x "/.dep_*")
|
||||||
$(if $(filter prepare,$(MAKECMDGOALS)),,$(call rdep,$(PKG_BUILD_DIR),$(STAMP_BUILT),$(PKG_BUILD_DIR)/.dep_files, -and -not -path "/.*" -and -not -path "*/ipkg*"))
|
$(if $(filter prepare,$(MAKECMDGOALS)),,$(call rdep,$(PKG_BUILD_DIR),$(STAMP_BUILT),,-x "/.dep_*" -x "*/ipkg*"))
|
||||||
endef
|
endef
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@ -64,14 +64,11 @@ define Build/DefaultTargets
|
|||||||
|
|
||||||
$(STAMP_BUILT): $(STAMP_CONFIGURED)
|
$(STAMP_BUILT): $(STAMP_CONFIGURED)
|
||||||
$(Build/Compile)
|
$(Build/Compile)
|
||||||
|
$(Build/InstallDev)
|
||||||
touch $$@
|
touch $$@
|
||||||
|
|
||||||
ifdef Build/InstallDev
|
ifdef Build/InstallDev
|
||||||
compile: $(STAGING_DIR)/stamp/.$(PKG_NAME)-installed
|
compile: $(STAMP_BUILT)
|
||||||
$(STAGING_DIR)/stamp/.$(PKG_NAME)-installed: $(STAMP_BUILT)
|
|
||||||
mkdir -p $(STAGING_DIR)/stamp
|
|
||||||
$(Build/InstallDev)
|
|
||||||
touch $$@
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
define Build/DefaultTargets
|
define Build/DefaultTargets
|
||||||
|
2
rules.mk
2
rules.mk
@ -8,6 +8,7 @@
|
|||||||
ifeq ($(DUMP),)
|
ifeq ($(DUMP),)
|
||||||
-include $(TOPDIR)/.config
|
-include $(TOPDIR)/.config
|
||||||
endif
|
endif
|
||||||
|
include $(TOPDIR)/include/debug.mk
|
||||||
include $(TOPDIR)/include/verbose.mk
|
include $(TOPDIR)/include/verbose.mk
|
||||||
|
|
||||||
TMP_DIR:=$(TOPDIR)/tmp
|
TMP_DIR:=$(TOPDIR)/tmp
|
||||||
@ -25,6 +26,7 @@ ARCH:=$(call qstrip,$(CONFIG_ARCH))
|
|||||||
TARGET_OPTIMIZATION:=$(call qstrip,$(CONFIG_TARGET_OPTIMIZATION))
|
TARGET_OPTIMIZATION:=$(call qstrip,$(CONFIG_TARGET_OPTIMIZATION))
|
||||||
BUILD_SUFFIX:=$(call qstrip,$(CONFIG_BUILD_SUFFIX))
|
BUILD_SUFFIX:=$(call qstrip,$(CONFIG_BUILD_SUFFIX))
|
||||||
GCCV:=$(call qstrip,$(CONFIG_GCC_VERSION))
|
GCCV:=$(call qstrip,$(CONFIG_GCC_VERSION))
|
||||||
|
SUBDIR:=$(patsubst $(TOPDIR)/%,%,${CURDIR})
|
||||||
|
|
||||||
OPTIMIZE_FOR_CPU:=$(ARCH)
|
OPTIMIZE_FOR_CPU:=$(ARCH)
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ sub get_ts($$) {
|
|||||||
my $options = shift;
|
my $options = shift;
|
||||||
my $ts = 0;
|
my $ts = 0;
|
||||||
my $fn = "";
|
my $fn = "";
|
||||||
open FIND, "find $path -not -path \\*.svn\\* -and -not -path \\*CVS\\* $options 2>/dev/null |";
|
open FIND, "find $path -type f -and -not -path \\*.svn\\* -and -not -path \\*CVS\\* $options 2>/dev/null |";
|
||||||
while (<FIND>) {
|
while (<FIND>) {
|
||||||
chomp;
|
chomp;
|
||||||
my $file = $_;
|
my $file = $_;
|
||||||
@ -36,7 +36,7 @@ while (@ARGV > 0) {
|
|||||||
my $path = shift @ARGV;
|
my $path = shift @ARGV;
|
||||||
if ($path =~ /^-x/) {
|
if ($path =~ /^-x/) {
|
||||||
my $str = shift @ARGV;
|
my $str = shift @ARGV;
|
||||||
$options{"findopts"} .= " -and -not -path \\*".$str."\\*"
|
$options{"findopts"} .= " -and -not -path '".$str."'"
|
||||||
} elsif ($path =~ /^-f/) {
|
} elsif ($path =~ /^-f/) {
|
||||||
$options{"findopts"} .= " -follow";
|
$options{"findopts"} .= " -follow";
|
||||||
} elsif ($path =~ /^-n/) {
|
} elsif ($path =~ /^-n/) {
|
||||||
|
Loading…
Reference in New Issue
Block a user