[GRASS-dev] Header file management

Glynn Clements glynn at gclements.plus.com
Wed Mar 28 18:37:51 EDT 2007


Soeren Gebbert wrote:

> i have a question regarding the header file management in grass.
> 
> I'm implementing a new library in grass (gpde) and therefor i have created 
> new global header files.
> AFAIK by default the global header files are located in grass6/include
> and copied while the build process to $(GISBASE)/include/grass.
> This has the side effect that the global header files are ignored by the 
> doxygen docu generation process of the grass libraries.
> 
> I would like to keep the global header files in the library directory, so they 
> can be included in the library doxygen documentation.
> 
> To assure the correct header file placement, the header files will be copied 
> from the library directory into the global header directories:
> 
> This entry in "grass6/lib/gpde/Makefile" will do the job:
> 
> #############################################
> MODULE_TOPDIR = ../..
> 
> EXTRA_LIBS=$(GISLIB) $(G3DLIB)
> LIB_NAME = $(GPDE_LIBNAME)
> 
> include $(MODULE_TOPDIR)/include/Make/Lib.make
> include $(MODULE_TOPDIR)/include/Make/Doxygen.make
> 
> default: headers lib
> 
> headers:
> 	for file in ./*.h ; do $(INSTALL_DATA) $$file ../../include/ ; done
> 	for file in ./*.h ; do $(INSTALL_DATA) $$file $(GISBASE)/include/grass/ ;done
> 
> #doxygen:
> DOXNAME=gpde
> 
> #############################################
> 
> If you think this approach is correct, i will move the gpde header files from 
> the include directory into the gpde library directory and modify the 
> Makefile.

Makefiles should try to avoid modifying the source tree (i.e. creating
files outside of the dist.<arch> and various OBJ.<arch> directories).

Either store the headers in the top-level include directory (from
where they will be copied to $GISBASE/include/grass by lib/Makefile),
or store them in the lib/gpde directory and have lib/gpde/Makefile
copy them to $GISBASE/include/grass (but not to the top-level include
directory).

Amongst the potential issues, copying files from lib/gpde to include
will complicate "make clean" (lib/gpde/Makefile would need a custom
"clean" target to remove those files from the include directory). More
generally, every additional directory-specific mechanism risks
complicating future changes to the build system.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list