Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Compile the D compiler
MODEL=64
PROTO=git
all:bin/dmd.conf bin/rdmd
@echo "Now add the following to .bashrc: export PATH=\"`pwd`/bin:"'$$PATH"'
# Compile the D compiler
dmd/src/posix.mak:
git clone $(PROTO)://github.com/D-Programming-Language/dmd.git
dmd/src/dmd:dmd/src/posix.mak
(cd dmd/src; make -f posix.mak MODEL=$(MODEL))
bin/dmd:dmd/src/dmd
mkdir -p bin; cp dmd/src/dmd bin
# Compile the D runtime
druntime/posix.mak:
git clone $(PROTO)://github.com/D-Programming-Language/druntime.git
druntime/done.stamp:bin/dmd druntime/posix.mak
(cd druntime; make -f posix.mak DMD=../bin/dmd MODEL=$(MODEL); touch done.stamp)
# Compile the phobos library
phobos/posix.mak:
git clone $(PROTO)://github.com/D-Programming-Language/phobos.git
lib/libphobos2.a:bin/dmd phobos/posix.mak
mkdir -p lib; (cd phobos; make -f posix.mak DMD=../bin/dmd MODEL=$(MODEL); mv generated/*/release/$(MODEL)/libphobos2.a ../lib)
# Generate the configuration file
bin/dmd.conf:bin/dmd druntime/done.stamp lib/libphobos2.a
mkdir -p bin; (echo '[Environment]'; echo 'DFLAGS=-I%@P%/../phobos -I%@P%/../druntime/import -L-L%@P%/../lib') > $@
# Compile rdmd, the D "interpreter"
tools/rdmd.d:
git clone $(PROTO)://github.com/D-Programming-Language/tools.git
bin/rdmd:bin/dmd.conf bin/dmd tools/rdmd.d
(cd tools; ../bin/dmd -release rdmd.d; mv rdmd ../bin)
# Clean
clean:
rm -fr bin lib dmd druntime phobos tools
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.