This is the mail archive of the
automake@gnu.org
mailing list for the automake project.
Re: Automake's include "overrides" makes include?
- From: Alexandre Duret-Lutz <duret_g at lrde dot epita dot fr>
- To: Daniel Shane <daniel dot shane at eicon dot com>
- Cc: "'automake at gnu dot org'" <automake at gnu dot org>
- Date: Fri, 25 Jan 2002 13:39:32 +0100
- Subject: Re: Automake's include "overrides" makes include?
- References: <D8E12241B029D411A3A300805FE6A2B90257615C@montreal.eicon.com>
[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