Manoj Joseph wrote: > Hi, > > I am trying to use Sun Studio (11) to compile an application instead of > gcc. It currently uses the compile option "-include" which does not work > with cc. > > Is there a known way of working around this issue - other than of course > including the header in each of the source files?
When I had to work around this in the X.Org builds, my solution was to modify the makefile to make temporary files that had the right includes, so for instance, where the makefile had: $(CC) -include foo.h -c ../some/other/dir/bar.c I made a local bar.c that was just: #include <foo.h> #include "../some/other/dir/bar.c" and then compiled that. The compiler team is considering -include support as an RFE for a future release, so if you have another use case that supports this, it might help encourage them. (For reference, the change I made to the Makefile.am in Xorg to do this is at: http://cgit.freedesktop.org/xorg/xserver/diff/hw/xfree86/xf1bpp/Makefile.am?id=0f0c321adf2850b3d7aafe281362bfe424cb0ca1 Though it was later refined to work better in parallel builds as you can see in: http://cgit.freedesktop.org/xorg/xserver/log/hw/xfree86/xf1bpp/Makefile.am ) -- -Alan Coopersmith- alan.coopersmith at sun.com Sun Microsystems, Inc. - X Window System Engineering