edward

An extensible POSIX-compatible implementation of the ed(1) text editor

git clone https://git.8pit.net/edward.git

 1# This Makefile is a wrapper around chicken-install(1) which eases building
 2# edward without superuser rights and without requiring any configuration
 3# of chicken-install. Furthermore, it supports optional dependency vendoring
 4# to build edward without network access.
 5#
 6# By default, the Makefile builds a statically linked binary. For development
 7# purposes it can be desirable to do dynamic linked builds instead. To do so
 8# the PACKAGE environment variable can be set to zero.
 9PREFIX ?= /usr/local
10BINDIR ?= $(PREFIX)/bin
11DOCDIR ?= $(PREFIX)/share/doc/edward
12TMPDIR ?= /tmp
13
14# By default, build a statically linked version for packaging.
15# If package is zero, build a dynamically linked version instead.
16PACKAGE ?= 1
17ifneq ($(PACKAGE),0)
18	INSTALL_FLAGS = -feature package
19endif
20
21# Install all CHICKEN files relative to ./output
22#
23# See: https://bugs.call-cc.org/ticket/1792
24
25# Respect CHICKEN_REPOSITORY_PATH if set in the environment
26CHICKEN_REPOSITORY_PATH ?= $(shell env -i chicken-install -repository)
27
28export CHICKEN_INSTALL_PREFIX := $(CURDIR)/output
29export CHICKEN_INSTALL_REPOSITORY := $(CURDIR)/output
30export CHICKEN_REPOSITORY_PATH := $(CURDIR)/output:$(CHICKEN_REPOSITORY_PATH)
31
32# Optional dependency vendoring to build without network access
33#
34# Release tarballs include vendored dependencies (see make dist).
35
36VENDOR_DIRECTORY = $(CURDIR)/vendor
37ifneq ($(wildcard $(VENDOR_DIRECTORY)/*),)
38	VENDORED=1
39endif
40
41all:
42ifdef VENDORED
43	chicken-install -location $(VENDOR_DIRECTORY) $(shell ls $(VENDOR_DIRECTORY))
44endif
45	chicken-install $(INSTALL_FLAGS)
46
47check: export EDWARD=$(CHICKEN_INSTALL_PREFIX)/bin/edward
48check:
49	chicken-install -test
50	@./tests/integration/run.sh
51	@./tests/interactive/run.sh
52
53bench:
54	csc -O3 -o $(TMPDIR)/edward-benchmark benchmarks/run.scm
55	$(TMPDIR)/edward-benchmark
56
57install:
58	install -Dm755 $(CHICKEN_INSTALL_PREFIX)/bin/edward "$(DESTDIR)$(BINDIR)/edward"
59	install -Dm644 README.md "$(DESTDIR)$(DOCDIR)/README.md"
60
61vendor:
62	# TODO: Start with CS6, `chicken-install -recursive` no longer searches the
63	# 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-benchmark
66	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: vendor
71	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)
75
76.PHONY: all check bench install vendor dist