forked from len0rd/rockbox
makefiles: Fix escaping issues under GNU make 4.2
Make 4.3 and newer doesn't interpret comments in a shell call, whereas Make 4.2 and older do. Escaping the comment directly works on old makes, but on new makes the backslash is passed as well -- which we want to avoid. The safe way to pass a literal "#" character to the shell on both versions is by embedding it in a variable and expanding that. It's ugly, but it works... Change-Id: I1a217c42d747fd5aa83f9990c234e06966ac1a00
This commit is contained in:
parent
ed7ab52e27
commit
2fb2364686
1 changed files with 8 additions and 2 deletions
|
@ -14,12 +14,18 @@
|
|||
#
|
||||
# The sed line is to prepend the directory to all source files
|
||||
|
||||
# This is needed because GNU Make older than 4.3 treats this as the start
|
||||
# of a comment even within a $(shell) call and requires a backslash escape.
|
||||
# Newer Makes pass the whole "\#" through, making the backslash visible in
|
||||
# the shell. To safely pass a literal "#", it has to go in a variable.
|
||||
_hash_ = \#
|
||||
|
||||
preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c -include config.h $(1) | \
|
||||
grep -v '^#' | grep -v "^ *$$" | \
|
||||
grep -v "^$(_hash_)" | grep -v "^ *$$" | \
|
||||
sed -e 's:^..*:$(dir $(1))&:')
|
||||
|
||||
preprocess2file = $(shell $(CC) $(PPCFLAGS) $(3) -E -P -x c -include config.h $(1) | \
|
||||
grep -v '^#' | grep -v "^$$" > $(2))
|
||||
grep -v '^$(_hash_)' | grep -v "^$$" > $(2))
|
||||
|
||||
asmdefs2file = $(SILENT)$(CC) $(PPCFLAGS) $(3) -S -x c -o - -include config.h $(1) | \
|
||||
perl -ne 'if(/^_?AD_(\w+):$$/){$$var=$$1}else{/^\W\.(?:word|long)\W(.*)$$/ && $$var && print "\#define $$var $$1\n";$$var=0}' > $(2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue