BS=build-scripts
PREFIX=/usr/local
DESTDIR=

DEFAULT_PLANG=D
# D, Python or Bash
PLANG=$(DEFAULT_PLANG)
PLANG_DIRNAME=lang_$(PLANG)

ifeq ($(PLANG),D)
	DC=ldc2
	RELEASE_ARGS=release $(DC)
	DEBUG_ARGS=debug $(DC)
endif

.PHONY: bin debug test install uninstall tarball clean

bin:
	$(BS)/$(PLANG_DIRNAME)/compile.sh $(RELEASE_ARGS)

debug:
	$(BS)/$(PLANG_DIRNAME)/compile.sh $(DEBUG_ARGS)

test:
	$(BS)/run_tests.sh

install:
	$(BS)/install.sh --install $(DESTDIR)/$(PREFIX)

uninstall:
	$(BS)/install.sh --uninstall $(DESTDIR)/$(PREFIX)

tarball: clean
	$(BS)/build_tarball.sh

clean:
	rm -rf build/ testing/link-editor

mypy:
	cd source/lang_Python/ ; mypy . ; rm -rf .mypy_cache
