~brenns10/funlisp

f2265065a455d5a5ce88663dab91f796598f4579 — Stephen Brennan 2 years ago 6b0aee0
Add install, uninstall, and package targets. Closes #17
4 files changed, 48 insertions(+), 4 deletions(-)

M .gitignore
M Makefile
M Makefile.conf
M doc/conf.py
M .gitignore => .gitignore +4 -1
@@ 8,7 8,10 @@ GTAGS
GRTAGS
GPATH
tags
doc/_build
doc/xml
doc/.doctrees
html
man
funlisp-*.tar.gz
syntax: regexp
(.*/)?\#[^/]*\#$

M Makefile => Makefile +41 -2
@@ 8,6 8,9 @@ include Makefile.conf
OBJS=src/builtins.o src/charbuf.o src/gc.o src/hashtable.o src/iter.o \
     src/parse.o src/ringbuf.o src/types.o src/util.o

# https://semver.org
VERSION=0.1.0

all: bin/libfunlisp.a FORCE

.c.o:


@@ 31,6 34,30 @@ bin/call_lisp: tools/call_lisp.o bin/libfunlisp.a
clean: FORCE
	rm -rf bin/* src/*.o tools/*.o

# Meant to be run after downloading the source tarball. This has an un-expressed
# dependency on `man/funlisp.3`, since the source tarball includes generated
# documentation, while the git repository does not. Leaving that dependency out
# allows the source tarball to be installed on a wide variety of POSIX compliant
# machines. Depends on the variables (set in Makefile.conf):
#   DESTDIR: specifies alternative root of installation, typically /
#   PREFIX: typically usr
# Taken together, the usual location for the binary is /usr/lib/libfunlisp.a
install: bin/libfunlisp.a
	install -d $(DESTDIR)$(PREFIX)/lib/
	install -m 644 bin/libfunlisp.a $(DESTDIR)$(PREFIX)/lib/
	install -d $(DESTDIR)$(PREFIX)/include/
	install -m 644 inc/funlisp.h $(DESTDIR)$(PREFIX)/include/
	install -d $(DESTDIR)$(PREFIX)/share/man/man3/
	install -m 644 man/funlisp.3 $(DESTDIR)$(PREFIX)/share/man/man3/

# For uninstallation of the library. Should be kept in sync with the above
# installation files. Depends on the same variables.
uninstall: FORCE
	@echo 'Sorry to see you go!'
	rm $(DESTDIR)$(PREFIX)/lib/libfunlisp.a
	rm $(DESTDIR)$(PREFIX)/include/funlisp.h
	rm $(DESTDIR)$(PREFIX)/share/man/man3/funlisp.3

FORCE:
	@true



@@ 40,12 67,24 @@ FORCE:
#
doc: FORCE
	doxygen
	make -C doc html man
	sphinx-build -d doc/.doctrees -b html doc html
	sphinx-build -d doc/.doctrees -b man doc man

clean_doc:
	rm -rf doc/xml
	rm -rf doc/xml man html
	make -C doc clean

# Create a distribution package, with generated manual and html included. The
# --transform argument ensures that when the tarball is extracted, all files are
# within a subdirectory.
package: FORCE clean doc
	tar --transform='s/^/funlisp-$(VERSION)\//' -cvf funlisp-$(VERSION).tar.gz \
		LICENSE.txt README.md \
		Makefile Makefile.conf Makefile.conf.dev Makefile.dep \
		Doxyfile doc/*.rst doc/Makefile doc/conf.py doc/requirements.txt \
		html man \
		inc/*.h src/*.c src/*.h tools/*.c scripts/*.lisp bin/.gitkeep

serve_doc: doc
	cd doc/_build/html; python -m http.server --bind 0.0.0.0 8080


M Makefile.conf => Makefile.conf +2 -0
@@ 1,3 1,5 @@
# A minimal, portable Makefile.conf for distribution
CC=cc
CFLAGS=-Iinc
DESTDIR=/
PREFIX=usr

M doc/conf.py => doc/conf.py +1 -1
@@ 150,7 150,7 @@ latex_documents = [
# (source start file, name, description, authors, manual section).
man_pages = [
    (master_doc, 'funlisp', 'funlisp Documentation',
     [author], 1)
     [author], 3)
]