bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Canned command sequences


From: Sam Ravnborg
Subject: Canned command sequences
Date: Tue, 3 Jun 2003 22:50:53 +0200
User-agent: Mutt/1.4.1i

I have a few reports that when building the Linux 2.5.70 kernel
the build system is more noisy than supposed to be.

The problem is tracked down to usage of canned command sequences.
The following is from the makefiles:

#General definition (scripts/Makefile.lib)
if_changed_rule = $(if $(strip $? \
                               $(filter-out $(cmd_$(1)),$(cmd_$@))\
                               $(filter-out $(cmd_$@),$(cmd_$(1)))),\
                        @set -e; \
                        $(rule_$(1)))

#definition of the rule (scripts/Makefile.build)
define rule_vcc_o_c
        $(if $($(quiet)cmd_vcc_o_c),echo '  $($(quiet)cmd_vcc_o_c)';)         \
        $(cmd_vcc_o_c);                                                       \
                                                                              \
        if ! $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then         \
                mv $(@D)/.tmp_$(@F) $@;                                       \
        else                                                                  \
                $(CPP) -D__GENKSYMS__ $(c_flags) $<                           \
                | $(GENKSYMS)                                                 \
                > $(@D)/.tmp_$(@F:.o=.ver);                                   \
                                                                              \
                $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F)                    \
                        -T $(@D)/.tmp_$(@F:.o=.ver);                          \
                rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver);              \
        fi;
                                              \
        scripts/fixdep $(depfile) $@ '$(cmd_vcc_o_c)' > $(@D)/.$(@F).tmp;     \
        rm -f $(depfile);                                                     \
        mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd
endef

#usage of the rule (scripts/Makefile.build)
%.o: %.c FORCE
        $(call if_changed_rule,vcc_o_c)


What happens is that the scripts/fixdep command is displayed.
In if_changed_rule '@' is used to supress all commands in the canned command
sequence - but is fails to do so for the fixdep command.

People reporting this has been using debian unstable, with make 3.80-1.
I have tried to reproduce this with RH8.0 with make 3.79.1 + 3.80 with no
luck.

The following makefile exhibit the problem, also at my installation:
--------------------------
define rule_up
        echo hello
        echo hello again
endef

shut = @set -e;$(rule_$(1))

all:
        $(call shut,up)
----------------------------

Output with make 3.79.1:
========================
address@hidden tmp]$ make.old --version
GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.
address@hidden tmp]$ make.old
hello
hello again

Output with make 3.80:
======================
address@hidden tmp]$ make --version
GNU Make 3.80
address@hidden tmp]$ make
hello
echo hello again
hello again

The culprint is the extra line:
"echo hello again"
It should not be there.

Any explanation and suggested workarounds that are backward compatible?

So far my best approach is to avoid launching a new subshell, by continuing
the line.

        Sam




reply via email to

[Prev in Thread] Current Thread [Next in Thread]