Op do 15-01-2004, om 15:33 schreef Ronald van Engelen:
> Op wo 14-01-2004, om 10:57 schreef ik:
> Thanks for all the useful replies! After being not so lazy and thus
> reading the GNU make manual (info), things are going better each time.
>
> I decided to go for (the) GNU make (syntax), since I presume it can be
> (made to) run on most platforms.
>
> When I finish the Makefile(s) and the source XSL- and XML-files I'll
> post them on my website so you can all have a great laugh ;)
After reading (a lot) in the info manual, and looking at some other
Makefiles, I still can't figure out how to complete the next thing, help
would be appreciated:
a. Run a xsltproc command. This outputs a space-seperated list of
subdirs, which gets stored in the first variable
b. Within each subdir, run a second xsltproc command with a parameter
containing the value of the current subdir. The output of this
command, a space-seperated list of filenames, should be stored in a
second variable
c. For each filename, run a third xsltproc command with a parameter
containing the value of subdir, and a second parameter containing the
value of filename. This command should put its output in the
filename.
Task a. is accomplished. I solved b. and c. before by generating
Makefiles (includes) in each subdir, by calling a special xsl-file from
within the main Makefile. But this took three nested for loops, which
never seemed to end (13 seconds).
So here is my new Makefile. 1, 3 and 4 work as expected. The problem is
that I can't put the output of 5. @$(FILELIST), which DISPLAYS the
correct filenames, in a variable for use in the loop. I tried declaring
2. as a simply expanded variable (again using the $(shell ...) function,
but then make runs the command immediately and $@ of course contains
nothing.
XSLT = /usr/bin/xsltproc
L_DIRS = listdirs.xsl
L_FILES = listfiles.xsl
XSL = makepage.xsl
XML = contents.xml
1. DIRS := $(shell $(XSLT) $(L_DIRS) $(XML))
2. FILELIST = $(XSLT) --stringparam subdir $@ $(L_FILES) $(XML)
3. $(DIRS):
4. mkdir $(DIRS)
5. for file in @$(FILELIST); do ( \
$(XSLT) \
-o $$file \
--stringparam subdir $@ \
--stringparam page $$file \
$(XSL) $(XML); )
done
all: $(DIRS)
Pointers/help would be appreciated!
> Thanks,
> Ronald
Again ;)
<<signature.asc>>