From 0b121c794b009b6a7b37c56f98558b2757fc1b80 Mon Sep 17 00:00:00 2001 From: Razvan Nitu Date: Wed, 12 Jan 2022 17:54:53 +0200 Subject: [PATCH] Add dmd-as-a-library submodule (#2) --- .gitmodules | 3 +++ dmd | 1 + makefile | 47 ++++++++++++++++++++++++++++++++++++----------- 3 files changed, 40 insertions(+), 11 deletions(-) create mode 160000 dmd diff --git a/.gitmodules b/.gitmodules index 12d4fee..52ede99 100644 --- a/.gitmodules +++ b/.gitmodules @@ -17,3 +17,6 @@ [submodule "DCD"] path = DCD url = https://github.com/dlang-community/DCD.git +[submodule "dmd"] + path = dmd + url = git@github.com:dlang/dmd.git diff --git a/dmd b/dmd new file mode 160000 index 0000000..ae62618 --- /dev/null +++ b/dmd @@ -0,0 +1 @@ +Subproject commit ae6261888e10e8072033369a9bce60d7be31ab1c diff --git a/makefile b/makefile index 4d6dced..c9ee792 100644 --- a/makefile +++ b/makefile @@ -5,6 +5,31 @@ GIT ?= git DMD := $(DC) GDC := gdc LDC := ldc2 +DMD_ROOT_SRC := \ + $(shell find dmd/src/dmd/common -name "*.d")\ + $(shell find dmd/src/dmd/root -name "*.d") +DMD_LEXER_SRC := \ + dmd/src/dmd/console.d \ + dmd/src/dmd/entity.d \ + dmd/src/dmd/errors.d \ + dmd/src/dmd/file_manager.d \ + dmd/src/dmd/globals.d \ + dmd/src/dmd/id.d \ + dmd/src/dmd/identifier.d \ + dmd/src/dmd/lexer.d \ + dmd/src/dmd/tokens.d \ + dmd/src/dmd/utils.d \ + $(DMD_ROOT_SRC) + +DMD_PARSER_SRC := \ + dmd/src/dmd/astbase.d \ + dmd/src/dmd/parse.d \ + dmd/src/dmd/parsetimevisitor.d \ + dmd/src/dmd/transitivevisitor.d \ + dmd/src/dmd/permissivevisitor.d \ + dmd/src/dmd/strictvisitor.d \ + dmd/src/dmd/astenums.d \ + $(DMD_LEXER_SRC) LIB_SRC := \ $(shell find containers/src -name "*.d")\ @@ -13,7 +38,8 @@ LIB_SRC := \ $(shell find libdparse/src/std/experimental/ -name "*.d")\ $(shell find libdparse/src/dparse/ -name "*.d")\ $(shell find libddoc/src -name "*.d") \ - $(shell find libddoc/common/source -name "*.d") + $(shell find libddoc/common/source -name "*.d") \ + $(DMD_PARSER_SRC) PROJECT_SRC := $(shell find src/ -name "*.d") SRC := $(LIB_SRC) $(PROJECT_SRC) @@ -42,29 +68,27 @@ INCLUDE_PATHS = \ -IDCD/dsymbol/src \ -Icontainers/src \ -Ilibddoc/src \ - -Ilibddoc/common/source + -Ilibddoc/common/source \ + -Idmd/src -# e.g. "-version=MyCustomVersion" -DMD_VERSIONS = +DMD_VERSIONS = -version=StdLoggerDisableWarning -version=CallbackAPI -version=DMDLIB DMD_DEBUG_VERSIONS = -version=dparse_verbose -# e.g. "-d-version=MyCustomVersion" -LDC_VERSIONS = +LDC_VERSIONS = -d-version=StdLoggerDisableWarning -d-version=CallbackAPI -d-version=DMDLIB LDC_DEBUG_VERSIONS = -d-version=dparse_verbose -# e.g. "-fversion=MyCustomVersion" -GDC_VERSIONS = +GDC_VERSIONS = -fversion=StdLoggerDisableWarning -fversion=CallbackAPI -fversion=DMDLIB GDC_DEBUG_VERSIONS = -fversion=dparse_verbose -DC_FLAGS += -Jbin +DC_FLAGS += -Jbin -Jdmd override DMD_FLAGS += $(DFLAGS) -w -release -O -od${OBJ_DIR} override LDC_FLAGS += $(DFLAGS) -O5 -release -oq override GDC_FLAGS += $(DFLAGS) -O3 -frelease -fall-instantiations override GDC_TEST_FLAGS += -fall-instantiations -DC_TEST_FLAGS += -g -Jbin +DC_TEST_FLAGS += -g -Jbin -Jdmd override DMD_TEST_FLAGS += -w -DC_DEBUG_FLAGS := -g -Jbin +DC_DEBUG_FLAGS := -g -Jbin -Jdmd ifeq ($(DC), $(filter $(DC), dmd ldmd2 gdmd)) VERSIONS := $(DMD_VERSIONS) @@ -85,6 +109,7 @@ else ifneq (,$(findstring gdc, $(DC))) DC_TEST_FLAGS += $(GDC_TEST_FLAGS) -funittest WRITE_TO_TARGET_NAME = -o $@ endif +SHELL:=/usr/bin/env bash GITHASH = bin/githash.txt