diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2013-11-07 18:46:39 -0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-11-14 17:52:39 +0000 |
commit | 4b59746600936bfec377e19a01e5ccb90e6e1c48 (patch) | |
tree | 00c7d22cbfbef1580153a9f3d835141bb29181cb /Makefile.rules | |
parent | d44932402ad99bfaeba3e3a6641e84595401df39 (diff) | |
download | chrome-ec-4b59746600936bfec377e19a01e5ccb90e6e1c48.tar.gz |
util: declare all host utils source dependencies in build.mk
Instead of hardcoding the common files for host utils in the generic
rules, let's declare them in the build.mk file using the same system as
the Linux kernel build.
if a binary "foo" declared in "host-util-bin" or "build-util-bin" has a
matching "foo-objs" variable, it will be build from all objects declared
in "foo-objs" else it uses directly "foo.o" (single source file).
This is preparatory to add new "build" tools sharing common sources.
note: the dependencies on the utils are a bit less fine-grained as a
result of this change, but given the low number of tools, that should be
acceptable.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=none
BUG=none
TEST=./util/make_all.sh
Change-Id: Ieffce7ca6f5b685ffb7d1f4626b99aff07b61443
Reviewed-on: https://chromium-review.googlesource.com/176174
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'Makefile.rules')
-rw-r--r-- | Makefile.rules | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Makefile.rules b/Makefile.rules index 6360edcf3b..7c0af672d0 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -10,6 +10,8 @@ objs := $(all-y) deps := $(objs:%.o=%.o.d) build-utils := $(foreach u,$(build-util-bin),$(out)/util/$(u)) host-utils := $(foreach u,$(host-util-bin),$(out)/util/$(u)) +build-srcs := $(foreach u,$(build-util-bin),$(sort $($(u)-objs:%.o=util/%.c) util/$(u).c)) +host-srcs := $(foreach u,$(host-util-bin),$(sort $($(u)-objs:%.o=util/%.c) util/$(u).c)) # Create output directories if necessary _dir_create := $(foreach d,$(dirs),$(shell [ -d $(out)/$(d) ] || \ @@ -37,8 +39,10 @@ cmd_elf = $(LD) $(LDFLAGS) $(objs) -o $@ -T $< -Map $(out)/$*.map cmd_exe = $(CC) $(HOST_TEST_LDFLAGS) $(objs) -o $@ cmd_c_to_o = $(CC) $(CFLAGS) -MMD -MF $@.d -c $< -o $@ cmd_c_to_build = $(BUILDCC) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) \ - -MMD -MF $@.d $< -o $@ -cmd_c_to_host = $(HOSTCC) $(HOST_CFLAGS) -MMD -MF $@.d $(filter %.c, $^) -o $@ + $(sort $(foreach c,$($(*F)-objs),util/$(c:%.o=%.c)) $*.c) \ + -MMD -MF $@.d -o $@ +cmd_c_to_host = $(HOSTCC) $(HOST_CFLAGS) -MMD -MF $@.d -o $@ \ + $(sort $(foreach c,$($(*F)-objs),util/$(c:%.o=%.c)) $*.c) cmd_host_test = ./util/run_host_test $* $(silent) cmd_version = ./util/getversion.sh > $@ cmd_mv_from_tmp = mv $(out)/$*.bin.tmp $(out)/$*.bin @@ -153,11 +157,10 @@ $(out)/common/version.o: $(out)/ec_version.h $(out)/ec_version.h: $(filter-out $(out)/common/version.o,$(objs)) $(call quiet,version,VERSION) -$(build-utils): $(out)/%:%.c +$(build-utils): $(out)/%:$(build-srcs) $(call quiet,c_to_build,BUILDCC) -$(host-utils): $(out)/%:%.c $(foreach u,$(host-util-common),util/$(u).c) \ - $(foreach u,$(util-lock-objs),util/lock/$(u).c) +$(host-utils): $(out)/%:$(host-srcs) $(call quiet,c_to_host,HOSTCC ) $(out)/util/burn_my_ec: $(out)/$(PROJECT).bin |