This is the mail archive of the automake@gnu.org mailing list for the automake project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


[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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]