From 6674b24ac5a1a4fe05fe5b4d2c74e9981b4304b0 Mon Sep 17 00:00:00 2001 From: Nicolas Boichat Date: Wed, 20 Feb 2019 12:54:11 +0800 Subject: Makefiles.rules: Add rule to create static libraries (.a) This will be useful for some targets (which will still need to fixup the dependencies themselves). BRANCH=none BUG=b:124804731 TEST=With follow-up TEST CLs, libprivate.a can be created Change-Id: I5a1f4726794b308824275530b08f327e679eb904 Signed-off-by: Nicolas Boichat Reviewed-on: https://chromium-review.googlesource.com/1475108 --- Makefile.rules | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile.rules b/Makefile.rules index c82e5de2d8..207b7900fc 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -91,6 +91,7 @@ cmd_c_to_host = $(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -MMD -MF $@.d -o $@ \ $(sort $(foreach c,$($(*F)-objs),util/$(c:%.o=%.c)) $(wildcard $*.c)) cmd_cxx_to_host = $(HOSTCXX) -std=c++0x $(COMMON_WARN) $(HOST_CXXFLAGS)\ -I ./$($(notdir $@)_ROOT) -o $@ $(filter %.cc,$^) $($(notdir $@)_LIBS) +cmd_o_to_a = $(AR) rcs $@ $^ cmd_host_test = $(MAKE) --no-print-directory BOARD=host PROJECT=$* \ V=$(V) out=build/host/$* TEST_BUILD=y EMU_BUILD=y CROSS_COMPILE= \ $(TEST_FLAG) build/host/$*/$*.exe @@ -492,6 +493,11 @@ $(out)/RO/%.o:%.S $(out)/RW/%.o:%.S $(call quiet,c_to_o,AS ) +# Default rules for archives, dependencies need to be fixes in build.mk +$(out)/RO/%.a: + $(call quiet,o_to_a,AR ) +$(out)/RW/%.a: + $(call quiet,o_to_a,AR ) # Conditionally force the rebuilding of ec_version.h only if it would be # changed. -- cgit v1.2.1