1 ### Makefile for same-fringe implementations.
3 ###--------------------------------------------------------------------------
4 ### Notes about organization.
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
11 ### So, at the top we declare the main targets; then each language has its
12 ### configuration and build rules.
17 TARGETS
= $(patsubst %,%-fringe
,$(LANGS
))
18 CLEANFILES
= $(TARGETS
)
21 clean::; rm -f
$(CLEANFILES
)
23 ###--------------------------------------------------------------------------
24 ### Silent rules stuff.
26 ## Default verbosity setting.
30 v_echo
= $(call v_echo_
$V,$1)
32 v_echo_0
= @printf
" %-6s %s\n" "$1" "$@";
36 ###--------------------------------------------------------------------------
42 for lang in
$(LANGS
); do \
43 echo
>&3 "*** $$lang"; \
44 printf
"Test $$lang..."; \
45 time
=`command time -o/dev/stdout -f "%U user; %S system; %E" \
46 ./test ./$${lang}-fringe 2>&3`; \
47 if
[ $$?
-eq
0 ]; then \
48 win
=$$(expr
$$win + 1); \
49 printf
" ok ($$time)\n"; \
51 lose
=$$(expr
$$lose + 1); \
55 if
[ $$lose -eq
0 ]; then \
56 echo
"All $$win test(s) OK"; \
58 echo
"FAILED $$lose test(s)!"; \
62 ###--------------------------------------------------------------------------
66 wc
-l
$(SOURCES
) |
sort -n
68 ###--------------------------------------------------------------------------
72 CFLAGS
= -O2
-g
-pedantic
-Wall
75 .c.o
:; $(call v_echo
,CC
)$(CC
) -c
$(CFLAGS
) -o
$@
$<
80 $(call v_echo
,CCLD
)$(CC
) -o
$@
$^
82 ###--------------------------------------------------------------------------
87 CLEANFILES
+= *.hi
*.hc
89 .hs.o
:; $(call v_echo
,HC
)$(HC
) -c
$(HFLAGS
) -o
$@
$<
92 SOURCES
+= haskell-fringe.hs
93 haskell-fringe
: haskell-fringe.o
94 $(call v_echo
,HCLD
)$(HC
) -o
$@
$^
96 ###--------------------------------------------------------------------------
103 SOURCES
+= icon-fringe.icn
104 icon-fringe
: icon-fringe.icn
105 $(call v_echo
,ICONT
)$(ICONT
) $(IFLAGS
) -o
$@
$^
107 ###--------------------------------------------------------------------------
110 CLEANFILES
+= *.core
*.fasl
112 .SUFFIXES
: .lisp .fasl
114 $(call v_echo
,CL
)sbcl
--noinform
--eval \
115 '(quit :unix-status (if (compile-file "$<" :verbose nil :print nil) 0 1))'
118 SOURCES
+= cl-fringe.lisp
119 cl-fringe
: cl-fringe.fasl
120 $(call v_echo
,CP
)cp
$< $@.new
&& chmod
+x
$@.new
&& mv
$@.new
$@
121 ## $(call v_echo,CL)cl-launch -o $@ -f `pwd`/$^ +I -r launch -d $@.core
123 ###--------------------------------------------------------------------------
130 .fs.exe
:; $(call v_echo
,FSC
)$(FSC
) --nologo
$(FSCFLAGS
) -o
$@
$<
133 SOURCES
+= f\
#-fringe.fs
134 f\
#-fringe: f\#-fringe.exe
135 $(call v_echo
,CP
)chmod
+x
$< && cp
$< $@
137 ###--------------------------------------------------------------------------
143 .scm.o
:; $(call v_echo
,SCMC
)$(SCMC
) $(SCMFLAGS
) -o
$@
$<
146 SOURCES
+= scheme-fringe.scm
147 scheme-fringe
: scheme-fringe.o
148 $(call v_echo
,SCMLD
)$(SCMC
) -o
$@
$^
150 ###--------------------------------------------------------------------------
156 CLEANFILES
+= *.
$(GOOBJ
)
157 .SUFFIXES
: .
$(GOOBJ
) .go
158 .go.
$(GOOBJ
):; $(call v_echo
,GOC
)$(GOC
) $(GOFLAGS
) $<
161 SOURCES
+= go-fringe.go
162 go-fringe
: go-fringe.
$(GOOBJ
)
163 $(call v_echo
,GOLD
)$(GOLINK
) -o
$@
$^
165 ###--------------------------------------------------------------------------
169 TARGETS
+= smalltalk-fringe.im
170 SOURCES
+= smalltalk-fringe.st
171 smalltalk-fringe.im
: smalltalk-fringe.st
172 $(call v_echo
,GSTIM
)echo
"ObjectMemory snapshot: '$@.new'" | gst
$^
-
173 $(V_HIDE
)mv
$@.new
$@
175 $(call v_echo
,GENSH
){ echo
'#! /bin/sh'; \
176 echo
'"exec" "gst" "-I" "$@.im" "-f" "$$0" "$$@"'; \
177 echo
'ObjectMemory quit: (Node main: Smalltalk arguments)'; \
179 $(V_HIDE
)chmod
+x
$@.new
&& mv
$@.new
$@
181 ###--------------------------------------------------------------------------
185 TARGETS
+= forth-fringe
186 SOURCES
+= forth-fringe.fth
187 forth-fringe
: forth-fringe.fth
188 $(call v_echo
,FORTHI
)gforthmi
$@
$<
190 ###--------------------------------------------------------------------------
194 CLEANFILES
+= *.beam erl_crash.dump
195 .SUFFIXES
: .erl .beam
196 .erl.beam
:; $(call v_echo
,ERLC
)$(ERLC
) $(ERLCFLAGS
) $<
199 TARGETS
+= erl-fringe.beam
200 SOURCES
+= erl-fringe.erl
202 $(call v_echo
,GENSH
){ echo
'#! /bin/sh'; \
203 echo
'exec erl -pa . -noshell -run erl-fringe main -extra "$$@"'; \
205 $(V_HIDE
)chmod
+x
$@.new
&& mv
$@.new
$@
207 ###----- That's all, folks --------------------------------------------------