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