aboutsummaryrefslogtreecommitdiff
path: root/src/boot/Makefile.in
blob: 262d6d8f6779cd5937ae330c835789cd45b68688 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
AXIOM_LOCAL_LISP_sources = initial-env.lisp
AXIOM_LOCAL_LISP = ../lisp/base-lisp$(EXEEXT)
PROCLAIMS=(load "$(srcdir)/boot-proclaims.lisp")

boot_objects = initial-env.$(FASLEXT) $(boot_sources:.boot=.$(FASLEXT))

boot_SOURCES = \
	initial-env.lisp.pamphlet \
	$(addsuffix .pamphlet, $(boot_sources))

pamphlets = Makefile.pamphlet $(boot_SOURCES)
boot_sources = tokens.boot includer.boot scanner.boot \
	pile.boot ast.boot parser.boot  translator.boot

boot_clisp = $(boot_sources:.boot=.clisp)
boot_data = $(boot_sources:.boot=.data)
boot_fn = $(boot_sources:.boot=.fn)
boot_cached_clisp = $(boot_sources:.boot=.clisp)

COMPILE_LISP = \
	$(axiom_build_document) --tag=lisp --mode=compile --output=$@

BOOT_TO_LISP = \
	$(axiom_build_document) --tag=boot --mode=translate \
	--use=./prev-stage/bootsys $<

subdir = src/boot/
 
.PHONY: all-ax all-boot
all: all-ax all-boot

all-ax all-boot: stamp

stamp: $(axiom_build_bindir)/bootsys$(EXEEXT)
	@rm -f stamp
	$(STAMP) $@

$(axiom_build_bindir)/bootsys$(EXEEXT): stage2/bootsys$(EXEEXT)
	$(mkinstalldirs) $(axiom_build_bindir)
	$(INSTALL_PROGRAM) stage2/bootsys$(EXEEXT) $(axiom_build_bindir)

.PRECIOUS: stage0/%.clisp
.PRECIOUS: stage0/%.$(FASLEXT)

stage0_boot_clisp = $(addprefix stage0/, $(boot_clisp))

stage0_boot_objects = $(addprefix stage0/, $(boot_objects))

stage0/stamp: stage0/bootsys$(EXEEXT)
	@rm -f $@
	@$(STAMP) $@

stage0/bootsys$(EXEEXT): $(stage0_boot_objects)
	$(AXIOM_LOCAL_LISP) -- --make --main="|AxiomCore|::|topLevel|"\
		 --output=$@ --load-directory=stage0 \
		$(stage0_boot_objects)


.PRECIOUS: %/.started
%/.started:
	$(mkinstalldirs) $*
	$(STAMP) $@

$(stage0_boot_objects): $(AXIOM_LOCAL_LISP)

stage0/%.clisp: $(srcdir)/%.boot.pamphlet stage0/.started
	$(axiom_build_document) --tangle=$*.clisp --output=$@ $<

%/initial-env.$(FASLEXT): initial-env.lisp %/.started
	$(AXIOM_LOCAL_LISP) -- --compile --output=$@ $<

.PRECIOUS: stage1/%.$(FASLEXT)
.PRECIOUS: stage1/%.clisp

stage1/stamp: stage1/bootsys$(EXEEXT)
	rm -f $@
	$(STAMP) $@

stage1/bootsys$(EXEEXT): $(addprefix stage1/, $(boot_objects))
	$(AXIOM_LOCAL_LISP) -- --make --main="|AxiomCore|::|topLevel|" \
		 --output=$@ --load-directory=stage1 \
		$(addprefix stage1/, $(boot_objects))

stage1/%.clisp: %.boot stage0/stamp stage1/.started
	stage0/bootsys -- --translate --output=$@ $<

.PRECIOUS: stage2/%.$(FASLEXT)
.PRECIOUS: stage2/%.clisp

stage2/stamp: stage2/bootsys$(EXEEXT)
	@echo Building stage 2
	$(STAMP) $@

stage2/bootsys$(EXEEXT): $(addprefix stage2/, $(boot_objects))
	$(AXIOM_LOCAL_LISP) -- --make --main="|AxiomCore|::|topLevel|" \
		--output=$@ --load-directory=stage2 \
		$(addprefix stage2/, $(boot_objects))

stage2/%.clisp: %.boot stage1/stamp stage2/.started
	stage1/bootsys -- --translate --output=$@ $<

## Dependency for various modules.  
## FIXME: This should be automatically extracted from the
## Boot source file at packaging time.

%/tokens.$(FASLEXT): %/tokens.clisp %/initial-env.$(FASLEXT)
	$(AXIOM_LOCAL_LISP) -- --compile --load-directory=$* $<

%/includer.$(FASLEXT): %/includer.clisp %/tokens.$(FASLEXT)
	$(AXIOM_LOCAL_LISP) -- --compile --load-directory=$* $<

%/scanner.$(FASLEXT): %/scanner.clisp %/tokens.$(FASLEXT) %/includer.$(FASLEXT)
	$(AXIOM_LOCAL_LISP) -- --compile --load-directory=$* $<

%/pile.$(FASLEXT): %/pile.clisp %/scanner.$(FASLEXT) %/includer.$(FASLEXT)
	$(AXIOM_LOCAL_LISP) -- --compile --load-directory=$* $<

%/ast.$(FASLEXT): %/ast.clisp %/includer.$(FASLEXT)
	$(AXIOM_LOCAL_LISP) -- --compile --load-directory=$* $<

%/parser.$(FASLEXT): %/parser.clisp %/ast.$(FASLEXT) %/scanner.$(FASLEXT) \
		 %/includer.$(FASLEXT)
	$(AXIOM_LOCAL_LISP) -- --compile --load-directory=$* $<

%/translator.$(FASLEXT): %/translator.clisp %/parser.$(FASLEXT) \
		%/ast.$(FASLEXT) %/pile.$(FASLEXT) %/scanner.$(FASLEXT) \
		%/includer.$(FASLEXT)
	$(AXIOM_LOCAL_LISP) -- --compile --load-directory=$* $<

.PRECIOUS: %.boot
%.boot: $(srcdir)/%.boot.pamphlet
	$(axiom_build_document) --tangle $< 
.PRECIOUS: %.boot

%.boot: $(srcdir)/%.boot.pamphlet
	$(axiom_build_document) --tangle $<
.PRECIOUS: %.lisp

initial-env.lisp: initial-env.lisp.pamphlet
	$(axiom_build_document) --tangle $<

mostlyclean-local:
	@rm -f $(axiom_build_bindir)/bootsys$(EXEEXT)
	@rm -rf prev-stage
	@rm -rf stage0 stage1 stage2
	@rm -f *.data *.fn
	@rm -f stamp

clean-local: mostlyclean-local
	@rm -f $(boot_sources)
	@rm -f *.clisp *.lisp

distclean-local: clean-local