Re: Smart CONFIG_* Dependencies

Martin von Loewis (martin@mira.isdn.cs.tu-berlin.de)
Sat, 22 Nov 1997 12:50:08 +0100


> Try it out and do let me know what you think.

Michael,
I like this smart configuration package very much, and I think you
are right on track with it.

Unfortunately, it currently cannot build all modules. I found that
the Hisax ISDN driver and the VFAT filesystem driver won't build
as modules. This is because both drivers define an O_TARGET, and
then define the M_OBJS to include the O_TARGET. Since the O_TARGET
is obtained by linking together the O_OBJS, there is no way defined
to build mod-O_TARGET.

So I want to bring up the flag-dependant recompilation again. My
proposal is to use gmake tricks.

First, produce the string that indicates whether recompilation is
necessary:

RECOMPILE_CFLAGS=$(sort $(CFLAGS))

Whenever recompiling, also produce a Makefile include:
a.o: a.c
$(CC) -c $(CFLAGS) a.c
@echo 'ifneq ($(RECOMPILE_CFLAGS),$$(RECOMPILE_CFLAGS))' > $@.flags
@echo ".PHONY: $@" >>$@.flags
@echo endif >>$@.flags

This will produce a file a.o.flags with the contents
ifneq (-DBAR -DFOO,$(RECOMPILE_CFLAGS))
.PHONY: a.o
endif

In the Rules.make, include all those files

ifneq ($(wildcard *.flags),)
include $(wildcard *.flags)
endif

What do you think?

Martin