[Logcheck-devel] Templating system - basic m4 implementation
Russell Howe
rhowe at bmtmarinerisk.com
Wed Jan 13 12:48:30 UTC 2010
Hi,
I saw a page on the wiki about a templating system and I agree it would
probably be quite handy.
I don't profess to know much about m4 or make, but had a go at knocking
something together anyway:
Makefile:
M4=m4
M4LIBS=$(wildcard lib/*.m4)
SRCS=$(wildcard src/*)
TARGETS=$(subst .in,.rules,$(subst src,build,$(SRCS)))
.PHONY : build
build : $(TARGETS)
.PHONY : clean
clean :
rm -rf build/*
%.rules: $(SRCS) $(M4LIBS)
$(M4) $(M4LIBS) $< > $@
Create 3 directories, build, lib and src
Put "library" patterns in lib and the rules you wish to process in src
Run make
Processed files ready for passing to logcheck should be in build
I haven't actually tried this in production yet, but it seems to do kind
of the right thing...
Useful to anyone?
--
Russell Howe, IT Manager. <rhowe at bmtmarinerisk.com>
BMT Marine & Offshore Surveys Ltd.
More information about the Logcheck-devel
mailing list