diff --git a/Makefile b/Makefile index 40fa45f..9237137 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,15 @@ CSC_FLAGS += -K prefix -static # -c: Stop after compilation to object files. This one is obvious. CHICKEN_INSTALL = chicken-install +# GNU directory variables. Command line overrides, e.g. +# make prefix=$(HOME)/.local install +# make DESTDIR=/tmp/stage prefix=/usr install +prefix = /usr/local +exec_prefix = $(prefix) +bindir = $(exec_prefix)/bin +INSTALL = install +INSTALL_PROGRAM = $(INSTALL) + MODULE_FLAGS = -emit-all-import-libraries -module-registration -c # Order matters, since module check correctness on compilation @@ -87,6 +96,18 @@ check-exit-code: sexc run-tests: sexc sex-tests sextest ./sex-tests && ./sextest --sexc=./sexc $(SEX_TEST_PROGRAMS:%=./tests/sex-programs/%.sex) && $(MAKE) check-modules && $(MAKE) check-exit-code +install: all installdirs + $(INSTALL_PROGRAM) sexc $(DESTDIR)$(bindir)/sexc + +install-strip: + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install + +installdirs: + $(INSTALL) -d $(DESTDIR)$(bindir) + +uninstall: + rm -f $(DESTDIR)$(bindir)/sexc + run-tests: sex-tests ./sex-tests @@ -104,4 +125,8 @@ clean: rm -f sexc sex-tests sextest $(MAKE) -C ./tests/modules clean -.PHONY: clean depclean deps run-tests sex-tests sextest check-modules check-exit-code +deps-clean: + rm -rf $(EGGS_DIR) + +.PHONY: all check run-tests check-modules check-exit-code install install-strip installdirs + uninstall deps deps-update clean depsclean sex-tests sextest diff --git a/Readme.org b/Readme.org index 8b76d6a..5d1c84b 100644 --- a/Readme.org +++ b/Readme.org @@ -38,6 +38,14 @@ tree's ~.eggs~ path): make CSC_FLAGS='-K prefix' #+end_src +** Installation +#+begin_src sh + # default installation (/usr/local/bin/) + make install + # you can customize the prefix (will install to ~/.local/bin) + make prefix=~/.local install +#+end_src + * Usage ** Summary #+begin_src diff --git a/tests/Makefile b/tests/Makefile index b40a19e..7297715 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -46,3 +46,5 @@ clean: rm -f *.import.scm rm -f *.link rm -f sex-tests + +.PHONY: clean