[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: makefile issues



> > 1. my first problem:
> >    how can i get the `pwd` where the makefile was started?
> >    GNU: ROOTDIR=$(shell pwd)
> >    BSD: ROOTDIR=$(.CURDIR)
> >
> >    is there a universal solution in the Makefile?  or any other
> >    ideas (./configure preferably not)
> 
> if it helps, all actions in the makefile in both BSD and GNU always start
> in the Makefile's pwd. here's an example with the target "example":

the problem is, that this makefile calls a bunch of scripts, enters
directories, leaves them, these scripts call e.g. awk which has all
its scripts in a subdirectory called ./awk but all the shell scripts
are in ./bin and so on.  the make process needs absolute paths to work
correctly and easily.

the snippet: (GNUmakefile)

ROOTDIR=$(shell pwd)

include ./config

SH?=/bin/sh

default: menu all

menu:
        @$(SH) bin/modul.sh $(SZOTAR)

# and so on...

-------------------------------

./config:
WRKDIR=${ROOTDIR}/tmp
SZOTAR=${ROOTDIR}/szotar
AFFDIR=${ROOTDIR}/aff
AWKDIR=${ROOTDIR}/awk
DICT=${WRKDIR}/dictionary
ECHO=${ROOTDIR}/bin/echo.sh

this config file is sourced in the shell scripts as well,
because the two syntaxes can live together.

this is why i need a global variable which will hold the root
directory of the source tree.  that is, after all, not a big
problem, but currently not portable.

currently i have two makefiles, GNUmakefile and BSDmakefile,
they set up the ${ROOTDIR} include the config file, and include
a Makefile.inc which is mostly both-makefile-compatible.
(the example above is simplified)


my only problem in this Makefile.inc is the gnu % macro...


> i think you should look at .IMPSRC (the implied source), the .TARGET
> (target of the action), and the .SUFFIXES rules:

i did, but somehow i couldn't get it work, and yes i did read
some of the /usr/share/mk files.  it is hard, i will try again.



-f
-- 
excuse me if i sound bitter...  i taste that way too...