cl: Dump a core image to improve startup times.
[fringe] / Makefile
CommitLineData
2bd37ef1
MW
1### Makefile for same-fringe implementations.
2
3###--------------------------------------------------------------------------
4### Notes about organization.
5###
6### Most projects have lots of stuff in just a few languages, so it makes
7### sense to put the language configuration in one place. This one's
8### different. Its entire purpose is to demonstrate lots of different
9### approaches.
10###
11### So, at the top we declare the main targets; then each language has its
12### configuration and build rules.
13
14.SUFFIXES: .o
15LANGS =
16TARGETS = $(patsubst %,%-fringe,$(LANGS))
17CLEANFILES = $(TARGETS)
18
19all::
20clean::; rm -f $(CLEANFILES)
21
22###--------------------------------------------------------------------------
23### Testing.
24
25CLEANFILES += test.*
26test:: all
b3cbee25
MW
27 @win=0 lose=0; \
28 for lang in $(LANGS); do \
29 echo >&3 "*** $$lang"; \
30 printf "Test $$lang..."; \
31 time=`command time -o/dev/stdout -f "%U user; %S system; %E" \
32 ./test ./$${lang}-fringe 2>&3`; \
33 if [ $$? -eq 0 ]; then \
34 win=$$(expr $$win + 1); \
35 printf " ok ($$time)\n"; \
36 else \
37 lose=$$(expr $$lose + 1); \
38 printf " FAILED\n"; \
39 fi; \
40 done 3>test.log; \
41 if [ $$lose -eq 0 ]; then \
42 echo "All $$win test(s) OK"; \
43 else \
44 echo "FAILED $$lose test(s)!"; \
45 exit 1; \
2bd37ef1
MW
46 fi
47
48###--------------------------------------------------------------------------
49### C.
50
51CC = gcc
52CFLAGS = -O2 -g -pedantic -Wall
53CLEANFILES += *.o
54.SUFFIXES: .c
55.c.o:; $(CC) -c $(CFLAGS) -o $@ $<
56
57LANGS += c
58c-fringe: c-fringe.o
59 $(CC) -o $@ $^
60
61###--------------------------------------------------------------------------
62### Haskell.
63
64HC = ghc
65HFLAGS = -O2 -XFlexibleInstances
66CLEANFILES += *.hi *.hc
67.SUFFIXES: .hs
68.hs.o:; $(HC) -c $(HFLAGS) -o $@ $<
69
70LANGS += haskell
71haskell-fringe: haskell-fringe.o
72 $(HC) -o $@ $^
73
74###--------------------------------------------------------------------------
75### Icon.
76
77ICONT = icont
78IFLAGS = -u -fa
79
80LANGS += icon
81icon-fringe: icon-fringe.icn
82 $(ICONT) -o $@ $^
83
84###--------------------------------------------------------------------------
85### Common Lisp.
86
a72b6978
MW
87CLEANFILES += *.core
88
2bd37ef1
MW
89LANGS += cl
90cl-fringe: cl-fringe.lisp
a72b6978
MW
91## cl-launch -R -o $@ -f `pwd`/$^ -- slow to start
92 cl-launch -o $@ -f `pwd`/$^ +I -r launch -d $@.core
2bd37ef1
MW
93
94###--------------------------------------------------------------------------
95### F#.
96
97FSC = fsc
98CLEANFILES += *.exe
99.SUFFIXES: .fs .exe
100.fs.exe:; fsc -o $@ $<
101
102LANGS += f\#
103f\#-fringe: f\#-fringe.exe
104 chmod +x $<
105 cp $< $@
106
107###--------------------------------------------------------------------------
108### Scheme.
109
110SCMC = csc
111SCMFLAGS = -c -O2
112.SUFFIXES: .scm .o
113.scm.o:; $(SCMC) $(SCMFLAGS) -o $@ $<
114
115LANGS += scheme
116scheme-fringe: scheme-fringe.o
117 $(SCMC) -o $@ $^
118
119###--------------------------------------------------------------------------
120### Smalltalk.
121
122LANGS += smalltalk
123TARGETS += smalltalk-fringe.im
124smalltalk-fringe.im: smalltalk-fringe.st
125 echo "ObjectMemory snapshot: '$@.new'" | gst $^ -
126 mv $@.new $@
127smalltalk-fringe:
128 { echo '#! /bin/sh'; \
129 echo '"exec" "gst" "-I" "$@.im" "-f" "$$0" "$$@"'; \
130 echo 'ObjectMemory quit: (Node main: Smalltalk arguments)'; \
131 } >$@.new
132 chmod +x $@.new
133 mv $@.new $@
134
135###----- That's all, folks --------------------------------------------------
136
137all:: $(TARGETS)