I disagree here. To me it looks like obj-y is a misuse of the
obj-$(CONFIG_XXX) rule.
It looks much more intuitive to have a separate rule. But common practice
today differ so it should stay.
Another argument is that we should keep the way to express things down
only one way.
> Initially, it was for built-in targets in addition to the standard
> O_TARGET, like arch/i386/kernel/head.o.
> I've been abusing it for scripts/, and I shouldn't be doing that.
You used EXTRA_TARGETS to make sure host-progs programs got compiled.
In general the way to use host-progs is not nice.
Typical usage:
host-progs := gentbl
include $(TOPDIR)/Rules.make
%tbl: %data: $(obj)/somefile.data $(obj)/gentbl
gentbl $< $@
In other words you need to make an explicit prerequisite to the host-progs
to get it build, which is what you did with EXTRA_TARGETS.
I would advocate for another solution:
Let programs listed in host-progs be compiled always.
Then the makefile could assign host-progs conditionally instead.
find -name Makefile | xargs grep host-progs | wc -l
12
A doable task, that I'm ready to do.
We could also define
force-host-progs :=
or something similar.
>
> > > -cmd_link_multi = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $($(basename $@)-objs),$^)
> > > +cmd_link_multi = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(addprefix $(obj)/,$($(subst $(obj)/,,$(@:.o=-objs)))),$^)
> > Keep a variable without obj appended would make this readable I think.
>
> I agree that it is not particularly readable, but I'm limited to what make
> offers. What do you suggest?
Untested:
$(notdir $(@:.o=-objs))
Sam
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/