diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 51 |
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 @@ | |||
1 | NAME = jimmy | 1 | NAME = jimmy |
2 | 2 | ||
3 | LIBS = read emit util | ||
4 | |||
5 | BUILD = $(PWD)/build | ||
6 | SRC = $(PWD)/src | ||
7 | |||
3 | CSC = /usr/bin/csc | 8 | CSC = /usr/bin/csc |
4 | CSI = /usr/bin/csi | 9 | CSI = /usr/bin/csi |
5 | CSC_OPTIONS = \ | 10 | CSC_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 | ||
15 | CSC_OPTIONS_EXTRA = \ | 20 | CSC_OPTIONS_EXTRA = \ |
16 | -X utf8 \ | 21 | -X utf8 \ |
17 | -X module-declarations | 22 | -X module-declarations |
18 | 23 | ||
19 | BUILD = $(PWD)/build | 24 | ## Library dependency graph |
25 | # here's a convenience macro | ||
26 | lib = $(BUILD)/$(NAME).$(1).so | ||
27 | # and another | ||
28 | src = $(SRC)/$(1).scm | ||
29 | |||
30 | LIBS_ = $(foreach l,$(LIBS),$(call lib,$(l))) | ||
31 | |||
32 | ## Phonies | ||
20 | 33 | ||
21 | .PHONY: all test | 34 | .PHONY: build test clean |
22 | build: $(patsubst src/%.scm,$(BUILD)/%.so,$(wildcard src/*.scm)) | 35 | build: $(LIBS_) |
36 | -mv *.import.scm build/ | ||
23 | 37 | ||
24 | test: build | 38 | test: 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! | 42 | clean: |
43 | -rm -rf $(BUILD) | ||
28 | 44 | ||
29 | # Libraries! | 45 | install: |
46 | chicken-install -s | ||
47 | |||
48 | uninstall: | ||
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) |
37 | lib = $(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! | ||