mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
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>
This commit is contained in:
committed by
chrome-internal-fetch
parent
d44932402a
commit
4b59746600
@@ -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
|
||||
|
||||
@@ -7,10 +7,15 @@
|
||||
#
|
||||
|
||||
host-util-bin=ectool lbplay burn_my_ec
|
||||
host-util-common=ectool_keyscan comm-host comm-dev misc_util ec_flash
|
||||
|
||||
comm-objs=$(util-lock-objs:%=lock/%) comm-host.o comm-dev.o
|
||||
ifeq ($(CONFIG_LPC),y)
|
||||
host-util-common+=comm-lpc
|
||||
comm-objs+=comm-lpc.o
|
||||
else
|
||||
host-util-common+=comm-i2c
|
||||
comm-objs+=comm-i2c.o
|
||||
endif
|
||||
ectool-objs=ectool.o ectool_keyscan.o misc_util.o ec_flash.o $(comm-objs)
|
||||
lbplay-objs=lbplay.o $(comm-objs)
|
||||
burn_my_ec-objs=ec_flash.o $(comm-objs) misc_util.o
|
||||
|
||||
build-util-bin=ec_uartd stm32mon iteflash
|
||||
|
||||
@@ -6,4 +6,4 @@
|
||||
# Lock library
|
||||
#
|
||||
|
||||
util-lock-objs=csem ipc_lock gec_lock
|
||||
util-lock-objs=csem.o ipc_lock.o gec_lock.o
|
||||
|
||||
Reference in New Issue
Block a user