1# This Makefile is a wrapper around chicken-install(1) which eases building2# edward without superuser rights and without requiring any configuration3# of chicken-install. Furthermore, it supports optional dependency vendoring4# to build edward without network access.5#6# By default, the Makefile builds a statically linked binary. For development7# purposes it can be desirable to do dynamic linked builds instead. To do so8# the PACKAGE environment variable can be set to zero.9PREFIX ?= /usr/local10BINDIR ?= $(PREFIX)/bin11DOCDIR ?= $(PREFIX)/share/doc/edward12TMPDIR ?= /tmp1314# By default, build a statically linked version for packaging.15# If package is zero, build a dynamically linked version instead.16PACKAGE ?= 117ifneq ($(PACKAGE),0)18 INSTALL_FLAGS = -feature package19endif2021# Install all CHICKEN files relative to ./output22#23# See: https://bugs.call-cc.org/ticket/17922425# Respect CHICKEN_REPOSITORY_PATH if set in the environment26CHICKEN_REPOSITORY_PATH ?= $(shell env -i chicken-install -repository)2728export CHICKEN_INSTALL_PREFIX := $(CURDIR)/output29export CHICKEN_INSTALL_REPOSITORY := $(CURDIR)/output30export CHICKEN_REPOSITORY_PATH := $(CURDIR)/output:$(CHICKEN_REPOSITORY_PATH)3132# Optional dependency vendoring to build without network access33#34# Release tarballs include vendored dependencies (see make dist).3536VENDOR_DIRECTORY = $(CURDIR)/vendor37ifneq ($(wildcard $(VENDOR_DIRECTORY)/*),)38 VENDORED=139endif4041all:42ifdef VENDORED43 chicken-install -location $(VENDOR_DIRECTORY) $(shell ls $(VENDOR_DIRECTORY))44endif45 chicken-install $(INSTALL_FLAGS)4647check: export EDWARD=$(CHICKEN_INSTALL_PREFIX)/bin/edward48check:49 chicken-install -test50 @./tests/integration/run.sh51 @./tests/interactive/run.sh5253bench:54 csc -O3 -o $(TMPDIR)/edward-benchmark benchmarks/run.scm55 $(TMPDIR)/edward-benchmark5657install:58 install -Dm755 $(CHICKEN_INSTALL_PREFIX)/bin/edward "$(DESTDIR)$(BINDIR)/edward"59 install -Dm644 README.md "$(DESTDIR)$(DOCDIR)/README.md"6061vendor:62 # TODO: Start with CS6, `chicken-install -recursive` no longer searches the63 # current directory for eggs. Thus we need to list the deps explicitly here.64 env -i CHICKEN_EGG_CACHE=$(VENDOR_DIRECTORY) chicken-install -r -recursive \65 srfi-1 srfi-14 srfi-37 matchable posix-regex test micro-benchmark66 find $(VENDOR_DIRECTORY) \( -name STATUS -a -type f \) -exec rm {} +67# XXX: Make sure to remove the vendor directory before running `make dist`.68# As libraries are, unfortunately, build within the vendor directory.69dist: VERSION = $(shell git describe --tags)70dist: vendor71 mkdir -p edward-$(VERSION)72 cp -R LICENSE.txt GNUmakefile README.md bin edward.egg lib tests vendor edward-$(VERSION)73 tar -czf edward-$(VERSION).tar.gz edward-$(VERSION)74 rm -rf edward-$(VERSION)7576.PHONY: all check bench install vendor dist