URL: <http://savannah.gnu.org/bugs/?25190>
Summary: define expansion seems to lose the final newline Project: make Submitted by: nabramovitz Submitted on: Sun 28 Dec 2008 05:49:38 AM GMT Severity: 3 - Normal Item Group: Bug Status: None Privacy: Public Assigned to: None Open/Closed: Open Discussion Lock: Any Component Version: 3.81 Operating System: Any Fixed Release: None _______________________________________________________ Details: Environment Red Hat Enterprise Linux Server release 5.2 (Tikanga)This program built for i686-redhat-linux-gnu If I do not have the empty line at the end of the pkgify_rule, the next generated program target assignment (yyy) gets combined with the previous generated chmod line (xxx). The blank line should not be required. Execution results with the blank line. $ gmake -f x -n all echo xxx comes from xxx.sh chmod +x xxx echo yyy comes from yyy.sh chmod 644 yyy echo all done Execution results without the blank line. $ gmake -f x -n all echo xxx comes from xxx.sh chmod +x xxx yyy: PKGIFY_MODE?=+x echo yyy comes from yyy.sh chmod 644 yyy echo all done It is not a printing error since if I run without the -n flag I get the following errors. Since I made my sources phoney objects to simplify the test case, I expect two error messages from chmod not three. $ gmake -f x all echo xxx comes from xxx.sh xxx comes from xxx.sh chmod: cannot access `xxx': No such file or directory chmod: cannot access `yyy:': No such file or directory chmod: cannot access `PKGIFY_MODE?=+x': No such file or directory gmake: *** [xxx] Error 1 The test script follows. SH_PROGRAM=xxx yyy SHSRC=xxx.sh yyy.sh .PHONY: xxx.sh yyy.sh yyy: PKGIFY_MODE=644 PKGIFY=echo $@ comes from $< all: ${SH_PROGRAM} echo all done indices=$(shell (( i= 0 )); while (( i < $(words ${${1}}) )); do (( i += 1 )); l="$${l} $$i"; done; echo $${l}) define pkgify_rule $(1): PKGIFY_MODE?=+x ${1}: ${2} $${PKGIFY} @chmod $${PKGIFY_MODE} $$@ endef # if the blank line above the endef is removed the next target assignment becomes # part of the previous chmod line define pkgify_template $(foreach idx,$(call indices,${1}), $(call pkgify_rule,$(word ${idx},${$(1)}),$(word ${idx},${${2}}))) endef # this ifdef works 3.81 but not in 3.80. if function works 3.80 and 3.81 ifdef SH_PROGRAM $(eval $(call pkgify_template,SH_PROGRAM,SHSRC)) endif xyz: xyz.sh echo xyz _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/bugs/?25190> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ _______________________________________________ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make