From a335679ce9df8b673fd8f4e1073067d61be3f94a Mon Sep 17 00:00:00 2001 From: Minggui Cao Date: Thu, 7 May 2020 16:40:52 +0800 Subject: [PATCH] Makefile: remove 'clean' when building HV/DM 1. not need 'clean' when building ACRN-HV/DM each time 2. correct efi-stub wrong dependency Tracked-On: #2412 Signed-off-by: Minggui Cao Reviewed-by: Binbin Wu --- Makefile | 2 -- devicemodel/Makefile | 4 +++- misc/efi-stub/Makefile | 23 +++++++++++++---------- 3 files changed, 16 insertions(+), 13 deletions(-) mode change 100644 => 100755 devicemodel/Makefile diff --git a/Makefile b/Makefile index da05aa3f1..7dbc6820c 100644 --- a/Makefile +++ b/Makefile @@ -160,7 +160,6 @@ hypervisor: @if [ "$(BOARD_FILE)" != "" ] && [ -f $(BOARD_FILE) ] && [ "$(SCENARIO_FILE)" != "" ] && [ -f $(SCENARIO_FILE) ] && [ "$(TARGET_DIR)" = "" ]; then \ echo "No TARGET_DIR parameter is specified, the original configuration source is overwritten!";\ fi - $(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT) BOARD_FILE=$(BOARD_FILE) SCENARIO_FILE=$(SCENARIO_FILE) clean; $(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT) BOARD_FILE=$(BOARD_FILE) SCENARIO_FILE=$(SCENARIO_FILE) TARGET_DIR=$(abspath $(TARGET_DIR)) defconfig; $(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT) BOARD_FILE=$(BOARD_FILE) SCENARIO_FILE=$(SCENARIO_FILE) TARGET_DIR=$(abspath $(TARGET_DIR)) oldconfig; $(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT) BOARD_FILE=$(BOARD_FILE) SCENARIO_FILE=$(SCENARIO_FILE) TARGET_DIR=$(abspath $(TARGET_DIR)) @@ -198,7 +197,6 @@ hypervisor: @cat $(HV_CFG_LOG) devicemodel: tools - $(MAKE) -C $(T)/devicemodel DM_OBJDIR=$(DM_OUT) RELEASE=$(RELEASE) clean $(MAKE) -C $(T)/devicemodel DM_OBJDIR=$(DM_OUT) DM_BUILD_VERSION=$(BUILD_VERSION) DM_BUILD_TAG=$(BUILD_TAG) DM_ASL_COMPILER=$(ASL_COMPILER) RELEASE=$(RELEASE) tools: diff --git a/devicemodel/Makefile b/devicemodel/Makefile old mode 100644 new mode 100755 index 7213642ad..8f5b97c50 --- a/devicemodel/Makefile +++ b/devicemodel/Makefile @@ -221,9 +221,11 @@ $(VERSION_H): echo "#define DM_BUILD_TIME "\""$$TIME"\""" >> $(VERSION_H);\ echo "#define DM_BUILD_USER "\""$$USER"\""" >> $(VERSION_H) +-include $(OBJS:.o=.d) + $(DM_OBJDIR)/%.o: %.c $(HEADERS) [ ! -e $@ ] && mkdir -p $(dir $@); \ - $(CC) $(CFLAGS) -c $< -o $@ + $(CC) $(CFLAGS) -c $< -o $@ -MMD -MT $@ install: $(DM_OBJDIR)/$(PROGRAM) install-samples-nuc install-samples-mrb install-bios install-samples-up2 install -D --mode=0755 $(DM_OBJDIR)/$(PROGRAM) $(DESTDIR)/usr/bin/$(PROGRAM) diff --git a/misc/efi-stub/Makefile b/misc/efi-stub/Makefile index 678056e22..f76e9d816 100644 --- a/misc/efi-stub/Makefile +++ b/misc/efi-stub/Makefile @@ -88,11 +88,11 @@ LDFLAGS=-T $(LDSCRIPT) -Bsymbolic -shared -nostdlib -znocombreloc \ -L$(LIBDIR) $(CRT0) EFIBIN=$(HV_OBJDIR)/$(HV_FILE).efi BOOT=$(EFI_OBJDIR)/boot.efi +HV_BIN=$(HV_OBJDIR)/$(HV_FILE).bin CONF_FILE=$(CURDIR)/clearlinux/acrn.conf all: $(EFIBIN) - $(OBJCOPY) --add-section .hv="$(HV_OBJDIR)/$(HV_FILE).bin" --change-section-vma .hv=0x6e000 --set-section-flags .hv=alloc,data,contents,load --section-alignment 0x1000 $(EFI_OBJDIR)/boot.efi $(EFIBIN) install: $(EFIBIN) install-conf install -D $(EFIBIN) $(DESTDIR)/usr/lib/acrn/$(HV_FILE).$(BOARD).$(SCENARIO).efi @@ -101,26 +101,29 @@ install-debug: $(HV_OBJDIR)/$(HV_FILE).map $(HV_OBJDIR)/$(HV_FILE).out install -D $(HV_OBJDIR)/$(HV_FILE).out $(DESTDIR)/usr/lib/acrn/$(HV_FILE).$(BOARD).$(SCENARIO).efi.out install -D $(HV_OBJDIR)/$(HV_FILE).map $(DESTDIR)/usr/lib/acrn/$(HV_FILE).$(BOARD).$(SCENARIO).efi.map -$(EFIBIN): $(BOOT) +$(EFIBIN): $(BOOT) $(HV_BIN) + $(OBJCOPY) --add-section .hv="$(HV_BIN)" --change-section-vma .hv=0x6e000 --set-section-flags .hv=alloc,data,contents,load --section-alignment 0x1000 $(BOOT) $(EFIBIN) -$(EFI_OBJDIR)/boot.efi: $(EFI_OBJDIR)/boot.so +$(BOOT): $(EFI_OBJDIR)/boot.so -$(EFI_OBJDIR)/boot.so: $(ACRN_OBJS) $(FS) +$(EFI_OBJDIR)/boot.so: $(ACRN_OBJS) $(LD) $(LDFLAGS) -o $@ $^ -lgnuefi -lefi $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) install-conf: $(CONF_FILE) install -D --mode=0644 $^ $(DESTDIR)/usr/share/acrn/samples/nuc/acrn.conf clean: - rm -f $(BOOT) $(HV_OBJDIR)/$(HV_FILE).efi $(EFI_OBJDIR)/boot.so $(ACRN_OBJS) $(FS) + rm -f $(BOOT) $(HV_OBJDIR)/$(HV_FILE).efi $(EFI_OBJDIR)/boot.so $(ACRN_OBJS) -$(EFI_OBJDIR)/%.o:%.S $(HV_OBJDIR)/$(HV_CONFIG_H) - [ ! -e $@ ] && mkdir -p $(dir $@); \ - $(CC) $(CFLAGS) -c -o $@ $< +-include $(ACRN_OBJS:.o=.d) -$(EFI_OBJDIR)/%.o: %.c $(HV_OBJDIR)/$(HV_CONFIG_H) +$(EFI_OBJDIR)/%.o:%.S [ ! -e $@ ] && mkdir -p $(dir $@); \ - $(CC) $(patsubst %, -I%, $(INCLUDE_PATH)) -I. -c $(CFLAGS) $(ARCH_CFLAGS) $< -o $@ + $(CC) $(CFLAGS) -c -o $@ $< -MMD -MT $@ + +$(EFI_OBJDIR)/%.o: %.c + [ ! -e $@ ] && mkdir -p $(dir $@); \ + $(CC) $(patsubst %, -I%, $(INCLUDE_PATH)) -I. -c $(CFLAGS) $(ARCH_CFLAGS) $< -o $@ -MMD -MT $@ %.efi: %.so $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \