I need to integrate the generation of many HTML files into an existing Makefile . The problem is that HTML files must be in many different directories. My idea is to write an implicit rule that converts the source file (* .st) to the corresponding html file
%.html: %.st $(HPC) -o $@ $<
and a rule that depends on all html files
all: $(html)
If the HTML file is not in the builddir make file, it does not find the implicit rule: *** No rule to make target . If I change an implicit rule like this:
$(rootdir)/build/doc/2009/06/01/%.html: %.st $(HPC) -o $@ $<
he found, but then I should have an implicit rule for almost every file in the project. According to the Implicit Rules Search Algorithm in the GNU make manual, rule searches work as follows:
- Divide t into the part of the directory called d, and the rest into n. For example, if t is
src/foo.o', then d is src /', and n is `foo.o '. - Make a list of all the template rules, one of whose goals is t or n. If the target pattern contains a slash, it maps to t; otherwise, against n.
Why is the implicit rule not found, and what would be the most elegant solution if using GNU make ?
Here is a stripped down version of my Makefile :
rootdir = /home/user/project/doc HPC = /usr/local/bin/hpc html = $(rootdir)/build/doc/2009/06/01/some.html %.html: %.st $(HPC) -o $@ $<
source share