From d5314b1ffe4d5624c76a5328f9119f577f60764e Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Thu, 26 Jun 2014 12:28:18 +0100 Subject: [PATCH] mini-os: build fixes Make .o rules depend on the includes. Before, only the final link step depended on setting up the includes directory, making parallel builds unreliable. Make symlinks use explicit make rules instead of using a phony target. Avoids unnecessary rebuilds. [talex5@gmail.com: bring back "make links", for stubdom] Signed-off-by: Thomas Leonard Acked-by: Ian Campbell Acked-by: Samuel Thibault --- Makefile | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 50d038b..6d6537e 100644 --- a/Makefile +++ b/Makefile @@ -50,6 +50,11 @@ flags-$(CONFIG_XENBUS) += -DCONFIG_XENBUS DEF_CFLAGS += $(flags-y) +# Symlinks and headers that must be created before building the C files +GENERATED_HEADERS := include/list.h $(ARCH_LINKS) include/mini-os include/xen include/$(TARGET_ARCH_FAM)/mini-os + +EXTRA_DEPS += $(GENERATED_HEADERS) + # Include common mini-os makerules. include minios.mk @@ -124,11 +129,18 @@ include/list.h: $(XEN_ROOT)/tools/include/xen-external/bsd-sys-queue-h-seddery $ perl $^ --prefix=minios >$@.new $(call move-if-changed,$@.new,$@) +# Used by stubdom's Makefile .PHONY: links -links: include/list.h $(ARCH_LINKS) - [ -e include/xen ] || ln -sf ../../../xen/include/public include/xen - [ -e include/mini-os ] || ln -sf . include/mini-os - [ -e include/$(TARGET_ARCH_FAM)/mini-os ] || ln -sf . include/$(TARGET_ARCH_FAM)/mini-os +links: $(GENERATED_HEADERS) + +include/xen: + ln -sf ../../../xen/include/public $@ + +include/mini-os: + ln -sf . $@ + +include/$(TARGET_ARCH_FAM)/mini-os: + ln -sf . $@ .PHONY: arch_lib arch_lib: @@ -174,7 +186,7 @@ ifneq ($(APP_OBJS),) APP_O=$(OBJ_DIR)/$(TARGET)_app.o endif -$(OBJ_DIR)/$(TARGET): links include/list.h $(OBJS) $(APP_O) arch_lib +$(OBJ_DIR)/$(TARGET): $(OBJS) $(APP_O) arch_lib $(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(APP_O) $(OBJS) $(LDARCHLIB) $(LDLIBS) -o $@.o $(OBJCOPY) -w -G $(GLOBAL_PREFIX)* -G _start $@.o $@.o $(LD) $(LDFLAGS) $(LDFLAGS_FINAL) $@.o $(EXTRA_OBJS) -o $@ @@ -212,4 +224,3 @@ tags: .PHONY: TAGS TAGS: $(all_sources) | xargs etags - -- 2.39.5