2020-05-18 15:59:07 +03:00
|
|
|
include config.mk
|
|
|
|
|
|
|
|
# Idris 2 executable used to bootstrap
|
2020-05-19 20:25:18 +03:00
|
|
|
export IDRIS2_BOOT ?= idris2
|
2020-05-18 15:59:07 +03:00
|
|
|
|
|
|
|
# Idris 2 executable we're building
|
2020-05-20 15:31:04 +03:00
|
|
|
NAME = idris2
|
2020-05-18 15:59:07 +03:00
|
|
|
TARGETDIR = build/exec
|
|
|
|
TARGET = ${TARGETDIR}/${NAME}
|
|
|
|
|
|
|
|
MAJOR=0
|
2021-01-13 15:46:06 +03:00
|
|
|
MINOR=3
|
|
|
|
PATCH=0
|
2020-05-18 15:59:07 +03:00
|
|
|
|
|
|
|
GIT_SHA1=
|
|
|
|
ifeq ($(shell git status >/dev/null 2>&1; echo $$?), 0)
|
2021-01-20 23:15:24 +03:00
|
|
|
# inside a git repo
|
|
|
|
ifneq ($(shell git describe --exact-match --tags >/dev/null 2>&1; echo $$?), 0)
|
|
|
|
# not tagged as a released version, so add sha1 of this build in between releases
|
|
|
|
GIT_SHA1 := $(shell git rev-parse --short=9 HEAD)
|
|
|
|
endif
|
2020-05-18 15:59:07 +03:00
|
|
|
endif
|
|
|
|
|
|
|
|
export IDRIS2_VERSION := ${MAJOR}.${MINOR}.${PATCH}
|
2020-05-20 12:31:30 +03:00
|
|
|
IDRIS2_SUPPORT := libidris2_support${SHLIB_SUFFIX}
|
2020-07-16 16:49:22 +03:00
|
|
|
IDRIS2_APP_IPKG := idris2.ipkg
|
|
|
|
IDRIS2_LIB_IPKG := idris2api.ipkg
|
2020-05-18 15:59:07 +03:00
|
|
|
|
2020-05-20 19:14:38 +03:00
|
|
|
ifeq ($(OS), windows)
|
2020-05-24 07:44:35 +03:00
|
|
|
# This produces D:/../.. style paths
|
2020-05-20 19:14:38 +03:00
|
|
|
IDRIS2_PREFIX := $(shell cygpath -m ${PREFIX})
|
|
|
|
IDRIS2_CURDIR := $(shell cygpath -m ${CURDIR})
|
2020-05-24 07:44:35 +03:00
|
|
|
SEP := ;
|
2020-05-20 19:14:38 +03:00
|
|
|
else
|
|
|
|
IDRIS2_PREFIX := ${PREFIX}
|
|
|
|
IDRIS2_CURDIR := ${CURDIR}
|
2020-05-24 07:44:35 +03:00
|
|
|
SEP := :
|
2020-05-20 19:14:38 +03:00
|
|
|
endif
|
|
|
|
|
2020-05-24 07:44:35 +03:00
|
|
|
# Library and data paths for bootstrap-test
|
|
|
|
IDRIS2_BOOT_TEST_LIBS := ${IDRIS2_CURDIR}/bootstrap/${NAME}-${IDRIS2_VERSION}/lib
|
|
|
|
IDRIS2_BOOT_TEST_DATA := ${IDRIS2_CURDIR}/bootstrap/${NAME}-${IDRIS2_VERSION}/support
|
2020-05-20 19:14:38 +03:00
|
|
|
|
2020-05-24 07:44:35 +03:00
|
|
|
# These are the library path in the build dir to be used during build
|
2020-06-24 01:29:28 +03:00
|
|
|
export IDRIS2_BOOT_PATH := "${IDRIS2_CURDIR}/libs/prelude/build/ttc${SEP}${IDRIS2_CURDIR}/libs/base/build/ttc${SEP}${IDRIS2_CURDIR}/libs/contrib/build/ttc${SEP}${IDRIS2_CURDIR}/libs/network/build/ttc"
|
2020-05-18 15:59:07 +03:00
|
|
|
|
2020-05-20 12:31:30 +03:00
|
|
|
export SCHEME
|
|
|
|
|
|
|
|
|
2020-08-31 17:35:24 +03:00
|
|
|
.PHONY: all idris2-exec ${TARGET} testbin support support-clean clean distclean FORCE
|
2020-05-18 15:59:07 +03:00
|
|
|
|
2020-05-21 18:48:26 +03:00
|
|
|
all: support ${TARGET} testbin libs
|
2020-05-18 15:59:07 +03:00
|
|
|
|
2020-05-19 12:47:05 +03:00
|
|
|
idris2-exec: ${TARGET}
|
|
|
|
|
2020-05-18 22:24:48 +03:00
|
|
|
${TARGET}: src/IdrisPaths.idr
|
2020-07-16 16:49:22 +03:00
|
|
|
${IDRIS2_BOOT} --build ${IDRIS2_APP_IPKG}
|
2020-05-18 15:59:07 +03:00
|
|
|
|
2020-08-31 17:35:24 +03:00
|
|
|
# We use FORCE to always rebuild IdrisPath so that the git SHA1 info is always up to date
|
|
|
|
src/IdrisPaths.idr: FORCE
|
2021-01-16 11:28:56 +03:00
|
|
|
echo '-- @generated' > src/IdrisPaths.idr
|
|
|
|
echo 'module IdrisPaths' >> src/IdrisPaths.idr
|
2020-05-18 22:24:48 +03:00
|
|
|
echo 'export idrisVersion : ((Nat,Nat,Nat), String); idrisVersion = ((${MAJOR},${MINOR},${PATCH}), "${GIT_SHA1}")' >> src/IdrisPaths.idr
|
2020-05-20 19:14:38 +03:00
|
|
|
echo 'export yprefix : String; yprefix="${IDRIS2_PREFIX}"' >> src/IdrisPaths.idr
|
2020-05-18 22:24:48 +03:00
|
|
|
|
2020-08-31 17:35:24 +03:00
|
|
|
FORCE:
|
|
|
|
|
2020-05-18 15:59:07 +03:00
|
|
|
prelude:
|
|
|
|
${MAKE} -C libs/prelude IDRIS2=../../${TARGET} IDRIS2_PATH=${IDRIS2_BOOT_PATH}
|
|
|
|
|
|
|
|
base: prelude
|
|
|
|
${MAKE} -C libs/base IDRIS2=../../${TARGET} IDRIS2_PATH=${IDRIS2_BOOT_PATH}
|
|
|
|
|
|
|
|
network: prelude
|
|
|
|
${MAKE} -C libs/network IDRIS2=../../${TARGET} IDRIS2_PATH=${IDRIS2_BOOT_PATH}
|
|
|
|
|
|
|
|
contrib: prelude
|
|
|
|
${MAKE} -C libs/contrib IDRIS2=../../${TARGET} IDRIS2_PATH=${IDRIS2_BOOT_PATH}
|
|
|
|
|
2020-06-25 14:12:20 +03:00
|
|
|
libs : prelude base contrib network
|
2020-05-18 15:59:07 +03:00
|
|
|
|
2020-05-21 18:48:26 +03:00
|
|
|
testbin:
|
|
|
|
@${MAKE} -C tests testbin
|
|
|
|
|
2021-02-03 19:16:11 +03:00
|
|
|
test: testbin
|
2021-01-16 09:41:22 +03:00
|
|
|
@echo
|
|
|
|
@echo "NOTE: \`${MAKE} test\` does not rebuild idris; to do that run \`${MAKE}\`"
|
|
|
|
@echo
|
2020-05-19 20:25:18 +03:00
|
|
|
@${MAKE} -C tests only=$(only) IDRIS2=../../../${TARGET}
|
|
|
|
|
2020-05-18 15:59:07 +03:00
|
|
|
support:
|
|
|
|
@${MAKE} -C support/c
|
2020-10-11 17:05:00 +03:00
|
|
|
@${MAKE} -C support/refc
|
2020-05-18 15:59:07 +03:00
|
|
|
|
|
|
|
support-clean:
|
|
|
|
@${MAKE} -C support/c clean
|
2020-10-11 17:05:00 +03:00
|
|
|
@${MAKE} -C support/refc clean
|
2020-05-18 15:59:07 +03:00
|
|
|
|
|
|
|
clean-libs:
|
|
|
|
${MAKE} -C libs/prelude clean
|
|
|
|
${MAKE} -C libs/base clean
|
|
|
|
${MAKE} -C libs/contrib clean
|
2020-06-25 14:12:20 +03:00
|
|
|
${MAKE} -C libs/network clean
|
2020-05-18 15:59:07 +03:00
|
|
|
|
|
|
|
clean: clean-libs support-clean
|
2020-07-16 16:49:22 +03:00
|
|
|
-${IDRIS2_BOOT} --clean ${IDRIS2_APP_IPKG}
|
2020-05-20 21:38:43 +03:00
|
|
|
$(RM) src/IdrisPaths.idr
|
2020-05-20 12:31:30 +03:00
|
|
|
${MAKE} -C tests clean
|
2020-05-19 15:50:47 +03:00
|
|
|
$(RM) -r build
|
2020-05-18 15:59:07 +03:00
|
|
|
|
|
|
|
install: install-idris2 install-support install-libs
|
|
|
|
|
2020-06-18 14:19:48 +03:00
|
|
|
install-api: src/IdrisPaths.idr
|
2020-07-16 16:49:22 +03:00
|
|
|
${IDRIS2_BOOT} --install ${IDRIS2_LIB_IPKG}
|
2020-05-20 18:38:46 +03:00
|
|
|
|
2020-05-18 15:59:07 +03:00
|
|
|
install-idris2:
|
2020-05-20 00:56:27 +03:00
|
|
|
mkdir -p ${PREFIX}/bin/
|
2020-05-18 15:59:07 +03:00
|
|
|
install ${TARGET} ${PREFIX}/bin
|
2020-05-22 12:10:14 +03:00
|
|
|
ifeq ($(OS), windows)
|
2020-05-22 12:26:47 +03:00
|
|
|
-install ${TARGET}.cmd ${PREFIX}/bin
|
2020-05-22 12:10:14 +03:00
|
|
|
endif
|
2020-05-20 00:56:27 +03:00
|
|
|
mkdir -p ${PREFIX}/lib/
|
2020-05-19 18:28:24 +03:00
|
|
|
install support/c/${IDRIS2_SUPPORT} ${PREFIX}/lib
|
2020-05-20 00:56:27 +03:00
|
|
|
mkdir -p ${PREFIX}/bin/${NAME}_app
|
|
|
|
install ${TARGETDIR}/${NAME}_app/* ${PREFIX}/bin/${NAME}_app
|
2020-05-18 15:59:07 +03:00
|
|
|
|
2020-05-19 22:41:52 +03:00
|
|
|
install-support:
|
2020-05-18 15:59:07 +03:00
|
|
|
mkdir -p ${PREFIX}/idris2-${IDRIS2_VERSION}/support/chez
|
|
|
|
mkdir -p ${PREFIX}/idris2-${IDRIS2_VERSION}/support/racket
|
|
|
|
mkdir -p ${PREFIX}/idris2-${IDRIS2_VERSION}/support/gambit
|
2020-07-06 18:58:02 +03:00
|
|
|
mkdir -p ${PREFIX}/idris2-${IDRIS2_VERSION}/support/js
|
2020-05-18 15:59:07 +03:00
|
|
|
install support/chez/* ${PREFIX}/idris2-${IDRIS2_VERSION}/support/chez
|
|
|
|
install support/racket/* ${PREFIX}/idris2-${IDRIS2_VERSION}/support/racket
|
|
|
|
install support/gambit/* ${PREFIX}/idris2-${IDRIS2_VERSION}/support/gambit
|
2020-07-06 18:58:02 +03:00
|
|
|
install support/js/* ${PREFIX}/idris2-${IDRIS2_VERSION}/support/js
|
2020-05-18 15:59:07 +03:00
|
|
|
@${MAKE} -C support/c install
|
2020-10-11 17:05:00 +03:00
|
|
|
@${MAKE} -C support/refc install
|
2020-05-18 15:59:07 +03:00
|
|
|
|
2020-05-19 22:41:52 +03:00
|
|
|
install-libs:
|
2020-05-18 18:29:18 +03:00
|
|
|
${MAKE} -C libs/prelude install IDRIS2=../../${TARGET} IDRIS2_PATH=${IDRIS2_BOOT_PATH}
|
|
|
|
${MAKE} -C libs/base install IDRIS2=../../${TARGET} IDRIS2_PATH=${IDRIS2_BOOT_PATH}
|
|
|
|
${MAKE} -C libs/contrib install IDRIS2=../../${TARGET} IDRIS2_PATH=${IDRIS2_BOOT_PATH}
|
2020-06-25 14:12:20 +03:00
|
|
|
${MAKE} -C libs/network install IDRIS2=../../${TARGET} IDRIS2_PATH=${IDRIS2_BOOT_PATH}
|
2020-05-18 18:02:30 +03:00
|
|
|
|
2020-05-20 12:31:30 +03:00
|
|
|
|
2020-05-24 07:44:35 +03:00
|
|
|
.PHONY: bootstrap bootstrap-build bootstrap-racket bootstrap-racket-build bootstrap-test bootstrap-clean
|
2020-05-20 12:31:30 +03:00
|
|
|
|
2020-05-24 07:44:35 +03:00
|
|
|
# Bootstrapping using SCHEME
|
2021-01-20 23:15:24 +03:00
|
|
|
bootstrap: support
|
2020-05-20 16:17:06 +03:00
|
|
|
cp support/c/${IDRIS2_SUPPORT} bootstrap/idris2_app
|
2021-01-17 05:43:29 +03:00
|
|
|
sed 's/libidris2_support.so/${IDRIS2_SUPPORT}/g; s|__PREFIX__|${IDRIS2_CURDIR}/bootstrap|g' \
|
2021-01-20 23:15:24 +03:00
|
|
|
bootstrap/idris2_app/idris2.ss \
|
|
|
|
> bootstrap/idris2_app/idris2-boot.ss
|
|
|
|
sh ./bootstrap-stage1-chez.sh
|
|
|
|
sh ./bootstrap-stage2.sh IDRIS2_CG="chez"
|
2020-05-20 00:56:27 +03:00
|
|
|
|
2020-05-24 07:44:35 +03:00
|
|
|
# Bootstrapping using racket
|
2021-01-20 23:15:24 +03:00
|
|
|
bootstrap-racket: support
|
2020-05-20 16:17:06 +03:00
|
|
|
cp support/c/${IDRIS2_SUPPORT} bootstrap/idris2_app
|
2021-01-17 05:43:29 +03:00
|
|
|
sed 's|__PREFIX__|${IDRIS2_CURDIR}/bootstrap|g' \
|
2021-01-20 23:15:24 +03:00
|
|
|
bootstrap/idris2_app/idris2.rkt \
|
|
|
|
> bootstrap/idris2_app/idris2-boot.rkt
|
|
|
|
sh ./bootstrap-stage1-racket.sh
|
|
|
|
sh ./bootstrap-stage2.sh IDRIS2_CG="racket"
|
2020-05-20 12:31:30 +03:00
|
|
|
|
2020-05-24 07:44:35 +03:00
|
|
|
bootstrap-test:
|
|
|
|
$(MAKE) test INTERACTIVE='' IDRIS2_PATH=${IDRIS2_BOOT_PATH} IDRIS2_DATA=${IDRIS2_BOOT_TEST_DATA} IDRIS2_LIBS=${IDRIS2_BOOT_TEST_LIBS}
|
|
|
|
|
2020-05-20 12:31:30 +03:00
|
|
|
bootstrap-clean:
|
|
|
|
$(RM) -r bootstrap/bin bootstrap/lib bootstrap/idris2-${IDRIS2_VERSION}
|
2020-05-20 16:17:06 +03:00
|
|
|
$(RM) bootstrap/idris2boot* bootstrap/idris2_app/idris2-boot.* bootstrap/idris2_app/${IDRIS2_SUPPORT}
|
2020-05-20 12:31:30 +03:00
|
|
|
|
|
|
|
|
|
|
|
.PHONY: distclean
|
|
|
|
|
|
|
|
distclean: clean bootstrap-clean
|
|
|
|
@find . -type f -name '*.ttc' -exec rm -f {} \;
|
|
|
|
@find . -type f -name '*.ttm' -exec rm -f {} \;
|
|
|
|
@find . -type f -name '*.ibc' -exec rm -f {} \;
|