[GRASS-dev] installed makefile cleanup

Glynn Clements glynn at gclements.plus.com
Sun Sep 23 05:48:23 EDT 2007


William Kyngesburye wrote:

> I started looking at the installed makefile fragments to get them in  
> working order to build addons.

Note that I've just committed a bunch of changed to fix the issues
which I mentioned in my previous email.

  I'm mainly interested in building for  
> external installation, so I'm doing a separate INST_XTN setup based  
> on the existing INST_NOW (which builds into the GRASS installation).
> 
> This is what I have so far (all tests, nothing in CVS yet):
> 
> - first, a problem with INST_NOW.  In Grass.make, the first: target has:
> 
> first: pre default
> 	@if test -n "$(INST_NOW)" ; then \
> 		$(MAKE) inst_now ; \
> 	fi
> 
> then there is an inst_now: target:
> 
> inst_now:
> 	INST_NOW= $(MAKE)
> 
> That got into a nasty infinite loop for me when used as suggested:
> 
> make GRASS_HOME=. MODULE_TOPDIR=/Applications/GRASS-6.3.app/Contents/MacOS INST_NOW=y

Right; AFAICT, it needs to be passed as an environment variable, i.e. 
"INST_NOW=y make".

If it is given as an argument, it will override any setting in the
Makefile, which will cause an infinite loop.

> So I ignored that for creating my INST_XTN variation.
> 
> 
> - installed a copy of demolocation in the installed GRASS.   
> edited .grassrc63 to set GISDBASE to the INST_DIR.
> 
> 
> - Grass.make - add below the "ifdef INST_NOW" block:
> 
> ifdef INST_XTN
> ARCH_DISTDIR    = $(INST_DIR)
> XTN_DISTDIR     = $(GRASS_HOME)/dist.$(ARCH)
> ARCH_INC        = -I$(ARCH_DISTDIR)/include -I$(XTN_DISTDIR)/include
> ARCH_LIBPATH	= -L$(ARCH_LIBDIR) -L$(XTN_DISTDIR)/lib
> BIN             = $(XTN_DISTDIR)/bin
> ETC             = $(XTN_DISTDIR)/etc
> DRIVERDIR       = $(XTN_DISTDIR)/driver
> DBDRIVERDIR     = $(XTN_DISTDIR)/driver/db
> endif

Regarding the last four, this is the wrong approach. It will break
everytime someone adds another variable for a subdirectory.

It appears that GISBASE needs to be split into source and destination
variables. The former would be used for -I/-L switches, the latter for
determining where to place output files.

> I needed to split ARCH_DISTDIR, which points to the installed GRASS,  
> from the distdir for building the extension into.  So, that required  
> a few other changes in the other makefile frags:
> 
> 
> - platform.make - replace the RUN_GISBASE setting:
> 
> ifdef INST_XTN
> RUN_GISBASE         = $(INST_DIR)
> else
> RUN_GISBASE         = /Users/Shared/src/GRASS/cvs/grass6/dist.i686- 
> apple-darwin8.10.1
> endif

If GISBASE is split appropriately, it shouldn't be necessary to
conditionalise this.

> - html.make - conditionally refer to ARCH_DISTDIR or XTN_DISTDIR as  
> needed:

Ditto.

> htmlgen:
> 	@$(MODULE_TOPDIR)/tools/mkhtml.sh $(PGM)
> 	-if [ "${INST_XTN}" = "y" ] ; then \
> 		$(MKDIR) $(XTN_DISTDIR)/docs/html ; \
> 		mv -f $(PGM).tmp.html $(XTN_DISTDIR)/docs/html/$(PGM).html ; \
> 	else \
> 		$(MKDIR) $(ARCH_DISTDIR)/docs/html ; \
> 		mv -f $(PGM).tmp.html $(ARCH_DISTDIR)/docs/html/$(PGM).html ; \
> 	fi
> 	-for file in  *.png *.jpg ; do \
> 		head -n 1 $$file | grep '^#!' > /dev/null ; \
> 		if [ $$? -ne 0 ] ; then \
> 			if [ "${INST_XTN}" = "y" ] ; then \
> 				$(INSTALL_DATA) $$file $(XTN_DISTDIR)/docs/html ; \
> 			else \
> 				$(INSTALL_DATA) $$file $(ARCH_DISTDIR)/docs/html ; \
> 			fi \
> 		fi \
> 		done 2> /dev/null ; true
> 
> - install tools/mkhtml.sh in the installed GRASS
> 
> 
> This works mostly.  The compilation works.  But html.make is having  
> problems - running the module to generate the htmldesc complains  
> about GISDBASE not being set and all I get is the description and no  
> module options/usage.
> 
> GISDBASE is set correctly in .grassrc63 in the demolocation I  
> installed.

Does $(GISRC) actually refer to that file, though?

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




More information about the grass-dev mailing list