Fri 11 Mar 2005 02:41:32 PM UTC, comment #5:
I checked libjava's Makefile.am. It boils down to the following lines:
inner_nat_headers = java/io/ObjectOutputStream$$PutField.h \
java/io/ObjectInputStream$$GetField.h \
java/lang/reflect/Proxy$$ProxyData.h \
java/lang/reflect/Proxy$$ProxyType.h \
gnu/java/net/PlainSocketImpl$$SocketInputStream.h \
gnu/java/net/PlainSocketImpl$$SocketOutputStream.h
It is easy to fix just for 3.81 but the solution that works for both 3.80 and 3.81 is somewhat involved. Here is an example makefile that shows the technique:
make_version := $(shell $(MAKE) -v | sed -e 's/GNU Make \([0-9]\+\.[0-9]\+\).*/\1/;q')
make_version_major := $(shell echo $(make_version) | sed -e 's/\([0-9]\+\)\..*/\1/')
make_version_minor := $(shell echo $(make_version) | sed -e 's/.*\.\([0-9]\+\)/\1/')
has_second_expansion := $(shell test $(make_version_major) -gt 3 -o \
$(make_version_major) -eq 3 -a $(make_version_minor) -gt 80 && echo 1)
ifdef has_second_expansion
define escape-dollar-sign
$(subst $$,$$$$,$1)
endef
else
define escape-dollar-sign
$1
endef
endif
foo_target := foo$$bar
foo_prereq := $(call escape-dollar-sign,$(foo_target))
.PHONY: all $(foo_prereq)
all: $(foo_prereq)
@echo '$<'
$(foo_target):
@echo '$@'
Note the two variables, foo_target and foo_prereq, that are used respectively to for defining foo as a target (one expansion) and for using it as a prerequisite (two expansions).
In case of libjava, the
In libjava's case, the inner_nat_headers variable is used only to define prerequisites so its content can simply be run through escape-dollar-sign, e.g.,
inner_nat_headers := java/io/ObjectOutputStream$$PutField.h \
java/io/ObjectInputStream$$GetField.h \
java/lang/reflect/Proxy$$ProxyData.h \
java/lang/reflect/Proxy$$ProxyType.h \
gnu/java/net/PlainSocketImpl$$SocketInputStream.h \
gnu/java/net/PlainSocketImpl$$SocketOutputStream.h
inner_nat_headers := $(call escape-dollar-sign,$(inner_nat_headers))
Note the use of `:=' instead of `='.
|