Other Custom rules in BSD Makefiles

Hi!

I am looking for a way to create custom build rules in BSD makefiles, but did not find anything besides the common .c.o pattern. Here is my use-case:

I would like to create an .html file out of an .htmlm4 file using the the m4(1) macro processor. I am using a Makefile along the following lines:
Code:
.htmlm4.html:
    @echo "Input: $<"
    @echo "Target: $@"
    #m4 $< > $@

index.html: index.htmlm4
When running make(1), the output is the following:
Code:
Input: 
Target: .htmlm4.html
This is not what I expected. I expected:
Code:
Input: index.htmlm4
Target: index.html
How can I fix this?
 
You need to add a .SUFFIXES line that defines the files suffixes that you use in the suffix-transformation definition, like this:
Code:
.SUFFIXES: .html .htmlm4

.htmlm4.html:
    @echo ...
    ...
 
Back
Top