Newer
Older
.PHONY: all clean force
.PHONY: jscoq libs-pkg links links-clean
.PHONY: dist dist-upload dist-release
COQ_VERSION:=v8.10
ifdef JSCOQ_BRANCH
JSCOQ_VERSION:=$(JSCOQ_VERSION)-$(JSCOQ_BRANCH)
endif
BUILD_CONTEXT = 4.07.1+32bit
# ugly but I couldn't find a better way
current_dir := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
# Directory where the coq sources and developments are.
ADDONS_PATH := $(current_dir)/coq-external
COQSRC := $(ADDONS_PATH)/coq-$(COQ_VERSION)+32bit/
# Directories where Dune builds and installs Coq
COQBUILDDIR := $(current_dir)/_build/$(BUILD_CONTEXT)/coq-external/coq-$(COQ_VERSION)+32bit
COQDIR := $(current_dir)/_build/install/$(BUILD_CONTEXT)
ADDONS = mathcomp # iris ltac2 elpi equations dsp
all:
@echo "Welcome to jsCoq makefile. Targets are:"
@echo ""
@echo " jscoq: build jscoq [javascript and libraries]"
@echo " libs-pkg: build packages bundle [experimental]"
@echo ""
@echo " links: create links that allow to serve pages from the source tree"
@echo ""
@echo " dist: create a distribution suitable for a web server"
@echo " coq: download and build Coq and addon libraries"
ADDONS="$(ADDONS)" dune build @jscoq
ADDONS="$(ADDONS)" dune build @libs-pkg
ln -sf _build/$(BUILD_CONTEXT)/coq-pkgs .
ln -sf ../_build/$(BUILD_CONTEXT)/coq-js/jscoq_worker.bc.js coq-js
rm -f coq-pkgs coq-js/jscoq_worker.bc.js
# Build symbol database files for autocomplete
coq-pkgs/%.symb: coq-pkgs/%.json
node --max-old-space-size=2048 ui-js/coq-cli.js --require-pkg $< --inspect $@
libs-symb: ${patsubst %.json, %.symb, coq-pkgs/init.json ${wildcard coq-pkgs/coq-*.json}}
########################################################################
########################################################################
########################################################################
########################################################################
BUILDDIR=_build/$(BUILD_CONTEXT)
BUILDOBJ=$(addprefix $(BUILDDIR)/./, index.html node_modules coq-js/jscoq_worker.bc.js coq-pkgs ui-js ui-css ui-images examples ui-external/CodeMirror-TeX-input)
DISTDIR=_build/dist
dist: jscoq
mkdir -p $(DISTDIR)
rsync -avpR --delete $(BUILDOBJ) $(DISTDIR)
Emilio Jesus Gallego Arias
committed
########################################################################
# Local stuff and distributions
########################################################################
# Private paths, for releases and local builds.
WEB_DIR=~/x80/jscoq-builds/$(JSCOQ_VERSION)/
RELEASE_DIR=~/research/jscoq-builds/
rsync -avzp --delete $(DISTDIR)/ $(WEB_DIR)
rsync -avzp --delete --exclude=README.md --exclude=get-hashes.sh --exclude=.git $(DISTDIR)/ $(RELEASE_DIR)
# all-dist: dist dist-release dist-upload
all-dist: dist dist-release dist-upload
########################################################################
# Externals
########################################################################
.PHONY: coq coq-get coq-build
COQ_BRANCH=master
COQ_REPOS=https://github.com/coq/coq.git
( git clone --depth=1 -b $(COQ_BRANCH) $(COQ_REPOS) $(COQSRC) && \
cd $(COQSRC) && \
patch -p1 < $(current_dir)/etc/patches/avoid-vm.patch && \
patch -p1 < $(current_dir)/etc/patches/trampoline.patch ) || true
cd $(COQSRC) && ./configure -prefix $(COQDIR) -native-compiler no -bytecode-compiler no -coqide no
dune build @vodeps
cd $(COQSRC) && dune exec ./tools/coq_dune.exe --context="$(BUILD_CONTEXT)" $(COQBUILDDIR)/.vfiles.d
# Coq should be now be built by composition with the Dune setup
true
coq: coq-get coq-build
addon-%-get:
make -f coq-addons/$*.addon get
addon-%-build:
make -f coq-addons/$*.addon build
make -f coq-addons/$*.addon jscoq-install
addons-get: ${foreach v,$(ADDONS),addon-$(v)-get}
addons-build: ${foreach v,$(ADDONS),addon-$(v)-build}
addons: addons-get addons-build