7 _voodoo_translator_libs
='
45 test_voodoo_translator
50 bootstrap_bintargets
="$bintargets"
51 bootstrap_libtargets
="$libtargets"
92 libvoodoo_translator_sources
='
103 transmute_libs
="$_voodoo_translator_libs"
104 test_anf_transform_libs
="$_voodoo_translator_libs"
105 test_symbol_encoder_libs
="$_voodoo_translator_libs"
106 test_to_core_libs
="$_voodoo_translator_libs"
107 test_voodoo_translator_libs
="$_voodoo_translator_libs"
108 test_voodoo_writer_libs
="$_voodoo_translator_libs"
113 BOOTSTRAP_TRANSMUTE = $bootstrap_transmute
114 BOOTSTRAP_TRANSMUTE_ENV = $bootstrap_transmute_env
119 makefile_bintargets
=''
120 for target
in $bintargets
122 makefile_bintargets
="$makefile_bintargets bin/${target}"
125 echo "BINTARGETS =$makefile_bintargets"
127 makefile_libtargets
=''
128 for target
in $libtargets
130 makefile_libtargets
="$makefile_libtargets lib/lib${target}.so"
132 echo "LIBTARGETS =$makefile_libtargets"
134 makefile_testtargets
=''
135 for target
in $testtargets
137 makefile_testtargets
="$makefile_testtargets test/${target}"
140 echo "TESTTARGETS =$makefile_testtargets"
142 makefile_bootstrap_bintargets
=''
143 for target
in $bootstrap_bintargets
145 makefile_bootstrap_bintargets
="$makefile_bootstrap_bintargets bootstrap/bin/${target}"
148 echo "BOOTSTRAP_BINTARGETS =$makefile_bootstrap_bintargets"
150 makefile_bootstrap_libtargets
=''
151 for target
in $bootstrap_libtargets
153 makefile_bootstrap_libtargets
="$makefile_bootstrap_libtargets bootstrap/lib/${target}"
155 echo "BOOTSTRAP_LIBTARGETS =$makefile_bootstrap_libtargets"
157 for target
in $bintargets
159 eval "libs=\$${target}_libs"
160 [ -n "$libs" ] || libs
="$default_libs"
165 lib_depends
="${lib_depends} lib/lib${lib}.so"
166 lib_flags
="$lib_flags -l${lib}"
168 eval "sources=\$${target}_sources"
169 [ -n "$sources" ] || sources
="$target"
170 srcs
=$
(echo ${target}/*)
172 echo "${target}_lflags =$lib_flags"
173 echo "${target}_libs =$lib_depends"
174 echo "${target}_sources =$srcs"
177 for target
in $bootstrap_bintargets
179 eval "libs=\$${target}_libs"
180 [ -n "$libs" ] || libs
="$default_libs"
185 lib_depends
="${lib_depends} bootstrap/lib/lib${lib}.so"
186 lib_flags
="$lib_flags -l${lib}"
189 for source in bootstrap
/src
/${target}/*.voo
191 base
=$
(basename ${source} .voo
)
192 srcs
="$srcs bootstrap/objects/${target}/${base}.o"
195 echo "bootstrap_${target}_lflags =$lib_flags"
196 echo "bootstrap_${target}_libs =$lib_depends"
197 echo "bootstrap_${target}_objects =$srcs"
200 for target
in $libtargets
202 eval "libs=\$lib${target}_libs"
207 lib_depends
="$lib_depends lib/lib${lib}.so"
208 lib_flags
="$lib_flags -l${lib}"
210 eval "sources=\$lib${target}_sources"
211 [ -n "$sources" ] || sources
="$target"
213 for source in $sources
215 srcs
="$srcs objects/${target}/${source}.o"
218 echo "lib${target}_lflags =$lib_flags"
219 echo "lib${target}_libs =$lib_depends"
220 echo "lib${target}_objects =$srcs"
223 for target
in $bootstrap_libtargets
225 eval "libs=\$lib${target}_libs"
230 lib_depends
="$lib_depends bootstrap/lib/lib${lib}.so"
231 lib_flags
="$lib_flags -l${lib}"
233 eval "sources=\$lib${target}_sources"
234 [ -n "$sources" ] || sources
="$target"
236 for source in $sources
238 srcs
="$srcs bootstrap/objects/${target}/${source}.o"
241 echo "bootstrap_lib${target}_lflags =$lib_flags"
242 echo "bootstrap_lib${target}_libs =$lib_depends"
243 echo "bootstrap_lib${target}_objects =$srcs"
246 for target
in $testtargets
248 eval "libs=\$${target}_libs"
249 [ -n "$libs" ] || libs
="$default_libs"
254 lib_depends
="${lib_depends} lib/lib${lib}.so"
255 lib_flags
="$lib_flags -l${lib}"
257 eval "sources=\$${target}_sources"
258 [ -n "$sources" ] || sources
="$target"
260 for source in $sources
262 srcs
="$srcs objects/test/${source}.o"
265 echo "${target}_lflags =$lib_flags"
266 echo "${target}_libs =$lib_depends"
267 echo "${target}_objects =$srcs"
270 for target
in $bintargets
273 echo "bin/${target} : \$(${target}_sources) \$(${target}_libs)"
274 if [ "$target" = transmute
]
276 printf '\tenv LD_LIBRARY_PATH=bootstrap/lib bootstrap/bin/transmute -t exe -L lib -o bin/%s %s\n' "$target" "$target"
278 printf '\tenv LD_LIBRARY_PATH=lib bin/transmute -t exe -L lib -o bin/%s %s\n' "$target" "$target"
281 for target
in $bootstrap_bintargets
284 echo "bootstrap/bin/${target} : \$(bootstrap_${target}_objects) \$(bootstrap_${target}_libs)"
285 printf '\t$(CC) $(CFLAGS) $(bootstrap_%s_objects) -o bootstrap/bin/%s -Lbootstrap/lib $(bootstrap_%s_lflags) $(LDFLAGS)\n' "$target" "$target" "$target"
288 for target
in $libtargets
290 target
="lib${target}"
292 echo "lib/${target}.so : \$(${target}_objects) \$(${target}_libs)"
293 printf '\t$(CC) $(CFLAGS) -shared $(%s_objects) -o lib/%s.so -Llib $(%s_lflags)\n' "$target" "$target" "$target"
296 for target
in $bootstrap_libtargets
298 target
="lib${target}"
300 echo "bootstrap/lib/${target}.so : \$(bootstrap_${target}_objects) \$(bootstrap_${target}_libs)"
301 printf '\t$(CC) $(CFLAGS) -shared $(bootstrap_%s_objects) -o bootstrap/lib/%s.so -Lbootstrap/lib $(bootsrap_%s_lflags)\n' "$target" "$target" "$target"
304 for target
in $testtargets
307 echo "test/${target} : \$(${target}_objects) \$(${target}_libs)"
308 printf '\t$(CC) $(CFLAGS) $(%s_objects) -o test/%s -Llib $(%s_lflags) $(LDFLAGS)\n' "$target" "$target" "$target"
313 .PHONY : all check clean default distclean
315 default : $(LIBTARGETS) $(BINTARGETS)
317 all : default $(TESTTARGETS)
320 cd test && case $(SRC) in /*) $(SRC)/src/test/test;; *) ../$(SRC)/src/test/test;; esac
325 -rm -r bin generated lib bootstrap/bin bootstrap/lib bootstrap/objects objects test Makefile
327 bootstrap : bootstrap/bin/transmute
330 for target
in $bintargets $libtargets
332 for x
in "$source_dir"/bootstrap
/src
/${target}/*.voo
336 t
="bootstrap/objects/${target}/$(basename "$x" .voo).o"
337 printf '\n%s : %s\n' "$t" "$x"
338 printf '\t$(VOODOOC) %s -o %s\n' "$x" "$t"
343 for target
in $bintargets $libtargets
345 for x
in "$source_dir"/src
/${target}/*.sb
349 b
=$
(basename "$x" .sb
)
350 g
="generated/${target}/${b}.voo"
351 t
="objects/${target}/${b}.o"
352 printf '\n%s : %s\n' "$t" "$g"
353 printf '\t$(VOODOOC) %s -o %s\n' "$g" "$t"
354 printf '\n%s : $(BOOTSTRAP_TRANSMUTE) %s\n' "$g" "$x"
355 printf '\t$(BOOTSTRAP_TRANSMUTE_ENV) $(BOOTSTRAP_TRANSMUTE) < %s > %s\n' "$x" "$g"
360 for x
in "$source_dir"/src
/test
/*.sb
364 b
=$
(basename "$x" .sb
)
365 g
="generated/test/${b}.voo"
366 t
="objects/test/${b}.o"
367 printf '\n%s : %s\n' "$t" "$g"
368 printf '\t$(VOODOOC) %s -o %s\n' "$g" "$t"
369 printf '\n%s : bin/transmute %s\n' "$g" "$x"
370 printf '\tenv LD_LIBRARY_PATH=lib bin/transmute < %s > %s\n' "$x" "$g"
374 for target
in $bintargets $libtargets
376 for x
in "$source_dir"/src
/${target}/*.voo
380 b
=$
(basename "$x" .voo
)
381 t
="objects/${target}/${b}.o"
382 printf '\n%s : %s\n' "$t" "$x"
383 printf '\t$(VOODOOC) %s -o %s\n' "$x" "$t"
384 if [ \
! -f "$source_dir/bootstrap/src/${target}/$b.voo" ]
386 printf '\nbootstrap/%s : %s\n' "$t" "$x"
387 printf '\t$(VOODOOC) %s -o bootstrap/%s\n' "$x" "$t"
393 for target
in $bintargets $libtargets
395 for x
in "$source_dir"/src
/${target}/*.c
399 b
=$
(basename "$x" .c
)
400 t
="objects/${target}/${b}.o"
401 printf '\n%s : %s\n' "$t" "$x"
402 printf '\t$(CC) $(CFLAGS) -I$(SRC)/include -fPIC -c %s -o %s\n' "$x" "$t"
403 printf '\nbootstrap/%s : %s\n' "$t" "$x"
404 printf '\t$(CC) $(CFLAGS) -I$(SRC)/include -fPIC -c %s -o bootstrap/%s\n' "$x" "$t"
409 for x
in "$source_dir"/src
/test
/*.voo
413 b
=$
(basename "$x" .voo
)
414 t
="objects/test/${b}.o"
415 printf '\n%s : %s\n' "$t" "$x"
416 printf '\t$(VOODOOC) %s -o %s\n' "$x" "$t"
421 LDFLAGS
="$LDFLAGS -lgc"
422 bootstrap_transmute
="bootstrap/bin/transmute"
423 bootstrap_transmute_env
="env LD_LIBRARY_PATH=bootstrap/lib"
425 source_dir
="$(dirname "$0")"
427 mkdir
-p bin bootstrap
/bin bootstrap
/lib bootstrap
/objects generated \
428 generated
/test lib objects objects
/test test
429 for target
in $bintargets $libtargets
431 mkdir
-p bootstrap
/objects
/${target} generated/${target} objects/${target}
434 write_makefile
> Makefile