hypervisor: Makefile: let OBJS target depend on VERSION file

Let OBJS target depend on VERSION file instead of other targets like
install/all depending on it, since the version.h is being included in
.c files.

This fixes a following compilation issue:
| In file included from include/hv_debug.h:10,
|                  from include/hypervisor.h:37,
|                  from arch/x86/cpu.c:7:
| arch/x86/cpu.c: In function 'bsp_boot_post':
| arch/x86/cpu.c:453:4: error: 'HV_FULL_VERSION' undeclared...

Tracked-On: #1441
Signed-off-by: Ming Liu <liu.ming50@gmail.com>
This commit is contained in:
Ming Liu 2018-10-11 16:16:31 +02:00 committed by wenlingz
parent c6c1e42b79
commit a0fb1c4cf3

View File

@ -225,8 +225,7 @@ DISTCLEAN_OBJS := $(shell find $(BASEDIR) -name '*.o')
VERSION := $(HV_OBJDIR)/include/version.h
.PHONY: all
all: $(VERSION) $(HV_OBJDIR)/$(HV_FILE).32.out $(HV_OBJDIR)/$(HV_FILE).bin
rm -f $(VERSION)
all: $(HV_OBJDIR)/$(HV_FILE).32.out $(HV_OBJDIR)/$(HV_FILE).bin
ifeq ($(CONFIG_PLATFORM), uefi)
all: efi
@ -240,7 +239,7 @@ install: efi
endif
ifeq ($(CONFIG_PLATFORM), sbl)
install: $(VERSION) $(HV_OBJDIR)/$(HV_FILE).32.out
install: $(HV_OBJDIR)/$(HV_FILE).32.out
install -D $(HV_OBJDIR)/$(HV_FILE).32.out $(DESTDIR)/usr/lib/acrn/$(HV_FILE).sbl
endif
@ -299,7 +298,7 @@ $(VERSION):
-include $(C_OBJS:.o=.d)
-include $(S_OBJS:.o=.d)
$(HV_OBJDIR)/%.o: %.c $(HV_OBJDIR)/$(HV_CONFIG_H)
$(HV_OBJDIR)/%.o: %.c $(VERSION) $(HV_OBJDIR)/$(HV_CONFIG_H)
[ ! -e $@ ] && mkdir -p $(dir $@); \
$(CC) $(patsubst %, -I%, $(INCLUDE_PATH)) -I. -c $(CFLAGS) $(ARCH_CFLAGS) $< -o $@ -MMD -MT $@