programming: Makefile

George Georgalis george at galis.org
Fri May 27 16:44:57 PDT 2005


On Fri, May 27, 2005 at 09:52:39PM +0200, Simon 'corecode' Schubert wrote:
>George Georgalis wrote:
>> But now, when I do this (home/geo is a cvs module):
>> 
>> include function.mk
>> geo :
>> 	make -C home/geo MAKE_REAL_HARD_LINKS REAL=/home/geo
>> 
>> I get...
>> 
>> % make geo       
>> make -C home/geo MAKE_REAL_HARD_LINKS REAL=/home/geo
>> make: don't know how to make MAKE_REAL_HARD_LINKS. Stop
>> *** Error code 2
>> 
>> 
>> So how does one "include" targets, or am I going about this wrong?
>
>hmm... either you want to use -f function.mk to use the correct makefile
>in your recursive make,

oic, I would have expected a Makefile "include" to work like a shell
"source" command, there must be something I don't understand because
this doesn't sound like a stretch, even for Makefile syntax.

>or you might want to restructure your system to use .for loops in the
>makefile like
>
>DIRS=home/geo home/foo
>
>.for REAL in ${DIRS}
>.for _targ in do_${REAL:C,/,_,g}
>all: ${_targ}
>${_targ}:
>	<code to make hardlinks>
>.endfor
>.endfor

There is quite a lot there I cannot make any sense out of. :-\
I think I'm reading the double .for with C,,, expansion as repeating the
code block for each target defined as an entry in DIRS? heh, so "make
geo" or "make foo" does the right thing, not to mention "make all". That
is pretty darn tight!

Since it looks like it will also work for
DIRS=home/geo etc/skel usr/local/script

it may indeed be the do-all I need, but it's going to take me a while to
get comfortable wrapping my head around that!

Thanks,
// George


-- 
George Georgalis, systems architect, administrator Linux BSD IXOYE
http://galis.org/george/ cell:646-331-2027 mailto:george at xxxxxxxxx





More information about the Users mailing list