Changeset 743
- Timestamp:
- Dec 17, 2006, 9:12:30 AM (19 years ago)
- Location:
- trunk/kBuild
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kBuild/footer.kmk
r741 r743 143 143 $(TOOL) \ 144 144 )) 145 146 ## Removes the drive letter from a path (if it has one)147 # @param $1 the path148 no-drive=$(word $(words $(subst :, ,$(1))),$(subst :, ,$(1)))149 150 ## Removes the root slash from a path (if it has one)151 # @param $1 the path152 no-root-slash=$(patsubst /%,%,$(1))153 154 ifneq ($(filter abspathex,$(KMK_FEATURES)),abspathex) ## @todo Retire this to gnumake-header.kmk when it has been implemented.155 ## Converts an relative path to an absolute path using the given CWD.156 # @returns absolute path.157 # @param $1 The path to fixup.158 # @param $2 The CWD to use.159 abspathex = $(foreach _fix_path,$1\160 ,$(if $(subst :$(call no-root-slash,$(call no-drive,$(_fix_path))):,,:$(_fix_path):),$(_fix_path),$(abspath $2/$(_fix_path))))161 endif162 163 ## Figure out where to put object files.164 # @param $1 real target name.165 # @param $2 normalized main target166 _TARGET_BASE = $(PATH_TARGET)/$(2)/$(call no-root-slash,$(call no-drive,$(basename $(1))))167 168 145 169 146 ## Figure out the actual name of an installed file. … … 887 864 $(out): $(comp-vars _TARGET_$(target)_DIGEST_PREV,_TARGET_$(target)_DIGEST,FORCE) | $(call DIRDEP,$(inst)) 888 865 $$(QUIET)$$(RM) -f $$@ 889 $$(call MSG_L1,$$(if $$( wildcard $(out).lst),$$(if $$(_TARGET_$(target)_DIGEST),Re-fetching,Removing),Fetching) $(target)...)866 $$(call MSG_L1,$$(if $$(_TARGET_$(target)_DIGEST),$$(if $$(wildcard $(out).lst),Re-fetching,Fetching),Removing) $(target)...) 890 867 $$(QUIET)$$(if $$(wildcard $(out).lst ),$$(MAKE) -f $(MAKEFILE) --no-print-directory $(out)_unfetched) 891 868 $$(QUIET)$$(if $$(_TARGET_$(target)_DIGEST),$$(MAKE) -f $(MAKEFILE) --no-print-directory $(out).lst,$$(RMDIR) -p --ignore-fail-on-non-empty --ignore-fail-on-not-exist $$(dir $$@)) … … 1172 1149 $(error kBuild: Library target $(target) does not have a tool defined!) 1173 1150 endif 1174 outbase := $(call _TARGET_BASE,$(target),$(target)) 1175 PATH_$(target) := $(patsubst %/,%,$(dir $(outbase))) 1151 outbase := $(call TARGET_BASE,$(target),$(target)) 1152 ifndef PATH_$(target) 1153 PATH_$(target) := $(patsubst %/,%,$(dir $(outbase))) 1154 else 1155 ifneq ($(PATH_$(target)),$(patsubst %/,%,$(dir $(outbase)))) 1156 $(error kBuild internal error: PATH_$(target)=$(PATH_$(target)) expected $(patsubst %/,%,$(dir $(outbase)))) 1157 endif 1158 endif 1176 1159 suff := $(firstword\ 1177 1160 $($(target)_LIBSUFF.$(bld_trg).$(bld_trg_arch))\ … … 1192 1175 # library linking 1193 1176 tool := $(call _TARGET_TOOL,$(target),AR) 1194 outbase := $(call _TARGET_BASE,$(target),$(target))1177 outbase := $(call TARGET_BASE,$(target),$(target)) 1195 1178 flags :=\ 1196 1179 $(TOOL_$(tool)_ARFLAGS)\ … … 1294 1277 1295 1278 tool := $(call _TARGET_TOOL,$(target),LD) 1296 outbase := $(call _TARGET_BASE,$(target),$(target)) 1279 outbase := $(call TARGET_BASE,$(target),$(target)) 1280 ifndef PATH_$(target) 1281 PATH_$(target) := $(patsubst %/,%,$(dir $(outbase))) 1282 else 1283 ifneq ($(PATH_$(target)),$(patsubst %/,%,$(dir $(outbase)))) 1284 $(error kBuild internal error: PATH_$(target)=$(PATH_$(target)) expected $(patsubst %/,%,$(dir $(outbase)))) 1285 endif 1286 endif 1297 1287 suff := $(firstword \ 1298 1288 $($(target)_$(EXT)SUFF) \ … … 1301 1291 $($(EXTPRE)SUFF_$(EXT))) 1302 1292 out := $(outbase)$(suff) 1303 PATH_$(target) := $(patsubst %/,%,$(dir $(outbase)))1304 1293 TARGET_$(target) := $(out) 1305 1294 $(target)_OBJS_ := … … 1311 1300 # more library stuff. 1312 1301 tool := $(call _TARGET_TOOL,$(target),LD) 1313 outbase := $(call _TARGET_BASE,$(target),$(target))1302 outbase := $(call TARGET_BASE,$(target),$(target)) 1314 1303 flags :=\ 1315 1304 $(TOOL_$(tool)_LDFLAGS)\ -
trunk/kBuild/gnumake-header.kmk
r723 r743 33 33 $(warning kBuild: Using vanilla GNU make isn't safe for anything but kBuild bootstrapping!) 34 34 35 ## 36 # Pushes an item onto a 'stack' variable. 37 # @param $1 The stack variable name 38 # @param $2 What to push. 39 stack-push = $(eval $1 +=$2) 40 41 ## 42 # Removes the top element from a 'stack' variable. 43 # @returns The popped element 44 # @param $1 The stack variable name 45 stack-pop = $(call stack-top,$1)$(call stack-popv,$1) 46 47 ## 48 # Removes the top element from a 'stack' variable. 49 # This does *NOT* return the top element, use 50 # @param $1 The stack variable name 51 # @remark This ain't very fast (that's why it's implemented in functions.c in kmk). 52 stack-popv = $(eval $1:=$(wordlist 1,$(words $(wordlist 2,9999,$($1))),$($1))) 53 54 ## 55 # Retrieves the top element from the 'stack' variable. 56 # @param $1 The stack variable name 57 stack-top = $(lastword $($1)) 58 35 59 36 60 # 37 # Default variables.61 # Fix some default variables. 38 62 # 39 63 ifeq ($(MAKEFLAGS),$(MAKEFLAGS:R=x)) … … 54 78 55 79 # 56 # Suffixes.80 # Zap suffixes. 57 81 # 58 82 .SUFFIXES: … … 60 84 61 85 # 62 # Implicit rules86 # Zap implicit rules 63 87 # 64 88 ifeq ($(MAKEFLAGS),$(MAKEFLAGS:r=x)) -
trunk/kBuild/header.kmk
r742 r743 441 441 LN_SYMLINK := $(LN) -s 442 442 443 444 # 445 # Some Functions. 446 # The lower cased ones are either fallbacks or candidates for functions.c. 447 # 448 443 449 ## ABSPATH - make paths absolute. 444 450 # This implementation is clumsy and doesn't resolve '..' and '.' components. … … 453 459 DIRDEP = $(foreach path,$(patsubst %/,%,$(1)),$(path)/) 454 460 455 456 461 ## Cygwin kludge. 457 462 # This converts /cygdrive/x/% to x:%. … … 460 465 # @remark This macro is pretty much obsolete since we don't use cygwin base make. 461 466 ifneq ($(patsubst /cygdrive/%,%,$(CURDIR)),$(CURDIR)) 462 CYGPATHMIXED = $(foreach path,$(1)\467 CYGPATHMIXED = $(foreach path,$(1)\ 463 468 ,$(if $(patsubst /cygdrive/%,,$(path)),$(path),$(patsubst $(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path)))))/%,$(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path))))):/%,$(patsubst /cygdrive/%,%,$(path))))) 464 469 else 465 CYGPATHMIXED = $(1) 466 endif 467 468 469 ifneq ($(filter stack,$(KMK_FEATURES)),stack) ## @todo retire this to gnumake-header.kmk when all the programs have been recompiled. 470 ## 471 # Pushes an item onto a 'stack' variable. 472 # @param $1 The stack variable name 473 # @param $2 What to push. 474 stack-push = $(eval $1 +=$2) 475 476 ## 477 # Removes the top element from a 'stack' variable. 478 # @returns The popped element 479 # @param $1 The stack variable name 480 stack-pop = $(call stack-top,$1)$(call stack-popv,$1) 481 482 ## 483 # Removes the top element from a 'stack' variable. 484 # This does *NOT* return the top element, use 485 # @param $1 The stack variable name 486 # @remark This ain't very fast (that's why it's implemented in functions.c in kmk). 487 stack-popv = $(eval $1:=$(wordlist 1,$(words $(wordlist 2,9999,$($1))),$($1))) 488 489 ## 490 # Retrieves the top element from the 'stack' variable. 491 # @param $1 The stack variable name 492 stack-top = $(lastword $($1)) 493 endif 470 CYGPATHMIXED = $(1) 471 endif 472 473 ifneq ($(filter abspathex,$(KMK_FEATURES)),abspathex) ## @todo Retire this to gnumake-header.kmk when it has been implemented. 474 ## Converts an relative path to an absolute path using the given CWD. 475 # @returns absolute path. 476 # @param $1 The path to fixup. 477 # @param $2 The CWD to use. 478 abspathex = $(foreach _fix_path,$1\ 479 ,$(if $(subst :$(call no-root-slash,$(call no-drive,$(_fix_path))):,,:$(_fix_path):),$(_fix_path),$(abspath $2/$(_fix_path)))) 480 endif 481 482 ## Removes the drive letter from a path (if it has one) 483 # @param $1 the path 484 no-drive = $(word $(words $(subst :, ,$(1))),$(subst :, ,$(1))) 485 486 ## Removes the root slash from a path (if it has one) 487 # @param $1 the path 488 no-root-slash = $(patsubst /%,%,$(1)) 489 490 ## Figure out where to put object files. 491 # @param $1 real target name. 492 # @param $2 normalized main target 493 TARGET_BASE = $(PATH_TARGET)/$(2)/$(call no-root-slash,$(call no-drive,$(basename $(1)))) 494 495 ## Figure out where to put object files. 496 # @param $1 normalized main target 497 TARGET_PATH = $(PATH_TARGET)/$(1) 494 498 495 499 -
trunk/kBuild/subfooter.kmk
r742 r743 29 29 # 30 30 ifdef __footer_kmk__ 31 $(error kBuild: footer.kmk has already been included. Fix your sub-makefiles!)31 $(error kBuild: footer.kmk has already been included. Fix your sub-makefiles!) 32 32 endif 33 33 … … 36 36 # 37 37 define def_subheader 38 ifndef $(target)_PATH 39 $(target)_PATH := $(PATH_SUB_CURRENT) 40 endif 41 ifndef $(target)_MAKEFILE 42 $(target)_MAKEFILE := $(MAKEFILE_CURRENT) 43 endif 38 ifndef $(target)_PATH 39 $(target)_PATH := $(PATH_SUB_CURRENT) 40 endif 41 ifndef $(target)_MAKEFILE 42 $(target)_MAKEFILE := $(MAKEFILE_CURRENT) 43 endif 44 ifndef PATH_$(target) 45 PATH_$(target) := $(call TARGET_PATH,$(target)) 46 endif 44 47 endef 45 48 -
trunk/kBuild/subheader.kmk
r742 r743 46 46 # 47 47 define def_subfooter 48 ifndef $(target)_PATH 49 $(target)_PATH := $(PATH_SUB_CURRENT) 50 endif 51 ifndef $(target)_MAKEFILE 52 $(target)_MAKEFILE := $(MAKEFILE_CURRENT) 53 endif 48 ifndef $(target)_PATH 49 $(target)_PATH := $(PATH_SUB_CURRENT) 50 endif 51 ifndef $(target)_MAKEFILE 52 $(target)_MAKEFILE := $(MAKEFILE_CURRENT) 53 endif 54 ifndef PATH_$(target) 55 PATH_$(target) := $(call TARGET_PATH,$(target)) 56 endif 54 57 endef 55 58
Note:
See TracChangeset
for help on using the changeset viewer.