From e0803e4c3d82a9342982a93792e6777833ef6d85 Mon Sep 17 00:00:00 2001 From: Pavel Kulyov Date: Wed, 1 Oct 2025 14:35:37 +0300 Subject: [PATCH 1/4] Add project-local dependencies installation --- Makefile | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Makefile b/Makefile index 50cd21a..2d52282 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,22 @@ CHICKEN_C = csc CSC_FLAGS += -K prefix +CHICKEN_INSTALL = chicken-install MODULES = sexc fmt-c fmt-c-writer semen sex-macros sex-modules sex-reader utils OBJ = $(MODULES:%=%.o) +DEPSFILE = dependencies.txt +DEPSLOCK = .eggs.lock + +DEPENDENCIES = $(shell cat $(DEPSFILE)) +CHICKEN_EXTERNAL_REPOSITORY := $(shell chicken-install -repository) + +export CHICKEN_EGG_CACHE=$(abspath .eggs)/cache +export CHICKEN_REPOSITORY_PATH=$(abspath .eggs):$(CHICKEN_EXTERNAL_REPOSITORY) +export CHICKEN_INSTALL_REPOSITORY=$(abspath .eggs) + +all: sexc + sexc: main.o $(OBJ) $(CHICKEN_C) $(CSC_FLAGS) $^ -o $@ @@ -17,5 +30,20 @@ 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 +run-tests: sex-tests + ./sex-tests + +.eggs.lock: $(DEPSFILE) + env | grep CHICKEN + $(CHICKEN_INSTALL) $(DEPENDENCIES) + touch $(DEPSLOCK) + +deps: $(DEPSLOCK) + clean: rm -f $(OBJ) sexc sex-tests main.o ./tests/sex-tests.o + +depclean: + rm -rf .eggs $(DEPSLOCK) + +.PHONY: all deps depclean clean -- 2.52.0 From 601b687d1b3e315908e1594c65969b197d8f7e36 Mon Sep 17 00:00:00 2001 From: Pavel Kulyov Date: Sat, 27 Sep 2025 20:16:45 +0300 Subject: [PATCH 2/4] Update gitignore --- .gitignore | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b53963d..8457898 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,8 @@ -*.o +# Chicken dependencies +/.eggs +/.eggs.lock + +# Compilation artifacts sexc sex-tests +*.o -- 2.52.0 From 37ec122054c42952dd61f74eb4f535f3a44c0e7c Mon Sep 17 00:00:00 2001 From: Pavel Kulyov Date: Fri, 31 Oct 2025 15:57:32 +0300 Subject: [PATCH 3/4] readme: add docs about static compilation --- Readme.org | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Readme.org b/Readme.org index fc041b4..bcdc5cc 100644 --- a/Readme.org +++ b/Readme.org @@ -21,7 +21,16 @@ https://wiki.call-cc.org/man/5/Extension%20tools#changing-the-repository-locatio ~chicken-install `cat dependencies.txt`~ ** Compilation -~make~ +#+begin_src sh + make +#+end_src + +** Static compilation +If you want to make a self-contained binary, you'll need `chicken` with `libchicken.a` installed. + +#+begin_src sh + CSC_FLAGS=-static make +#+end_src * Usage ** Summary -- 2.52.0 From 7c0b511aeb2e8db22588ad2e996ec97aceca2bfd Mon Sep 17 00:00:00 2001 From: Pavel Kulyov Date: Fri, 31 Oct 2025 15:57:55 +0300 Subject: [PATCH 4/4] 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 -- 2.52.0