From 7c0b511aeb2e8db22588ad2e996ec97aceca2bfd Mon Sep 17 00:00:00 2001 From: Pavel Kulyov Date: Fri, 31 Oct 2025 15:57:55 +0300 Subject: [PATCH] infra: pepper some GNU on top of Makefile --- Makefile | 13 +++++++++++++ Readme.org | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/Makefile b/Makefile index 2d52282..007079a 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,10 @@ CHICKEN_C = csc CSC_FLAGS += -K prefix CHICKEN_INSTALL = chicken-install +prefix ?= /usr/local +exec_prefix ?= $(prefix) +bindir ?= $(exec_prefix)/bin + MODULES = sexc fmt-c fmt-c-writer semen sex-macros sex-modules sex-reader utils OBJ = $(MODULES:%=%.o) @@ -26,6 +30,15 @@ main.o: main.scm %.o: %.scm $(CHICKEN_C) $(CSC_FLAGS) $< -e -c -o $@ +install: sexc installdirs + install -m 755 ./sexc $(bindir) + +installdirs: + mkdir -pv $(bindir) + +uninstall: + rm -fv $(bindir)/sexc + sex-tests: $(OBJ) tests/*.scm cd ./tests && $(CHICKEN_C) $(CSC_FLAGS) run.scm -c -o sex-tests.o $(CHICKEN_C) $(CSC_FLAGS) $(OBJ) ./tests/sex-tests.o -o sex-tests diff --git a/Readme.org b/Readme.org index bcdc5cc..fbc586c 100644 --- a/Readme.org +++ b/Readme.org @@ -32,6 +32,14 @@ If you want to make a self-contained binary, you'll need `chicken` with `libchic CSC_FLAGS=-static make #+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