tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: devel/imake and clang



EF> On my machine (OS X 10.6.8 with clang 1.7) configuring devel/imake fails,
EF> because this Makefile fragment:
EF> 	CPPFLAGS+=		-DRAWCPP=\"${PREFIX}/bin/tradcpp\"
EF> leads to an implicit
EF> 	#define RAWCPP \"/usr/pkg/bin/tradcpp\"
EF> with clang.
EF> It helps to change that Makefile line to:
EF> 	CPPFLAGS+=		-DRAWCPP='"${PREFIX}/bin/tradcpp"'
EF> but I'm not sure whether that's the right thing to do for all compilers and 
EF> all Versions of auto*.

JS> That makes no sense, they should result in exactly the same variable
JS> content.
You can simply ktrace (-i -t +a) "make configure" on NetBSD to show that's 
not true. It makes a difference, but not the one I expected.

The unmodified version causes make to invoke the shell with a -c argument 
containing (if I strip off the backslashes added by kdump)
	CPPFLAGS=-DRAWCPP=\\\"/usr/pkg/bin/tradcpp\\\"
and gcc being passed an argument of
	-DRAWCPP=\"/usr/pkg/bin/tradcpp\"
while the modified version causes make to to pass
	CPPFLAGS=-DRAWCPP=\'\"/usr/pkg/bin/tradcpp\"\'
to the shell and gcc seing
	CPPFLAGS=-DRAWCPP='"/usr/pkg/bin/tradcpp"'
if I've unstripped the backslashes correctly.

So in both cases, the compiler sees exactly what CPPFLAGS got set to in the 
Makefile.
So the right thing to do in fact is simply
 	CPPFLAGS+=		-DRAWCPP="${PREFIX}/bin/tradcpp"
which causes make to pass
	CPPFLAGS=-DRAWCPP=\"/usr/pkg/bin/tradcpp\"
to sh and gcc getting
	-DRAWCPP="/usr/pkg/bin/tradcpp"
as needed.


Home | Main Index | Thread Index | Old Index