There's one thing I would simply love to accomplish with Automake: the
ability to extend rules without overriding them. For instance, how would
one print a custom message in a specific format (i.e. color) each time a
source file is compiled and a binary linked?
For instance, in a traditional Makefile I would simply add the following
rule:
%.o: %.c
@echo -e "[C] `basename $<`
@$(CC) $(CFLAGS) -c $< -o $@
$(bin): $(bin_OBJECTS)
@echo "\033[1;32m[L] `basename $@`\033[0m"
@LINK_LOG="/tmp/`basename $@`.link.log"; \
[ -f $$LINK_LOG ] && rm $$LINK_LOG; \
$(CXX) $(CXX_FLAGS) -o $@ $(EXE_OBJECTS) \
$(LIBRARIES) 2>$$LINK_LOG ; \
EXIT_CODE=$$?; \
if [ ! $$? -eq 0 ]; then \
cat "$$LINK_LOG"; \
exit $$EXIT_CODE; \
fi;
The above would result in something like:
[C] foo.c
[C] bar.c
[L] bin # in yellow
But how does one setup a Makefile.am such that compilation and linking
rules are extended in Makefile.in and the generated Makefile.am still
contains the normally generated compile/link rules logic - so
dependencies, compilation and linking logic is kept and *not* overriden.
I've had a look at the Automake hooks but they seem to be executed after
the main rule.