[GRASS-dev] installed makefile cleanup

William Kyngesburye woklist at kyngchaos.com
Sun Sep 23 13:30:20 EDT 2007


On Sep 23, 2007, at 4:48 AM, Glynn Clements wrote:

>
> 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.
>
Cool.

>> - 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.
>
...
>
> 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.

(below, just trying to get a handle on the whole thing)

So, I came up with these "bases" for finding/creating files:

- INST_DIR - where make install target copies files to - can be  
overridden for installing to external location (I worked on this  
after my initial email).

- GRASS_HOME - source topdir (full path)
- MODULE_TOPDIR - source topdir (usually relative path)

- ARCH_DISTDIR - where targets are built INTO before installation,  
default based on GRASS_HOME


and these use them (that are of interest to an external build/install):

- RUN_GISBASE -> ARCH_DISTDIR - but right now that's expanded by  
configure

- RUN_GISRC -> ARCH_DISTDIR

- GISBASE -> ARCH_DISTDIR - usually reset to RUN_GISBASE (which is  
just ARCH_DISTDIR anyways), but the main makefile uses it directly  
for GRASS_PDFDIR

- demolocation -> ARCH_DISTDIR

- html.make -> ARCH_DISTDIR - for generating html files into

- makefile includes -> MODULE_TOPDIR
- doxygen commands in doxygen.make -> MODULE_TOPDIR
- FMODE_OBJ in grass.make -> MODULE_TOPDIR
- htmlgen in html.make -> MODULE_TOPDIR - to find tools/mkhtml.sh
- scriptstrings in script.make -> MODULE_TOPDIR - to find translate.c  
files

- BIN, ETC, DRIVERDIR -> ARCH_DISTDIR

- ARCH_LIBDIR, ARCH_INCDIR -> ARCH_DISTDIR


As used with the INST_NOW/INST_XTN makes, where GRASS_HOME is set to  
the module source dir and MODULE_TOPDIR is set to the installed GRASS  
binary, that creates a couple problems:

- ARCH_DISTDIR is local to the module source, but is used to find and  
use demolocation (RUN_GISBASE, RUN_GISRC).

INST_XTN will work with GRASS_HOME set to the module source dir, but  
won't find the installed demolocation.

- Also, ARCH_LIBDIR and ARCH_INCDIR are needed to find BOTH installed  
GRASS libs and headers AND module built libs and headers (for the  
rare addon module that has its own library).  For the INST_NOW build,  
this works as is.

For the INST_XTN build, the installed GRASS lib/include would have to  
be added to ARCH_INC and ARCH_LIBPATH (slightly different than I  
currently have it).


So, as you said (it's making sense to me now), GISBASE somehow needs  
its own base dir setting, defaulting to ARCH_DISTDIR, and which would  
only need to be overridden by the INST_XTN build.

How about this: since GISBASE is really only for *running* GRASS, and  
should only be set as needed (fix that GRASS_PDFDIR usage), don't use  
it as a makefile var.  RUN_GISRC is off the RUN_GISBASE dir, which  
configures to the same as ARCH_DISTDIR, so base it on that, and  
default RUN_GISBASE to ARCH_DISTDIR, in platform.make:

RUN_GISBASE = ${ARCH_DISTDIR}
RUN_GISRC = ${RUN_GISBASE}/demolocation/.grassrc${GRASS_VERSION_MAJOR} 
${GRASS_VERSION_MINOR}

Configure won't need to set anything for RUN_GISBASE then.  I  
wouldn't need those conditionals in html.make.  And just nned to add  
to ARCH_INC and ARCH_LIBPATH for the INST_XTN build.

Then, for modules, in the module source dir:

for INST_NOW:

INST_NOW=y make GRASS_HOME=/path/to/installed/grass MODULE_TOPDIR=/ 
path/to/installed/grass

for INST_XTN:

INST_NOW=y make GRASS_HOME=. MODULE_TOPDIR=/path/to/installed/grass  
RUN_GISBASE=/path/to/installed/grass


-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

Theory of the Universe

There is a theory which states that if ever anyone discovers exactly  
what the universe is for and why it is here, it will instantly  
disappear and be replaced by something even more bizarrely  
inexplicable.  There is another theory which states that this has  
already happened.

-Hitchhiker's Guide to the Galaxy 2nd season intro





More information about the grass-dev mailing list