[Gdal-dev] GDALmake.opt.in patch and explanation
Frank Warmerdam
warmerdam at pobox.com
Fri Mar 19 21:25:48 EST 2004
Derrick J Brashear wrote:
> I need the following patch on MacOS in order to insure that gdal gets its
> own headers and not headers from elsewhere on the system needed for
> dependancies; I need to build with external tiff/geotiff in order that
> linker reordering not give me problems with mismatched interfaces (Xastir
> uses libtiff and libgeotiff directly, as well as using GDAL for vector
> stuff, only, at the moment) and doing so causes conflicts this patch is
> needed to correct.
>
> --- GDALmake.opt.in.orig Fri Mar 19 18:47:48 2004
> +++ GDALmake.opt.in Fri Mar 19 18:50:20 2004
> @@ -79,8 +79,8 @@
> endif
>
> CPPFLAGS = @CPPFLAGS@ -I$(GDAL_ROOT)/port
> -CFLAGS = @C_WFLAGS@ @C_PIC@ $(C_ODFLAGS) @EXTRA_INCLUDES@ $(USER_DEFS)
> -CXXFLAGS = @CXX_WFLAGS@ @CXX_PIC@ $(CXX_ODFLAGS) \
> +CFLAGS = @C_WFLAGS@ @C_PIC@ $(GDAL_INCLUDE) $(C_ODFLAGS) @EXTRA_INCLUDES@ $(USER_DEFS)
> +CXXFLAGS = @CXX_WFLAGS@ @CXX_PIC@ $(GDAL_INCLUDE) $(CXX_ODFLAGS) \
> @EXTRA_INCLUDES@ $(USER_DEFS)
>
> RANLIB = @RANLIB@
Derrick,
Most of the makefiles modify CPPFLAGS to include GDAL_INCLUDE if they need it.
It seems to me your change will cause the GDAL_INCLUDE directives to appear
multiple times on the compile line and lead to further confusion. I would
prefer if you could submit this issue via bugzilla, along with the build
lines that appeared to be causing you problems.
In particular, I am wondering why we are adjusting CPPFLAGS to include
GDAL_INCLUDE in the various GNUmakefiles, when some of the include paths
are embedded directly in CFLAGS and CXXFLAGS. One of the generic compile rules
is as follows which you can see puts CPPFLAGS after CXXFLAGS.
../o/%.o: %.cpp
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
Perhaps I need to move *all* includes out of CXXFLAGS into CPPFLAGS, and then
just ensure that all appropriate GNUmakefiles apply adjustments as is already
done in some (most?). For instance, gda/frmts/png/GNUmakefile does this to
ensure that the GDAL includes are ahead of other include directives expected
to be in CPPFLAGS.
CPPFLAGS := $(XTRA_OPT) $(GDAL_INCLUDE) $(CPPFLAGS)
This is an area that Andrey has already done a bunch of work on a month or
two ago. It may be that just a few subtle improvements are still needed.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the Gdal-dev
mailing list