On Sat, Jun 01, 2002 at 02:34:25AM -0500, Kai Germaschewski wrote:
> > > gcc $CFLAGS -DKBUILD_BASENAME=raw -c -o raw.o raw.c
> > > gcc $CFLAGS -DKBUILD_BASENAME=pty -DEXPORT_SYMTAB -c -o pty.o pty.c
> > > gcc $CFLAGS -DKBUILD_BASENAME=misc -DEXPORT_SYMTAB -c -o misc.o misc.c
> > > gcc $CFLAGS -DKBUILD_BASENAME=random -DEXPORT_SYMTAB -c -o random.o random.c
> > > gcc $CFLAGS -DKBUILD_BASENAME=vt -c -o vt.o vt.c
> > > gcc $CFLAGS -DKBUILD_BASENAME=vc_screen -c -o vc_screen.o vc_screen.c
>
> Not bad, I suppose different people prefer different approaches, anyway.
> There is, however, still redundant output there, the "-o vt.o" and
> "KBUILD_BASENAME=vt" should go away as well too, IMO.
I agree about the "-o vt.o" part. I'm not so sure about KBUILD_BASENAME -
it's a little redundant, but it is sent to the compiler and is different on
each compile. Anyway, fixing the '-o' redundancy is simple - just don't
send it to the compiler in the first place (the compiler will always do it
anyway).
I've attached another example patch to the end of this message. Output
looks like:
gcc $CFLAGS -fno-omit-frame-pointer -DKBUILD_BASENAME=sched -c sched.c
gcc $CFLAGS -DKBUILD_BASENAME=dma -c dma.c
gcc $CFLAGS -DKBUILD_BASENAME=fork -c fork.c
gcc $CFLAGS -DKBUILD_BASENAME=exec_domain -DEXPORT_SYMTAB -c exec_domain.c
gcc $CFLAGS -DKBUILD_BASENAME=panic -c panic.c
>
> [Answered a follow-up mail and didn't realize that l-k was CC'ed in
> the first one, so here's my reply again.]
Sorry about that. This one is also CC'ed to lkml.
Thanks,
-Kevin
--- ../gold-2.5/Rules.make Fri May 31 22:10:04 2002
+++ ./Rules.make Sat Jun 1 10:57:18 2002
@@ -127,7 +127,7 @@
%.i: %.c FORCE
$(call if_changed,cmd_cc_i_c)
-cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
+cmd_cc_o_c = $(CC) $(c_flags) -c $<
%.o: %.c FORCE
$(call if_changed,cmd_cc_o_c)
@@ -396,8 +396,9 @@
# function to only execute the passed command if necessary
+echo_cmd = echo '$(strip $(subst $(CFLAGS),$$CFLAGS,$(subst $(CFLAGS_MODULE),$$CFLAGS_MODULE,$($(1)))))'
+
if_changed = $(if $(strip $? \
$(filter-out $($(1)),$(cmd_$(@F)))\
$(filter-out $(cmd_$(@F)),$($(1)))),\
- @echo '$($(1))' && $($(1)) && echo 'cmd_$@ := $($(1))' > $(@D)/.$(@F).cmd)
-
+ @$(call echo_cmd,$(1)) && $($(1)) && echo 'cmd_$@ := $($(1))' > $(@D)/.$(@F).cmd)
--
------------------------------------------------------------------------
| Kevin O'Connor "BTW, IMHO we need a FAQ for |
| [email protected] 'IMHO', 'FAQ', 'BTW', etc. !" |
------------------------------------------------------------------------