mirror of
https://github.com/dlang/tools.git
synced 2025-04-25 20:51:00 +03:00
Merge Makefiles
This commit is contained in:
parent
899190ea00
commit
fae32c873b
4 changed files with 44 additions and 226 deletions
|
@ -1,7 +1,6 @@
|
||||||
DMD_DIR = ../dmd
|
DMD_DIR = ../dmd
|
||||||
BUILD = release
|
BUILD = release
|
||||||
DMD = $(DMD_DIR)/generated/$(OS)/$(BUILD)/$(MODEL)/dmd
|
DMD = $(DMD_DIR)/generated/$(OS)/$(BUILD)/$(MODEL)/dmd
|
||||||
CC = gcc
|
|
||||||
INSTALL_DIR = ../install
|
INSTALL_DIR = ../install
|
||||||
DRUNTIME_PATH = ../dmd/druntime
|
DRUNTIME_PATH = ../dmd/druntime
|
||||||
PHOBOS_PATH = ../phobos
|
PHOBOS_PATH = ../phobos
|
||||||
|
@ -12,72 +11,63 @@ DOC = ../dlang.org
|
||||||
|
|
||||||
# Load operating system $(OS) (e.g. linux, osx, ...) and $(MODEL) (e.g. 32, 64) detection Makefile from dmd
|
# Load operating system $(OS) (e.g. linux, osx, ...) and $(MODEL) (e.g. 32, 64) detection Makefile from dmd
|
||||||
$(shell [ ! -d $(DMD_DIR) ] && git clone --depth=1 https://github.com/dlang/dmd $(DMD_DIR))
|
$(shell [ ! -d $(DMD_DIR) ] && git clone --depth=1 https://github.com/dlang/dmd $(DMD_DIR))
|
||||||
include $(DMD_DIR)/src/osmodel.mak
|
include $(DMD_DIR)/compiler/src/osmodel.mak
|
||||||
|
|
||||||
|
ifeq (windows,$(OS))
|
||||||
|
DOTEXE:=.exe
|
||||||
|
else
|
||||||
|
DOTEXE:=
|
||||||
|
endif
|
||||||
|
|
||||||
# Build folder for all binaries
|
# Build folder for all binaries
|
||||||
GENERATED = generated
|
GENERATED = generated
|
||||||
ROOT = $(GENERATED)/$(OS)/$(MODEL)
|
ROOT = $(GENERATED)/$(OS)/$(MODEL)
|
||||||
|
|
||||||
# Set DRUNTIME name and full path
|
# default to warnings and deprecations as errors, override via e.g. make WARNINGS=-wi
|
||||||
ifeq (,$(findstring win,$(OS)))
|
|
||||||
DRUNTIME = $(DRUNTIME_PATH)/lib/libdruntime-$(OS)$(MODEL).a
|
|
||||||
DRUNTIMESO = $(DRUNTIME_PATH)/lib/libdruntime-$(OS)$(MODEL)so.a
|
|
||||||
else
|
|
||||||
DRUNTIME = $(DRUNTIME_PATH)/lib/druntime.lib
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Set PHOBOS name and full path
|
|
||||||
ifeq (,$(findstring win,$(OS)))
|
|
||||||
PHOBOS = $(PHOBOS_PATH)/generated/$(OS)/$(BUILD)/$(MODEL)/libphobos2.a
|
|
||||||
PHOBOSSO = $(PHOBOS_PATH)/generated/$(OS)/$(BUILD)/$(MODEL)/libphobos2.so
|
|
||||||
endif
|
|
||||||
|
|
||||||
# default to warnings and deprecations as errors, override via e.g. make -f posix.mak WARNINGS=-wi
|
|
||||||
WARNINGS = -w -de
|
WARNINGS = -w -de
|
||||||
# default include/link paths, override by setting DFLAGS (e.g. make -f posix.mak DFLAGS=-I/foo)
|
# default flags, override by setting DFLAGS (e.g. make DFLAGS=-O)
|
||||||
DFLAGS = -I$(DRUNTIME_PATH)/import -I$(PHOBOS_PATH) \
|
DFLAGS = $(MODEL_FLAG) $(if $(findstring windows,$(OS)),,-fPIC) -preview=dip1000
|
||||||
-L-L$(PHOBOS_PATH)/generated/$(OS)/$(BUILD)/$(MODEL) $(MODEL_FLAG) -fPIC -preview=dip1000
|
|
||||||
DFLAGS += $(WARNINGS)
|
DFLAGS += $(WARNINGS)
|
||||||
|
|
||||||
# Default DUB flags (DUB uses a different architecture format)
|
# Default DUB flags (DUB uses a different architecture format)
|
||||||
DUBFLAGS = --arch=$(subst 32,x86,$(subst 64,x86_64,$(MODEL)))
|
DUBFLAGS = --arch=$(subst 32,x86,$(subst 64,x86_64,$(MODEL)))
|
||||||
|
|
||||||
TOOLS = \
|
TOOLS = \
|
||||||
$(ROOT)/catdoc \
|
$(ROOT)/catdoc$(DOTEXE) \
|
||||||
$(ROOT)/checkwhitespace \
|
$(ROOT)/checkwhitespace$(DOTEXE) \
|
||||||
$(ROOT)/contributors \
|
$(ROOT)/contributors$(DOTEXE) \
|
||||||
$(ROOT)/ddemangle \
|
$(ROOT)/ddemangle$(DOTEXE) \
|
||||||
$(ROOT)/detab \
|
$(ROOT)/detab$(DOTEXE) \
|
||||||
$(ROOT)/rdmd \
|
$(ROOT)/rdmd$(DOTEXE) \
|
||||||
$(ROOT)/tolf \
|
$(ROOT)/tolf$(DOTEXE) \
|
||||||
$(ROOT)/updatecopyright
|
$(ROOT)/updatecopyright$(DOTEXE)
|
||||||
|
|
||||||
CURL_TOOLS = \
|
CURL_TOOLS = \
|
||||||
$(ROOT)/changed \
|
$(ROOT)/changed$(DOTEXE) \
|
||||||
$(ROOT)/dget
|
$(ROOT)/dget$(DOTEXE)
|
||||||
|
|
||||||
DOC_TOOLS = \
|
DOC_TOOLS = \
|
||||||
$(ROOT)/dman
|
$(ROOT)/dman$(DOTEXE)
|
||||||
|
|
||||||
TEST_TOOLS = \
|
TEST_TOOLS = \
|
||||||
$(ROOT)/rdmd_test
|
$(ROOT)/rdmd_test$(DOTEXE)
|
||||||
|
|
||||||
all: $(TOOLS) $(CURL_TOOLS) $(ROOT)/dustmite
|
all: $(TOOLS) $(CURL_TOOLS) $(ROOT)/dustmite$(DOTEXE)
|
||||||
|
|
||||||
rdmd: $(ROOT)/rdmd
|
rdmd: $(ROOT)/rdmd$(DOTEXE)
|
||||||
ddemangle: $(ROOT)/ddemangle
|
ddemangle: $(ROOT)/ddemangle$(DOTEXE)
|
||||||
catdoc: $(ROOT)/catdoc
|
catdoc: $(ROOT)/catdoc$(DOTEXE)
|
||||||
detab: $(ROOT)/detab
|
detab: $(ROOT)/detab$(DOTEXE)
|
||||||
tolf: $(ROOT)/tolf
|
tolf: $(ROOT)/tolf$(DOTEXE)
|
||||||
dget: $(ROOT)/dget
|
dget: $(ROOT)/dget$(DOTEXE)
|
||||||
changed: $(ROOT)/changed
|
changed: $(ROOT)/changed$(DOTEXE)
|
||||||
dman: $(ROOT)/dman
|
dman: $(ROOT)/dman$(DOTEXE)
|
||||||
dustmite: $(ROOT)/dustmite
|
dustmite: $(ROOT)/dustmite$(DOTEXE)
|
||||||
|
|
||||||
$(ROOT)/dustmite: DustMite/dustmite.d DustMite/splitter.d DustMite/polyhash.d
|
$(ROOT)/dustmite$(DOTEXE): DustMite/dustmite.d DustMite/splitter.d DustMite/polyhash.d
|
||||||
$(DMD) $(DFLAGS) -version=Dlang_Tools DustMite/dustmite.d DustMite/splitter.d DustMite/polyhash.d -of$(@)
|
$(DMD) $(DFLAGS) -version=Dlang_Tools DustMite/dustmite.d DustMite/splitter.d DustMite/polyhash.d -of$(@)
|
||||||
|
|
||||||
$(TOOLS) $(DOC_TOOLS) $(CURL_TOOLS) $(TEST_TOOLS): $(ROOT)/%: %.d
|
$(TOOLS) $(DOC_TOOLS) $(CURL_TOOLS) $(TEST_TOOLS): $(ROOT)/%$(DOTEXE): %.d
|
||||||
$(DMD) $(DFLAGS) -of$(@) $(<)
|
$(DMD) $(DFLAGS) -of$(@) $(<)
|
||||||
|
|
||||||
d-tags.json:
|
d-tags.json:
|
||||||
|
@ -87,27 +77,27 @@ d-tags.json:
|
||||||
@echo " make -C ../dlang.org -f posix.mak d-tags-prerelease.json && cp ../dlang.org/d-tags-prerelease.json d-tags.json"
|
@echo " make -C ../dlang.org -f posix.mak d-tags-prerelease.json && cp ../dlang.org/d-tags-prerelease.json d-tags.json"
|
||||||
@exit 1
|
@exit 1
|
||||||
|
|
||||||
$(ROOT)/dman: d-tags.json
|
$(ROOT)/dman$(DOTEXE): d-tags.json
|
||||||
$(ROOT)/dman: override DFLAGS += -J.
|
$(ROOT)/dman$(DOTEXE): override DFLAGS += -J.
|
||||||
|
|
||||||
install: $(TOOLS) $(CURL_TOOLS) $(ROOT)/dustmite
|
install: $(TOOLS) $(CURL_TOOLS) $(ROOT)/dustmite$(DOTEXE)
|
||||||
mkdir -p $(INSTALL_DIR)/bin
|
mkdir -p $(INSTALL_DIR)/bin
|
||||||
cp $^ $(INSTALL_DIR)/bin
|
cp $^ $(INSTALL_DIR)/bin
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(GENERATED)
|
rm -rf $(GENERATED)
|
||||||
|
|
||||||
$(ROOT)/tests_extractor: tests_extractor.d
|
$(ROOT)/tests_extractor$(DOTEXE): tests_extractor.d
|
||||||
mkdir -p $(ROOT)
|
mkdir -p $(ROOT)
|
||||||
DFLAGS="$(DFLAGS)" $(DUB) build \
|
DFLAGS="$(DFLAGS)" $(DUB) build \
|
||||||
--single $< --force --compiler=$(DMD) $(DUBFLAGS) \
|
--single $< --force --compiler=$(DMD) $(DUBFLAGS) \
|
||||||
&& mv ./tests_extractor $@
|
&& mv ./tests_extractor$(DOTEXE) $@
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Build & run tests
|
# Build & run tests
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
test_tests_extractor: $(ROOT)/tests_extractor
|
test_tests_extractor: $(ROOT)/tests_extractor$(DOTEXE)
|
||||||
for file in ascii iteration ; do \
|
for file in ascii iteration ; do \
|
||||||
$< -i "./test/tests_extractor/$${file}.d" | diff -p - "./test/tests_extractor/$${file}.d.ext"; \
|
$< -i "./test/tests_extractor/$${file}.d" | diff -p - "./test/tests_extractor/$${file}.d.ext"; \
|
||||||
done
|
done
|
||||||
|
@ -115,7 +105,7 @@ test_tests_extractor: $(ROOT)/tests_extractor
|
||||||
$< --betterC -i "./test/tests_extractor/betterc.d" | diff -p - "./test/tests_extractor/betterc.d.ext";
|
$< --betterC -i "./test/tests_extractor/betterc.d" | diff -p - "./test/tests_extractor/betterc.d.ext";
|
||||||
|
|
||||||
RDMD_TEST_COMPILERS = $(DMD)
|
RDMD_TEST_COMPILERS = $(DMD)
|
||||||
RDMD_TEST_EXECUTABLE = $(ROOT)/rdmd
|
RDMD_TEST_EXECUTABLE = $(ROOT)/rdmd$(DOTEXE)
|
||||||
RDMD_TEST_DEFAULT_COMPILER = $(basename $(DMD))
|
RDMD_TEST_DEFAULT_COMPILER = $(basename $(DMD))
|
||||||
|
|
||||||
VERBOSE_RDMD_TEST=0
|
VERBOSE_RDMD_TEST=0
|
||||||
|
@ -123,8 +113,8 @@ ifeq ($(VERBOSE_RDMD_TEST), 1)
|
||||||
override VERBOSE_RDMD_TEST_FLAGS:=-v
|
override VERBOSE_RDMD_TEST_FLAGS:=-v
|
||||||
endif
|
endif
|
||||||
|
|
||||||
test_rdmd: $(ROOT)/rdmd_test $(RDMD_TEST_EXECUTABLE)
|
test_rdmd: $(ROOT)/rdmd_test$(DOTEXE) $(RDMD_TEST_EXECUTABLE)
|
||||||
$< $(RDMD_TEST_EXECUTABLE) -m$(MODEL) \
|
$< $(RDMD_TEST_EXECUTABLE) $(MODEL_FLAG) \
|
||||||
--rdmd-default-compiler=$(RDMD_TEST_DEFAULT_COMPILER) \
|
--rdmd-default-compiler=$(RDMD_TEST_DEFAULT_COMPILER) \
|
||||||
--test-compilers=$(RDMD_TEST_COMPILERS) \
|
--test-compilers=$(RDMD_TEST_COMPILERS) \
|
||||||
$(VERBOSE_RDMD_TEST_FLAGS)
|
$(VERBOSE_RDMD_TEST_FLAGS)
|
|
@ -38,7 +38,7 @@ Building
|
||||||
On a Posix system all tools can be built with:
|
On a Posix system all tools can be built with:
|
||||||
|
|
||||||
```
|
```
|
||||||
make -f posix.mak all
|
make all
|
||||||
```
|
```
|
||||||
|
|
||||||
Using DUB as a build tool
|
Using DUB as a build tool
|
||||||
|
|
108
win32.mak
108
win32.mak
|
@ -1,108 +0,0 @@
|
||||||
# Where scp command copies to
|
|
||||||
SCPDIR=..\backup
|
|
||||||
|
|
||||||
##### Tools
|
|
||||||
|
|
||||||
# D compiler
|
|
||||||
DMD=dmd
|
|
||||||
# C++ compiler
|
|
||||||
CC=dmc
|
|
||||||
# Make program
|
|
||||||
MAKE=make
|
|
||||||
# Librarian
|
|
||||||
LIB=lib
|
|
||||||
# Delete file(s)
|
|
||||||
DEL=del
|
|
||||||
# Make directory
|
|
||||||
MD=mkdir
|
|
||||||
# Remove directory
|
|
||||||
RD=rmdir
|
|
||||||
# File copy
|
|
||||||
CP=cp
|
|
||||||
# De-tabify
|
|
||||||
DETAB=detab
|
|
||||||
# Convert line endings to Unix
|
|
||||||
TOLF=tolf
|
|
||||||
# Zip
|
|
||||||
ZIP=zip32
|
|
||||||
# Copy to another directory
|
|
||||||
SCP=$(CP)
|
|
||||||
|
|
||||||
DFLAGS=-O -release -m$(MODEL)
|
|
||||||
|
|
||||||
GENERATED = generated
|
|
||||||
ROOT = $(GENERATED)\windows\32
|
|
||||||
|
|
||||||
TARGETS= $(ROOT)\dman.exe \
|
|
||||||
$(ROOT)\rdmd.exe \
|
|
||||||
$(ROOT)\ddemangle.exe \
|
|
||||||
$(ROOT)\changed.exe \
|
|
||||||
$(ROOT)\dustmite.exe
|
|
||||||
|
|
||||||
MAKEFILES=win32.mak win64.mak posix.mak
|
|
||||||
|
|
||||||
SRCS=dman.d rdmd.d ddemangle.d
|
|
||||||
|
|
||||||
targets : $(TARGETS)
|
|
||||||
|
|
||||||
dman: $(ROOT)\dman.exe
|
|
||||||
rdmd: $(ROOT)\rdmd.exe
|
|
||||||
ddemangle: $(ROOT)\ddemangle.exe
|
|
||||||
changed: $(ROOT)\changed.exe
|
|
||||||
dustmite: $(ROOT)\dustmite.exe
|
|
||||||
|
|
||||||
d-tags.json :
|
|
||||||
@echo 'Build d-tags.json and copy it here, e.g. by running:'
|
|
||||||
@echo " make -C ../dlang.org -f win32.mak d-tags.json && copy ../dlang.org/d-tags-latest.json d-tags.json"
|
|
||||||
@exit
|
|
||||||
|
|
||||||
$(ROOT)\dman.exe : dman.d d-tags.json
|
|
||||||
$(DMD) $(DFLAGS) -of$@ dman.d -J.
|
|
||||||
|
|
||||||
$(ROOT)\rdmd.exe : rdmd.d
|
|
||||||
$(DMD) $(DFLAGS) -of$@ rdmd.d advapi32.lib
|
|
||||||
|
|
||||||
$(ROOT)\ddemangle.exe : ddemangle.d
|
|
||||||
$(DMD) $(DFLAGS) -of$@ ddemangle.d
|
|
||||||
|
|
||||||
$(ROOT)\dustmite.exe : DustMite/dustmite.d DustMite/splitter.d DustMite/polyhash.d
|
|
||||||
$(DMD) $(DFLAGS) -of$@ -version=Dlang_Tools DustMite/dustmite.d DustMite/splitter.d DustMite/polyhash.d
|
|
||||||
|
|
||||||
$(ROOT)\changed.exe : changed.d
|
|
||||||
$(DMD) $(DFLAGS) -of$@ changed.d
|
|
||||||
|
|
||||||
clean :
|
|
||||||
rmdir /s /q $(GENERATED)
|
|
||||||
|
|
||||||
detab:
|
|
||||||
$(DETAB) $(SRCS)
|
|
||||||
|
|
||||||
tolf:
|
|
||||||
$(TOLF) $(SRCS) $(MAKEFILES)
|
|
||||||
|
|
||||||
zip: detab tolf $(MAKEFILES)
|
|
||||||
$(DEL) dman.zip
|
|
||||||
$(ZIP) dman $(MAKEFILES) $(SRCS) $(TAGS)
|
|
||||||
|
|
||||||
scp: detab tolf $(MAKEFILES)
|
|
||||||
$(SCP) $(SRCS) $(MAKEFILES) $(SCPDIR)
|
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# Build and run tests
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
RDMD_TEST_COMPILERS = $(DMD)
|
|
||||||
RDMD_TEST_EXECUTABLE = $(ROOT)\rdmd.exe
|
|
||||||
RDMD_TEST_DEFAULT_COMPILER = $(DMD)
|
|
||||||
|
|
||||||
$(ROOT)\rdmd_test.exe : rdmd_test.d
|
|
||||||
$(DMD) $(DFLAGS) -of$@ rdmd_test.d
|
|
||||||
|
|
||||||
test_rdmd : $(ROOT)\rdmd_test.exe $(RDMD_TEST_EXECUTABLE)
|
|
||||||
$(ROOT)\rdmd_test.exe \
|
|
||||||
$(RDMD_TEST_EXECUTABLE) -m$(MODEL) -v \
|
|
||||||
--rdmd-default-compiler=$(RDMD_TEST_DEFAULT_COMPILER) \
|
|
||||||
--test-compilers=$(RDMD_TEST_COMPILERS)
|
|
||||||
|
|
||||||
test : test_rdmd
|
|
64
win64.mak
64
win64.mak
|
@ -1,64 +0,0 @@
|
||||||
ROOT = generated\windows\64
|
|
||||||
|
|
||||||
TARGETS= $(ROOT)\dman.exe \
|
|
||||||
$(ROOT)\rdmd.exe \
|
|
||||||
$(ROOT)\ddemangle.exe \
|
|
||||||
$(ROOT)\changed.exe \
|
|
||||||
$(ROOT)\dustmite.exe
|
|
||||||
|
|
||||||
targets : $(TARGETS)
|
|
||||||
|
|
||||||
dman: $(ROOT)\dman.exe
|
|
||||||
rdmd: $(ROOT)\rdmd.exe
|
|
||||||
ddemangle: $(ROOT)\ddemangle.exe
|
|
||||||
changed: $(ROOT)\changed.exe
|
|
||||||
dustmite: $(ROOT)\dustmite.exe
|
|
||||||
|
|
||||||
d-tags.json :
|
|
||||||
@echo 'Build d-tags.json and copy it here, e.g. by running:'
|
|
||||||
@echo " make -C ../dlang.org -f win64.mak d-tags.json && copy ../dlang.org/d-tags-latest.json d-tags.json"
|
|
||||||
@exit
|
|
||||||
|
|
||||||
MAKE_WIN32=make -f win32.mak "ROOT=$(ROOT)" "MODEL=$(MODEL)"
|
|
||||||
|
|
||||||
$(ROOT)\dman.exe : dman.d d-tags.json
|
|
||||||
$(MAKE_WIN32) $@
|
|
||||||
|
|
||||||
$(ROOT)\rdmd.exe : rdmd.d
|
|
||||||
$(MAKE_WIN32) $@
|
|
||||||
|
|
||||||
$(ROOT)\ddemangle.exe : ddemangle.d
|
|
||||||
$(MAKE_WIN32) $@
|
|
||||||
|
|
||||||
$(ROOT)\dustmite.exe : DustMite/dustmite.d DustMite/splitter.d DustMite/polyhash.d
|
|
||||||
$(MAKE_WIN32) $@
|
|
||||||
|
|
||||||
$(ROOT)\changed.exe : changed.d
|
|
||||||
$(MAKE_WIN32) $@
|
|
||||||
|
|
||||||
clean :
|
|
||||||
$(MAKE_WIN32) $@
|
|
||||||
|
|
||||||
detab:
|
|
||||||
$(MAKE_WIN32) $@
|
|
||||||
|
|
||||||
tolf:
|
|
||||||
$(MAKE_WIN32) $@
|
|
||||||
|
|
||||||
zip: detab tolf $(MAKEFILES)
|
|
||||||
$(MAKE_WIN32) $@
|
|
||||||
|
|
||||||
scp: detab tolf $(MAKEFILES)
|
|
||||||
$(MAKE_WIN32) $@
|
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# Build and run tests
|
|
||||||
################################################################################
|
|
||||||
$(ROOT)\rdmd_test.exe : rdmd_test.d
|
|
||||||
$(MAKE_WIN32) $@
|
|
||||||
|
|
||||||
test_rdmd : $(ROOT)\rdmd_test.exe $(RDMD_TEST_EXECUTABLE)
|
|
||||||
$(MAKE_WIN32) $@
|
|
||||||
|
|
||||||
test : test_rdmd
|
|
Loading…
Add table
Add a link
Reference in a new issue