[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)
> >
> >    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


default: menu all

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

# and so on...



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.

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