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
12
13# By default, build a statically linked version for packaging.
14# If package is zero, build a dynamically linked version instead.
15PACKAGE ?= 1
16ifneq ($(PACKAGE),0)
17	INSTALL_FLAGS = -feature package
18endif
19
20# Install all CHICKEN files relative to ./output
21#
22# See: https://bugs.call-cc.org/ticket/1792
23
24# Respect CHICKEN_REPOSITORY_PATH if set in the environment
25CHICKEN_REPOSITORY_PATH ?= $(shell env -i chicken-install -repository)
26
27export CHICKEN_INSTALL_PREFIX := $(CURDIR)/output
28export CHICKEN_INSTALL_REPOSITORY := $(CURDIR)/output
29export CHICKEN_REPOSITORY_PATH := $(CURDIR)/output:$(CHICKEN_REPOSITORY_PATH)
30
31# Optional dependency vendoring to build without network access
32#
33# Release tarballs include vendored dependencies (see make dist).
34
35VENDOR_DIRECTORY = $(CURDIR)/vendor
36ifneq ($(wildcard $(VENDOR_DIRECTORY)/*),)
37	VENDORED=1
38endif
39
40all:
41ifdef VENDORED
42	chicken-install -location $(VENDOR_DIRECTORY) $(shell ls $(VENDOR_DIRECTORY))
43endif
44	chicken-install $(INSTALL_FLAGS)
45
46check: export EDWARD=$(CHICKEN_INSTALL_PREFIX)/bin/edward
47check:
48	chicken-install -test
49	@./tests/integration/run.sh
50	@./tests/interactive/run.sh
51
52bench:
53	csi -quiet -script benchmarks/run.scm
54
55install:
56	install -Dm755 $(CHICKEN_INSTALL_PREFIX)/bin/edward "$(DESTDIR)$(BINDIR)/edward"
57	install -Dm644 README.md "$(DESTDIR)$(DOCDIR)/README.md"
58
59vendor:
60	env -i CHICKEN_EGG_CACHE=$(VENDOR_DIRECTORY) chicken-install -r -recursive -test
61	find $(VENDOR_DIRECTORY) \( -name STATUS -a -type f \) -exec rm {} +
62# XXX: Make sure to remove the vendor directory before running `make dist`.
63# As libraries are, unfortunately, build within the vendor directory.
64dist: VERSION = $(shell git describe --tags)
65dist: vendor
66	mkdir -p edward-$(VERSION)
67	cp -R LICENSE.txt GNUmakefile README.md bin edward.egg lib tests vendor edward-$(VERSION)
68	tar -czf edward-$(VERSION).tar.gz edward-$(VERSION)
69	rm -rf edward-$(VERSION)
70
71.PHONY: all check bench install vendor dist