From 4c06834bdf22cf2ce6e0fa6e05ff94e8c916382a Mon Sep 17 00:00:00 2001 From: Martin Kinkelin Date: Tue, 12 Dec 2023 00:57:55 +0100 Subject: [PATCH] Top-level Makefile: Extract {dmd,druntime}[-test] targets For convenience, and to make the compiler build triggered from druntime/posix.mak more robust. --- Makefile | 31 +++++++++++++++++++++++-------- druntime/posix.mak | 5 ++--- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 8958d80303..d56f1ba98b 100644 --- a/Makefile +++ b/Makefile @@ -29,13 +29,12 @@ GENERATED=generated BUILD_EXE=$(GENERATED)/build$(EXE) RUN_EXE=$(GENERATED)/run$(EXE) -.PHONY: all clean test install auto-tester-build auto-tester-test toolchain-info +.PHONY: all clean test html install \ + dmd dmd-test druntime druntime-test \ + auto-tester-build auto-tester-test buildkite-test \ + toolchain-info check-clean-git style -all: $(BUILD_EXE) - $(BUILD_EXE) dmd -ifneq (windows,$(OS)) - $(QUIET)$(MAKE) -C druntime -f posix.mak target -endif +all: dmd druntime $(BUILD_EXE): compiler/src/build.d $(HOST_DMD) -of$@ -g $< @@ -62,13 +61,29 @@ ifneq (windows,$(OS)) $(QUIET)$(MAKE) -C druntime -f posix.mak clean endif -test: all $(BUILD_EXE) $(RUN_EXE) +dmd: $(BUILD_EXE) + $(BUILD_EXE) $@ + +dmd-test: dmd druntime $(BUILD_EXE) $(RUN_EXE) $(BUILD_EXE) unittest $(RUN_EXE) --environment -ifneq (windows,$(OS)) + +druntime: dmd +ifeq (windows,$(OS)) + @echo "Building druntime via top-level Makefile on Windows will come soon" +else + $(QUIET)$(MAKE) -C druntime -f posix.mak +endif + +druntime-test: dmd +ifeq (windows,$(OS)) + @echo "Testing druntime via top-level Makefile on Windows will come soon" +else $(QUIET)$(MAKE) -C druntime -f posix.mak unittest endif +test: dmd-test druntime-test + html: $(BUILD_EXE) $(BUILD_EXE) $@ diff --git a/druntime/posix.mak b/druntime/posix.mak index 28023dadc8..b98173dc30 100644 --- a/druntime/posix.mak +++ b/druntime/posix.mak @@ -350,9 +350,8 @@ $(IMPDIR)/%.h : src/%.h ######################## Build DMD if non-existent ############################## -$(DMD): - $(MAKE) -C .. generated/build DMD="" - ../generated/build dmd BUILD=$(BUILD) OS=$(OS) MODEL=$(MODEL) +$(DMD_DIR)/../generated/$(OS)/$(BUILD)/$(MODEL)/dmd: + $(MAKE) -C $(DMD_DIR)/.. dmd BUILD=$(BUILD) OS=$(OS) MODEL=$(MODEL) DMD="" ################### C/ASM Targets ############################