Created
December 2, 2017 11:27
-
-
Save wilzbach/7887df5e821aff4902939484c1197883 to your computer and use it in GitHub Desktop.
Makefile with D compiler bootstrapping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DMD=bin/dmd2/linux/bin64/dmd | |
DMD_VERSION=2.074.0 | |
LDC=bin/ldc2-$(LDC_VERSION)-linux-$(PLATFORM)/bin/ldc2 | |
LDC_VERSION=1.2.0 | |
DFLAGS=-g | |
PLATFORM=x86_64 | |
################################################################################ | |
# Auto-bootstrap DMD & LDC for outdated Debian/Ubuntu | |
################################################################################ | |
bin: | |
mkdir -p $@ | |
bin/dmd2: | bin | |
curl -fSL --retry 3 "http://downloads.dlang.org/releases/2.x/$(DMD_VERSION)/dmd.$(DMD_VERSION).linux.tar.xz" | tar -Jxf - -C $| | |
bin/dmd2/linux/bin64/dmd: | bin/dmd2 | |
bin/ldc2-$(LDC_VERSION)-linux-$(PLATFORM): | bin | |
curl -fSL --retry 3 "https://github.com/ldc-developers/ldc/releases/download/v$(LDC_VERSION)/ldc2-$(LDC_VERSION)-linux-$(PLATFORM).tar.xz" \ | |
| tar -Jxf - -C $| | |
bin/ldc2-$(LDC_VERSION)-linux-$(PLATFORM)/bin/ldc2: | bin/ldc2-$(LDC_VERSION)-linux-$(PLATFORM) | |
################################################################################ | |
# Single-file programs | |
################################################################################ | |
bin/main: main.d $(DMD) | bin | |
$(DMD) $(DFLAGS) $< -of$@ | |
bin/main_opt: main.d $(LDC) | bin | |
$(LDC) -g -O4 -mcpu=native -release $(DFLAGS) $< -of$@ | |
################################################################################ | |
# Complex programs | |
################################################################################ | |
D_FILES = $(addsuffix .d, $(addprefix lib/, utils database synonyms gennames input)) | |
bin/postprocess: $(D_FILES) $(DMD) | bin | |
$(DMD) $(DFLAGS) $(DMD_DEBUG_FLAGS) postprocess.d $(D_FILES) -of$@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment