aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2017-08-29 17:33:33 +0100
committerWill Deacon <will.deacon@arm.com>2017-08-30 09:46:46 +0100
commit23a9388e9f20d81a3752b78f698f542cb6338a10 (patch)
tree711c7f038bb34845e8e7b193b8249136fd6953e4
parent59ee54eb10d78c2411795f89ad44459ee7a11425 (diff)
downloadkvmtool-23a9388e9f20d81a3752b78f698f542cb6338a10.tar.gz
Makefile: properly express guest_init dependency
So far the generation of the guest_init binaries is not properly modelled in the Makefile: the intermediate object files are not targets. This leads to failures when those files get deleted. So (also in preperation for the upcoming rework) rework the dependency chain to have those intermediate files covered as well, which involves splitting the generation into two steps. On the way use automatic variables where applicable and remove the explicit listing of the guest_init targets, which are now covered by the final $(GUEST_OBJS) targets. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r--Makefile24
1 files changed, 15 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 57714815..8b6326b7 100644
--- a/Makefile
+++ b/Makefile
@@ -358,7 +358,7 @@ ifneq ($(WERROR),0)
CFLAGS += -Werror
endif
-all: $(PROGRAM) $(PROGRAM_ALIAS) $(GUEST_INIT) $(GUEST_PRE_INIT)
+all: $(PROGRAM) $(PROGRAM_ALIAS)
# CFLAGS used when building objects
# This is intentionally not assigned using :=
@@ -375,11 +375,11 @@ STATIC_OBJS = $(patsubst %.o,%.static.o,$(OBJS) $(OBJS_STATOPT))
STATIC_DEPS := $(foreach obj,$(STATIC_OBJS),\
$(subst $(comma),_,$(dir $(obj)).$(notdir $(obj)).d))
-$(PROGRAM)-static: $(STATIC_OBJS) $(OTHEROBJS) $(GUEST_INIT) $(GUEST_PRE_INIT)
+$(PROGRAM)-static: $(STATIC_OBJS) $(OTHEROBJS) $(GUEST_OBJS)
$(E) " LINK " $@
$(Q) $(CC) -static $(CFLAGS) $(STATIC_OBJS) $(OTHEROBJS) $(GUEST_OBJS) $(LDFLAGS) $(LIBS) $(LIBS_STATOPT) -o $@
-$(PROGRAM): $(OBJS) $(OBJS_DYNOPT) $(OTHEROBJS) $(GUEST_INIT) $(GUEST_PRE_INIT)
+$(PROGRAM): $(OBJS) $(OBJS_DYNOPT) $(OTHEROBJS) $(GUEST_OBJS)
$(E) " LINK " $@
$(Q) $(CC) $(CFLAGS) $(OBJS) $(OBJS_DYNOPT) $(OTHEROBJS) $(GUEST_OBJS) $(LDFLAGS) $(LIBS) $(LIBS_DYNOPT) -o $@
@@ -389,15 +389,21 @@ $(PROGRAM_ALIAS): $(PROGRAM)
ifneq ($(ARCH_PRE_INIT),)
$(GUEST_PRE_INIT): $(ARCH_PRE_INIT)
- $(E) " LINK " $@
- $(Q) $(CC) -s $(PIE_FLAGS) -nostdlib $(ARCH_PRE_INIT) -o $@
- $(Q) $(LD) -r -b binary -o guest/guest_pre_init.o $(GUEST_PRE_INIT)
+ $(E) " COMPILE " $@
+ $(Q) $(CC) -s $(PIE_FLAGS) -nostdlib $< -o $@
+
+guest/guest_pre_init.o: $(GUEST_PRE_INIT)
+ $(E) " CONVERT " $@
+ $(Q) $(LD) -r -b binary -o $@ $<
endif
$(GUEST_INIT): guest/init.c
- $(E) " LINK " $@
- $(Q) $(CC) $(GUEST_INIT_FLAGS) guest/init.c -o $@
- $(Q) $(LD) -r -b binary -o guest/guest_init.o $(GUEST_INIT)
+ $(E) " COMPILE " $@
+ $(Q) $(CC) $(GUEST_INIT_FLAGS) $< -o $@
+
+guest/guest_init.o: $(GUEST_INIT)
+ $(E) " CONVERT " $@
+ $(Q) $(LD) -r -b binary -o $@ $<
%.s: %.c
$(Q) $(CC) -o $@ -S $(CFLAGS) -fverbose-asm $<