blob: b4f54b672ef5474ad273cb9cda258387599dfb97 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
NAME = jimmy
LIBS = read emit util
BUILD = $(PWD)/build
SRC = $(PWD)/src
TESTS = $(PWD)/tests
CSC = /usr/bin/csc
CSI = /usr/bin/csi
CSC_OPTIONS = \
-setup-mode \
-host \
-D compiling-extension \
-emit-all-import-libraries \
-dynamic \
-regenerate-import-libraries \
-I $(SRC) \
-C -I$(SRC)
CSC_OPTIONS_EXTRA = \
-X utf8 \
-X module-declarations
## Library dependency graph
# here's a convenience macro
lib = $(BUILD)/$(NAME).$(1).so
# and another
src = $(SRC)/$(1).scm
LIBS_ = $(foreach l,$(LIBS),$(call lib,$(l)))
## Phonies
.PHONY: build test clean
build: $(LIBS_)
-mv *.import.scm build/
test: build
cd $(BUILD) && \
$(CSI) -setup-mode -s $(TESTS)/run.scm $(NAME)
clean:
-rm -rf $(BUILD)
install:
chicken-install -s
uninstall:
chicken-uninstall -s
# Scm -> So
$(BUILD)/$(NAME).%.so: src/%.scm
mkdir -p "$(dir $@)"
$(CSC) $(CSC_OPTIONS) $(CSC_OPTIONS_EXTRA) $< -o $@
# Libraries!
$(call lib,util): $(call src,util)
$(call lib,read): $(call src,read) $(call lib,util)
$(call lib,emit): $(call src,emit) $(call lib,util)
# Program!
|