Compare commits
5 Commits
review-fix
...
bfaba8ac44
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bfaba8ac44 | ||
|
|
731ccc7c6b | ||
|
|
c1fd43c8f0 | ||
|
|
4a0ac30701 | ||
|
|
7ff1f68ffe |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,3 +1,7 @@
|
|||||||
|
# Project-local Chicken egg repository
|
||||||
|
/.eggs
|
||||||
|
|
||||||
|
# Compilation artifacts
|
||||||
*.o
|
*.o
|
||||||
*.import.scm
|
*.import.scm
|
||||||
*.link
|
*.link
|
||||||
|
|||||||
50
Makefile
50
Makefile
@@ -11,6 +11,16 @@ CSC_FLAGS += -K prefix -static
|
|||||||
# "during expansion of (import ...) - cannot import from undefined module: sex-macros"
|
# "during expansion of (import ...) - cannot import from undefined module: sex-macros"
|
||||||
# error.
|
# error.
|
||||||
# -c: Stop after compilation to object files. This one is obvious.
|
# -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
|
MODULE_FLAGS = -emit-all-import-libraries -module-registration -c
|
||||||
|
|
||||||
@@ -18,6 +28,18 @@ MODULE_FLAGS = -emit-all-import-libraries -module-registration -c
|
|||||||
MODULES = utils types sex-macros reader sex-modules semen sex-fmt-c fmt-c-writer sexc
|
MODULES = utils types sex-macros reader sex-modules semen sex-fmt-c fmt-c-writer sexc
|
||||||
OBJ = $(MODULES:%=%.o)
|
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: $(OBJ) main.scm
|
sexc: $(OBJ) main.scm
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) main.scm -o sexc-tmp -link sexc
|
$(CHICKEN_C) $(CSC_FLAGS) main.scm -o sexc-tmp -link sexc
|
||||||
# otherwise csc hangs, probably because it tries to compile to sexc.o first
|
# otherwise csc hangs, probably because it tries to compile to sexc.o first
|
||||||
@@ -74,6 +96,28 @@ check-exit-code: sexc
|
|||||||
run-tests: sexc sex-tests sextest
|
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
|
./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
|
||||||
|
|
||||||
|
.eggs.lock: $(DEPSFILE)
|
||||||
|
env | grep CHICKEN
|
||||||
|
$(CHICKEN_INSTALL) $(DEPENDENCIES)
|
||||||
|
touch $(DEPSLOCK)
|
||||||
|
|
||||||
|
deps: $(DEPSLOCK)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(OBJ) main.o
|
rm -f $(OBJ) main.o
|
||||||
rm -f *.import.scm
|
rm -f *.import.scm
|
||||||
@@ -81,4 +125,8 @@ clean:
|
|||||||
rm -f sexc sex-tests sextest
|
rm -f sexc sex-tests sextest
|
||||||
$(MAKE) -C ./tests/modules clean
|
$(MAKE) -C ./tests/modules clean
|
||||||
|
|
||||||
.PHONY: clean 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
|
||||||
|
|||||||
42
Readme.org
42
Readme.org
@@ -12,16 +12,42 @@ Sex is statically typed, compiled general purpose language.
|
|||||||
First, get yourself a Chicken, then, some Chicken deps. You also will
|
First, get yourself a Chicken, then, some Chicken deps. You also will
|
||||||
need a C compiler.
|
need a C compiler.
|
||||||
|
|
||||||
** Install Chicken Eggs
|
Eggs are installed into a project-local ~.eggs/~ repository; they do not
|
||||||
Tip: there's a way to make Chicken install eggs non-globally. You need
|
touch the Chicken system repository.
|
||||||
to export ~CHICKEN_INSTALL_REPOSITORY~ and ~CHICKEN_REPOSITORY_PATH~
|
|
||||||
environment variables. Refer to the documentation for more info:
|
|
||||||
https://wiki.call-cc.org/man/5/Extension%20tools#changing-the-repository-location
|
|
||||||
|
|
||||||
~chicken-install `cat dependencies.txt`~
|
|
||||||
|
|
||||||
** Compilation
|
** Compilation
|
||||||
~make~
|
#+begin_src sh
|
||||||
|
make
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
That installs pinned eggs from ~eggs.lock~ into ~.eggs/~ if needed, then
|
||||||
|
builds ~sexc~. ~dependencies.txt~ is the unpinned request list. To
|
||||||
|
refresh ~eggs.lock~ after changing it:
|
||||||
|
|
||||||
|
#+begin_src sh
|
||||||
|
make deps-update
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Static compilation
|
||||||
|
The default ~CSC_FLAGS~ include ~-static~, so ~sexc~ does not need
|
||||||
|
~.eggs~ at runtime and ~make install~ stays relocatable. Chicken must
|
||||||
|
provide ~libchicken.a~ (E.g. for gentoo: ~dev-scheme/chicken~ with
|
||||||
|
~static-libs~ use flag).
|
||||||
|
|
||||||
|
To link dynamically instead (the binary will look for eggs under this
|
||||||
|
tree's ~.eggs~ path):
|
||||||
|
|
||||||
|
#+begin_src sh
|
||||||
|
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
|
* Usage
|
||||||
** Summary
|
** Summary
|
||||||
|
|||||||
@@ -46,3 +46,5 @@ clean:
|
|||||||
rm -f *.import.scm
|
rm -f *.import.scm
|
||||||
rm -f *.link
|
rm -f *.link
|
||||||
rm -f sex-tests
|
rm -f sex-tests
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
|||||||
Reference in New Issue
Block a user