[Phoenix] Antifying NAR template Makefile

Andreas Wuest awuest at student.ethz.ch
Mon Sep 18 23:45:51 CEST 2006


Hi

In order to automate the process of building local NAR templates, I've 
created a Makefile.

I originally wanted to use ant, but I did not find a way to "for all 
dirs in current dir; zip dir". Filesets only let me specify a bunch of 
files for one zip task, but not the other way round, i.e. multiple zip 
tasks for every directory.

Maybe somebody else can antify this Makefile for me then...

Here is how it works (I've added line numbers for easier referencing):

01 nar := $(patsubst %.nar,../%.nar,$(wildcard *.nar))
02
03 all: clean $(nar)
04
05 ../%.nar: %.nar
06 	@printf "\nBuild NAR template $@\n"
07 	cd $< && zip -r "../$@" . -x \*.svn\*
08
09 clean:
10 	rm ../*.nar
11
12 .PHONY: clean


Line 1 collects all files (in our case, directories) in the current dir 
ending with .nar and converts them into a list of files of name 
"../*.nar". E.g., if we have the directories "atom.nar" and "xhtml.nar" 
in the current dir, the $(nar) list looks like this: "../atom.nar 
../xhtml.nar".

Line 3 first cleans out old NAR templates, and then calls the "../%.nar" 
target for every file in the list $(nar). Following the example above, 
we have a call to "../atom.nar" and a call to "../xhtml.nar", which are 
both matched by the "../%.nar" target.

On line 7 we first have to cd into the directory to zip, otherwise the 
zip files are malformed when called with e.g. a "atom.nar" root instead 
of the "." root.

This Makefile can be found in 
yulup/src/trunk/yulup/prototypes/prototype1/src/templates/src. The idea 
is to have a directory for every NAR template which should be generated 
later, and these directories are named *.nar.

-- 
Kind regards,
Andi



More information about the Phoenix mailing list