Common Lisp: Create standalone executables for supported Lisps
authorIqbal Ansari <iqbalansari02@yahoo.com>
Wed, 23 Aug 2017 18:15:05 +0000 (23:45 +0530)
committerIqbal Ansari <iqbalansari02@yahoo.com>
Sat, 26 Aug 2017 07:34:00 +0000 (13:04 +0530)
common-lisp/Makefile

index d6d8437..9c614c4 100644 (file)
@@ -11,11 +11,14 @@ define steps
                stepA_mal)
 endef
 
+LISP ?= sbcl
+ABCL ?= abcl
+
+STANDALONE_EXE = sbcl clisp ccl ecl cmucl
+
 ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
 SOURCES_LISP := src/env.lisp src/core.lisp src/stepA_mal.lisp
 SOURCES := src/utils.lisp src/types.lisp src/reader.lisp src/printer.lisp $(SOURCES_LISP)
-LISP ?= sbcl
-ABCL ?= abcl
 
 # Record the Common Lisp implementation used for all steps built in this
 # invocation This is used in the targets to rebuild the step if the
@@ -34,7 +37,18 @@ hist/%_impl: ;
 # image even if invoked from some directory different from where it
 # currently resides
 step% : src/step%.lisp src/utils.lisp src/types.lisp src/env.lisp src/printer.lisp src/reader.lisp src/core.lisp hist/%_impl
-ifeq ($(LISP),abcl)
+
+ifeq ($(LISP),clisp)
+       @echo "=============================================================="
+       @echo "WARNING: This build might fail since GNU Clisp does not have bundled version of asdf (yet)"
+       @echo "Please do something like below to make it work"
+       @echo "(mkdir -p ~/common-lisp/ && cd ~/common-lisp && git clone -b release https://gitlab.common-lisp.net/asdf/asdf.git && cd asdf && make)"
+       @echo "=============================================================="
+endif
+
+ifneq ($(filter $(LISP),$(STANDALONE_EXE)),)
+       cl-launch --wrap 'if [ -z "$$CL_LAUNCH_VERSION" ] ; then cd "$$(dirname $$CL_LAUNCH_FILE)" ; fi' --verbose --lisp $(LISP) --source-registry $(ROOT_DIR) --system $@ --dump '!' -o $@ --entry 'mal:main'
+else ifeq ($(LISP),abcl)
        echo -n '#!/bin/sh\ncd `dirname $$0` ; $(ABCL) --noinform --noinit --nosystem --load run-abcl.lisp -- $@ $$@' > $@
        chmod +x $@
 else