mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-12-24 05:03:20 +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:
|
||||
|
||||
include $(TOPDIR)/include/debug.mk
|
||||
include $(TOPDIR)/include/host.mk
|
||||
|
||||
ifneq ($(OPENWRT_BUILD),1)
|
||||
override OPENWRT_BUILD=1
|
||||
export OPENWRT_BUILD
|
||||
include $(TOPDIR)/include/debug.mk
|
||||
include $(TOPDIR)/include/toplevel.mk
|
||||
else
|
||||
include rules.mk
|
||||
|
@ -10,12 +10,15 @@
|
||||
# d: show subdirectory tree
|
||||
# t: show added targets
|
||||
# l: show legacy targets
|
||||
# r: show autorebuild messages
|
||||
# v: verbose (no .SILENCE for common targets)
|
||||
|
||||
ifeq ($(DEBUG),all)
|
||||
build_debug:=dltv
|
||||
else
|
||||
build_debug:=$(DEBUG)
|
||||
ifeq ($(DUMP),)
|
||||
ifeq ($(DEBUG),all)
|
||||
build_debug:=dltvr
|
||||
else
|
||||
build_debug:=$(DEBUG)
|
||||
endif
|
||||
endif
|
||||
|
||||
define debug
|
||||
@ -26,6 +29,10 @@ define warn
|
||||
$$(if $(call debug,$(1),$(2)),$$(warning $(3)))
|
||||
endef
|
||||
|
||||
define debug_eval
|
||||
$$(if $(call debug,$(1),$(2)),$(3))
|
||||
endef
|
||||
|
||||
define warn_eval
|
||||
$(call warn,$(1),$(2),$(3) $(4))
|
||||
$(4)
|
||||
|
@ -6,26 +6,42 @@
|
||||
#
|
||||
# define a dependency on a subtree
|
||||
# parameters:
|
||||
# 1: directory
|
||||
# 1: directories/files
|
||||
# 2: directory dependency
|
||||
# 3: tempfile for file listings
|
||||
# 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
|
||||
$(foreach file,$(shell find $(1) $(DEP_FINDPARAMS) $(4)),
|
||||
$(2): $(file)
|
||||
$(file): ;
|
||||
)
|
||||
.PRECIOUS: $(2)
|
||||
.SILENT: $(2)_check
|
||||
|
||||
ifneq ($(3),)
|
||||
ifneq ($$(shell find $(1) $(DEP_FINDPARAMS) $(4) 2>/dev/null | md5s),$(if $(3),$(shell cat $(3) || touch $(3) 2>/dev/null)))
|
||||
$(2): $(3)
|
||||
endif
|
||||
|
||||
endif
|
||||
$(2): $(2)_check
|
||||
$(2)_check::
|
||||
if [ -f "$(2)" ]; then \
|
||||
$(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
|
||||
|
||||
$(3): FORCE
|
||||
@-find $(1) $(DEP_FINDPARAMS) $(4) 2>/dev/null | md5s > $$@
|
||||
.PRECIOUS: $(3)
|
||||
endef
|
||||
|
||||
|
@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/host.mk
|
||||
include $(INCLUDE_DIR)/unpack.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_BUILT:=$(PKG_BUILD_DIR)/.built
|
||||
STAMP_INSTALLED:=$(STAGING_DIR_HOST)/stamp/.$(PKG_NAME)_installed
|
||||
@ -82,9 +82,8 @@ endif
|
||||
|
||||
ifneq ($(if $(QUILT),,$(CONFIG_AUTOREBUILD)),)
|
||||
define HostBuild/Autoclean
|
||||
$(PKG_BUILD_DIR)/.dep_files: $(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
|
||||
endif
|
||||
|
||||
|
@ -16,7 +16,7 @@ include $(INCLUDE_DIR)/host.mk
|
||||
include $(INCLUDE_DIR)/unpack.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_BUILT:=$(PKG_BUILD_DIR)/.built
|
||||
|
||||
@ -32,8 +32,8 @@ ifeq ($(DUMP)$(filter prereq clean refresh update,$(MAKECMDGOALS)),)
|
||||
ifneq ($(if $(QUILT),,$(CONFIG_AUTOREBUILD)),)
|
||||
define Build/Autoclean
|
||||
$(PKG_BUILD_DIR)/.dep_files: $(STAMP_PREPARED)
|
||||
$(call rdep,${CURDIR} $(PKG_FILE_DEPEND),$(STAMP_PREPARED))
|
||||
$(if $(filter prepare,$(MAKECMDGOALS)),,$(call rdep,$(PKG_BUILD_DIR),$(STAMP_BUILT),$(PKG_BUILD_DIR)/.dep_files, -and -not -path "/.*" -and -not -path "*/ipkg*"))
|
||||
$(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),,-x "/.dep_*" -x "*/ipkg*"))
|
||||
endef
|
||||
endif
|
||||
endif
|
||||
@ -64,14 +64,11 @@ define Build/DefaultTargets
|
||||
|
||||
$(STAMP_BUILT): $(STAMP_CONFIGURED)
|
||||
$(Build/Compile)
|
||||
$(Build/InstallDev)
|
||||
touch $$@
|
||||
|
||||
ifdef Build/InstallDev
|
||||
compile: $(STAGING_DIR)/stamp/.$(PKG_NAME)-installed
|
||||
$(STAGING_DIR)/stamp/.$(PKG_NAME)-installed: $(STAMP_BUILT)
|
||||
mkdir -p $(STAGING_DIR)/stamp
|
||||
$(Build/InstallDev)
|
||||
touch $$@
|
||||
compile: $(STAMP_BUILT)
|
||||
endif
|
||||
|
||||
define Build/DefaultTargets
|
||||
|
2
rules.mk
2
rules.mk
@ -8,6 +8,7 @@
|
||||
ifeq ($(DUMP),)
|
||||
-include $(TOPDIR)/.config
|
||||
endif
|
||||
include $(TOPDIR)/include/debug.mk
|
||||
include $(TOPDIR)/include/verbose.mk
|
||||
|
||||
TMP_DIR:=$(TOPDIR)/tmp
|
||||
@ -25,6 +26,7 @@ ARCH:=$(call qstrip,$(CONFIG_ARCH))
|
||||
TARGET_OPTIMIZATION:=$(call qstrip,$(CONFIG_TARGET_OPTIMIZATION))
|
||||
BUILD_SUFFIX:=$(call qstrip,$(CONFIG_BUILD_SUFFIX))
|
||||
GCCV:=$(call qstrip,$(CONFIG_GCC_VERSION))
|
||||
SUBDIR:=$(patsubst $(TOPDIR)/%,%,${CURDIR})
|
||||
|
||||
OPTIMIZE_FOR_CPU:=$(ARCH)
|
||||
|
||||
|
@ -13,7 +13,7 @@ sub get_ts($$) {
|
||||
my $options = shift;
|
||||
my $ts = 0;
|
||||
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>) {
|
||||
chomp;
|
||||
my $file = $_;
|
||||
@ -36,7 +36,7 @@ while (@ARGV > 0) {
|
||||
my $path = shift @ARGV;
|
||||
if ($path =~ /^-x/) {
|
||||
my $str = shift @ARGV;
|
||||
$options{"findopts"} .= " -and -not -path \\*".$str."\\*"
|
||||
$options{"findopts"} .= " -and -not -path '".$str."'"
|
||||
} elsif ($path =~ /^-f/) {
|
||||
$options{"findopts"} .= " -follow";
|
||||
} elsif ($path =~ /^-n/) {
|
||||
|
Loading…
Reference in New Issue
Block a user