summaryrefslogtreecommitdiffstats
path: root/eshtrans/Makefile
blob: 29e6cb349bb1eb342c4fbfc71933bfa8a14c2775 (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
SOURCES = \
	main.esh \
	common.esh \
	tokens.esh \
	backend/main.esh \
	backend/codegen.esh \
	frontend/main.esh \
	frontend/parser.esh \
	frontend/lexer.esh
OBJECTS1 = $(SOURCES:.esh=.sh1)
OBJECTS2 = $(SOURCES:.esh=.sh2) ../libeshprof/hooks.esh
OBJECTS3 = $(SOURCES:.esh=.sh3) ../libeshprof/hooks.esh

bootstrap: stage3
stage1:
	@printf 'Stage 1:\n'
	@time -p $(MAKE) eshtrans.stage1 2>&1 | sed 's/^/\t/'
stage2:
	@printf 'Stage 1:\n'
	@time -p $(MAKE) eshtrans.stage1 2>&1 | sed 's/^/\t/'
	@printf 'Stage 2:\n'
	@time -p $(MAKE) eshtrans.stage2 2>&1 | sed 's/^/\t/'
stage3:
	@printf 'Stage 1:\n'
	@time -p $(MAKE) eshtrans.stage1 2>&1 | sed 's/^/\t/'
	@printf 'Stage 2:\n'
	@time -p $(MAKE) eshtrans.stage2 2>&1 | sed 's/^/\t/'
	@printf 'Stage 3:\n'
	@time -p $(MAKE) eshtrans.stage3 2>&1 | sed 's/^/\t/'

clean: clean-stage1 clean-stage2 clean-stage3
clean-stage1:
	rm -f eshtrans.stage1 $(OBJECTS1)
clean-stage2:
	rm -f eshtrans.stage2 $(OBJECTS2)
clean-stage3:
	rm -f eshtrans.stage3 $(OBJECTS3)

.SUFFIXES:
.SUFFIXES: .esh .sh .sh1 .sh2 .sh3

eshtrans.stage1: $(OBJECTS1) Makefile
	cat $(OBJECTS1) >$@
	printf 'main "$${@}"\n' >>$@
	chmod a+x $@
eshtrans.stage2: eshtrans.stage1 $(OBJECTS2) Makefile
	../eshld/eshld -o $@ $(OBJECTS2)
eshtrans.stage3: eshtrans.stage2 $(OBJECTS3) Makefile
	../eshld/eshld -o $@ $(OBJECTS3)

$(OBJECTS1) $(OBJECTS2) $(OBJECTS3): Makefile

.esh.sh1:
	cp $< $@
.esh.sh2:
	./eshtrans.stage1 -o $@ $<
.esh.sh3:
	./eshtrans.stage2 -o $@ $<