From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andre Przywara Subject: [RFC PATCH 1/2] Makefile: cleanup guest/init generation Date: Tue, 23 Jun 2015 16:06:26 +0100 Message-ID: <1435071987-7543-2-git-send-email-andre.przywara@arm.com> References: <1435071987-7543-1-git-send-email-andre.przywara@arm.com> Cc: kvm@vger.kernel.org To: will.deacon@arm.com, Andreas Herrmann Return-path: Received: from foss.arm.com ([217.140.101.70]:51544 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753853AbbFWPGM (ORCPT ); Tue, 23 Jun 2015 11:06:12 -0400 In-Reply-To: <1435071987-7543-1-git-send-email-andre.przywara@arm.com> Sender: kvm-owner@vger.kernel.org List-ID: The dependencies and targets for the guest userland binary are currently not correct, some are redundant. Fix them by splitting up guest/guest_init.o creation into its two steps and describe the dependencies properly. On the way use automatic variables in some rules. Signed-off-by: Andre Przywara --- Makefile | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 151fa9d..b9480ff 100644 --- a/Makefile +++ b/Makefile @@ -337,7 +337,7 @@ ifneq ($(WERROR),0) CFLAGS += -Werror endif -all: $(PROGRAM) $(PROGRAM_ALIAS) $(GUEST_INIT) +all: $(PROGRAM) $(PROGRAM_ALIAS) # CFLAGS used when building objects # This is intentionally not assigned using := @@ -352,22 +352,25 @@ c_flags = -Wp,-MD,$(depfile) $(CFLAGS) STATIC_OBJS = $(patsubst %.o,%.static.o,$(OBJS) $(OBJS_STATOPT)) GUEST_OBJS = guest/guest_init.o -$(PROGRAM)-static: $(STATIC_OBJS) $(OTHEROBJS) $(GUEST_INIT) +$(PROGRAM)-static: $(STATIC_OBJS) $(OTHEROBJS) $(GUEST_OBJS) $(E) " LINK " $@ - $(Q) $(CC) -static $(CFLAGS) $(STATIC_OBJS) $(OTHEROBJS) $(GUEST_OBJS) $(LIBS) $(LIBS_STATOPT) -o $@ + $(Q) $(CC) -static $(CFLAGS) $^ $(LIBS) $(LIBS_STATOPT) -o $@ -$(PROGRAM): $(OBJS) $(OBJS_DYNOPT) $(OTHEROBJS) $(GUEST_INIT) +$(PROGRAM): $(OBJS) $(OBJS_DYNOPT) $(OTHEROBJS) $(GUEST_OBJS) $(E) " LINK " $@ - $(Q) $(CC) $(CFLAGS) $(OBJS) $(OBJS_DYNOPT) $(OTHEROBJS) $(GUEST_OBJS) $(LIBS) $(LIBS_DYNOPT) -o $@ + $(Q) $(CC) $(CFLAGS) $^ $(LIBS) $(LIBS_DYNOPT) -o $@ $(PROGRAM_ALIAS): $(PROGRAM) $(E) " LN " $@ - $(Q) ln -f $(PROGRAM) $@ + $(Q) ln -f $< $@ -$(GUEST_INIT): guest/init.c +$(GUEST_OBJS): $(GUEST_INIT) $(E) " LINK " $@ - $(Q) $(CC) -static guest/init.c -o $@ - $(Q) $(LD) $(LDFLAGS) -r -b binary -o guest/guest_init.o $(GUEST_INIT) + $(Q) $(LD) $(LDFLAGS) -r -b binary -o $@ $< + +$(GUEST_INIT): guest/init.c + $(E) " CC " $@ + $(Q) $(CC) -static $^ -o $@ %.s: %.c $(Q) $(CC) -o $@ -S $(CFLAGS) -fverbose-asm $< -- 2.3.5