automake
[Top][All Lists]
Advanced

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

Re: Automake's include "overrides" makes include?


From: Alexandre Duret-Lutz
Subject: Re: Automake's include "overrides" makes include?
Date: Fri, 25 Jan 2002 13:39:32 +0100
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1 (i386-debian-linux-gnu)

[Daniel Shane]
| I am trying to write a rule that will rebuild a tar.gz of a number of
| directories when some of the files change. Here is an example of Makefile
| that works with make :
|
| DIRS = project1 project2
| RESULT = $(foreach dir,$(DIR),$(dir).tar.gz)
| 
| all: $(RESULT)
| 
| $(RESULT):
|       tar xvf $@ ($subst .tar.gz,,$@)
| 
| include tar_deps.mk
| 
| tar_deps.mk: Makefile
|       for dir in $(DIRS); do \
|               echo -n "$$f.tar.gz: " >> $@; \
|               find $$f -type f -printf "%p " >> $@; \
|       done;
| 
| This uses a cleaver "include" make trick. When tar_deps gets overriten, make
| will re-include it and re-scan the Makefile.
| 
| Now when I use this with automake, it doesnt work because I cant seem to be
| able to pass the "include tar_deps.mk" statement intact to the Makefile
| since it is also a keywork of automake. Does anyone have an idea on how I
| could work around this? 

foreach, subst, and include are not portable, so I suggest you
take all these rules out of your Makefile.am.  

Intead, you can create a file called GNUmakefile and fill it
with all the above rules, plus `include Makefile'.  

This way if a user runs GNU make all the rules from GNUmakefile
and Makefile will be used, otherwise only Makefile will be read.

(Projects like fileutils, textutils, shellutils, autoconf,
and  bison, use a similar setup.)
-- 
Alexandre Duret-Lutz




reply via email to

[Prev in Thread] Current Thread [Next in Thread]