about summary refs log tree commit diff stats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile51
1 files changed, 37 insertions, 14 deletions
diff --git a/Makefile b/Makefile index 0b8e141..2be0ca1 100644 --- a/Makefile +++ b/Makefile
@@ -1,40 +1,63 @@
1NAME = jimmy 1NAME = jimmy
2 2
3LIBS = read emit util
4
5BUILD = $(PWD)/build
6SRC = $(PWD)/src
7
3CSC = /usr/bin/csc 8CSC = /usr/bin/csc
4CSI = /usr/bin/csi 9CSI = /usr/bin/csi
5CSC_OPTIONS = \ 10CSC_OPTIONS = \
11 -setup-mode \
6 -host \ 12 -host \
7 -D compiling-extension \ 13 -D compiling-extension \
8 -emit-all-import-libraries \ 14 -emit-all-import-libraries \
9 -dynamic \ 15 -dynamic \
10 -regenerate-import-libraries \ 16 -regenerate-import-libraries \
11 -setup-mode \
12 -I $(PWD) \ 17 -I $(PWD) \
13 -C -I$(PWD) \ 18 -C -I$(PWD)
14 19
15CSC_OPTIONS_EXTRA = \ 20CSC_OPTIONS_EXTRA = \
16 -X utf8 \ 21 -X utf8 \
17 -X module-declarations 22 -X module-declarations
18 23
19BUILD = $(PWD)/build 24## Library dependency graph
25# here's a convenience macro
26lib = $(BUILD)/$(NAME).$(1).so
27# and another
28src = $(SRC)/$(1).scm
29
30LIBS_ = $(foreach l,$(LIBS),$(call lib,$(l)))
31
32## Phonies
20 33
21.PHONY: all test 34.PHONY: build test clean
22build: $(patsubst src/%.scm,$(BUILD)/%.so,$(wildcard src/*.scm)) 35build: $(LIBS_)
36 -mv *.import.scm build/
23 37
24test: build 38test: build
25 $(CSI) -s $(PWD)/tests/run.scm $(NAME) 39 cd $(BUILD) && \
40 $(CSI) -setup-mode -s tests/run.scm $(NAME)
26 41
27# Program! 42clean:
43 -rm -rf $(BUILD)
28 44
29# Libraries! 45install:
46 chicken-install -s
47
48uninstall:
49 chicken-uninstall -s
30 50
31$(BUILD)/%.so: src/%.scm 51# Scm -> So
52
53$(BUILD)/$(NAME).%.so: src/%.scm
32 mkdir -p "$(dir $@)" 54 mkdir -p "$(dir $@)"
33 $(CSC) $(CSC_OPTIONS) $(CSC_OPTIONS_EXTRA) $< -o $@ 55 $(CSC) $(CSC_OPTIONS) $(CSC_OPTIONS_EXTRA) $< -o $@
34 56
35## Library dependency graph 57# Libraries!
36# here's a convenience macro 58$(call lib,util): $(call src,util)
37lib = $(BUILD)/$(NAME).$(1).so
38 59
39$(call lib,read): $(call lib,util) 60$(call lib,read): $(call src,read) $(call lib,util)
40$(call lib,emit): $(call lib,util) 61$(call lib,emit): $(call src,emit) $(call lib,util)
62
63# Program!