Skip to content

Commit a0fb1c4

Browse files
liuming50wenlingz
authored andcommitted
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>
1 parent c6c1e42 commit a0fb1c4

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

hypervisor/Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,7 @@ DISTCLEAN_OBJS := $(shell find $(BASEDIR) -name '*.o')
225225
VERSION := $(HV_OBJDIR)/include/version.h
226226

227227
.PHONY: all
228-
all: $(VERSION) $(HV_OBJDIR)/$(HV_FILE).32.out $(HV_OBJDIR)/$(HV_FILE).bin
229-
rm -f $(VERSION)
228+
all: $(HV_OBJDIR)/$(HV_FILE).32.out $(HV_OBJDIR)/$(HV_FILE).bin
230229

231230
ifeq ($(CONFIG_PLATFORM), uefi)
232231
all: efi
@@ -240,7 +239,7 @@ install: efi
240239
endif
241240

242241
ifeq ($(CONFIG_PLATFORM), sbl)
243-
install: $(VERSION) $(HV_OBJDIR)/$(HV_FILE).32.out
242+
install: $(HV_OBJDIR)/$(HV_FILE).32.out
244243
install -D $(HV_OBJDIR)/$(HV_FILE).32.out $(DESTDIR)/usr/lib/acrn/$(HV_FILE).sbl
245244
endif
246245

@@ -299,7 +298,7 @@ $(VERSION):
299298
-include $(C_OBJS:.o=.d)
300299
-include $(S_OBJS:.o=.d)
301300

302-
$(HV_OBJDIR)/%.o: %.c $(HV_OBJDIR)/$(HV_CONFIG_H)
301+
$(HV_OBJDIR)/%.o: %.c $(VERSION) $(HV_OBJDIR)/$(HV_CONFIG_H)
303302
[ ! -e $@ ] && mkdir -p $(dir $@); \
304303
$(CC) $(patsubst %, -I%, $(INCLUDE_PATH)) -I. -c $(CFLAGS) $(ARCH_CFLAGS) $< -o $@ -MMD -MT $@
305304

0 commit comments

Comments
 (0)