7 _voodoo_translator_libs
='
29 test_voodoo_translator
54 bootstrap_bintargets
="$bintargets"
55 bootstrap_libtargets
="$libtargets"
98 libvoodoo_translator_sources
='
109 transmute_libs
="$_voodoo_translator_libs"
110 test_anf_transform_libs
="$_voodoo_translator_libs"
111 test_symbol_encoder_libs
="$_voodoo_translator_libs"
112 test_to_core_libs
="$_voodoo_translator_libs"
113 test_voodoo_translator_libs
="$_voodoo_translator_libs"
114 test_voodoo_writer_libs
="$_voodoo_translator_libs"
119 BOOTSTRAP_TRANSMUTE = $bootstrap_transmute
120 BOOTSTRAP_TRANSMUTE_ENV = $bootstrap_transmute_env
125 makefile_bintargets
=''
126 for target
in $bintargets
128 makefile_bintargets
="$makefile_bintargets bin/${target}"
131 echo "BINTARGETS =$makefile_bintargets"
133 makefile_libtargets
=''
134 for target
in $libtargets
136 makefile_libtargets
="$makefile_libtargets lib/lib${target}.so"
138 echo "LIBTARGETS =$makefile_libtargets"
140 makefile_testtargets
=''
141 for target
in $legacy_testtargets $testtargets
143 makefile_testtargets
="$makefile_testtargets test/${target}"
146 echo "TESTTARGETS =$makefile_testtargets"
148 makefile_bootstrap_bintargets
=''
149 for target
in $bootstrap_bintargets
151 makefile_bootstrap_bintargets
="$makefile_bootstrap_bintargets bootstrap/bin/${target}"
154 echo "BOOTSTRAP_BINTARGETS =$makefile_bootstrap_bintargets"
156 makefile_bootstrap_libtargets
=''
157 for target
in $bootstrap_libtargets
159 makefile_bootstrap_libtargets
="$makefile_bootstrap_libtargets bootstrap/lib/${target}"
161 echo "BOOTSTRAP_LIBTARGETS =$makefile_bootstrap_libtargets"
163 for target
in $bintargets
165 eval "libs=\$${target}_libs"
166 [ -n "$libs" ] || libs
="$default_libs"
171 lib_depends
="${lib_depends} lib/lib${lib}.so"
172 lib_flags
="$lib_flags -l${lib}"
174 eval "sources=\$${target}_sources"
175 [ -n "$sources" ] || sources
="$target"
176 srcs
=$
(echo ${target}/*)
178 echo "${target}_lflags =$lib_flags"
179 echo "${target}_libs =$lib_depends"
180 echo "${target}_sources =$srcs"
183 for target
in $bootstrap_bintargets
185 eval "libs=\$${target}_libs"
186 [ -n "$libs" ] || libs
="$default_libs"
191 lib_depends
="${lib_depends} bootstrap/lib/lib${lib}.so"
192 lib_flags
="$lib_flags -l${lib}"
195 for source in bootstrap
/src
/${target}/*.voo
197 base
=$
(basename ${source} .voo
)
198 srcs
="$srcs bootstrap/objects/${target}/${base}.o"
201 echo "bootstrap_${target}_lflags =$lib_flags"
202 echo "bootstrap_${target}_libs =$lib_depends"
203 echo "bootstrap_${target}_objects =$srcs"
206 for target
in $libtargets
208 eval "libs=\$lib${target}_libs"
213 lib_depends
="$lib_depends lib/lib${lib}.so"
214 lib_flags
="$lib_flags -l${lib}"
216 eval "sources=\$lib${target}_sources"
217 [ -n "$sources" ] || sources
="$target"
219 for source in $sources
221 srcs
="$srcs objects/${target}/${source}.o"
224 echo "lib${target}_lflags =$lib_flags"
225 echo "lib${target}_libs =$lib_depends"
226 echo "lib${target}_objects =$srcs"
229 for target
in $bootstrap_libtargets
231 eval "libs=\$lib${target}_libs"
236 lib_depends
="$lib_depends bootstrap/lib/lib${lib}.so"
237 lib_flags
="$lib_flags -l${lib}"
239 eval "sources=\$lib${target}_sources"
240 [ -n "$sources" ] || sources
="$target"
242 for source in $sources
244 srcs
="$srcs bootstrap/objects/${target}/${source}.o"
247 echo "bootstrap_lib${target}_lflags =$lib_flags"
248 echo "bootstrap_lib${target}_libs =$lib_depends"
249 echo "bootstrap_lib${target}_objects =$srcs"
252 for target
in $legacy_testtargets
254 eval "libs=\$${target}_libs"
255 [ -n "$libs" ] || libs
="$default_libs"
260 lib_depends
="${lib_depends} lib/lib${lib}.so"
261 lib_flags
="$lib_flags -l${lib}"
263 eval "sources=\$${target}_sources"
264 [ -n "$sources" ] || sources
="$target"
266 for source in $sources
268 srcs
="$srcs objects/test/${source}.o"
271 echo "${target}_lflags =$lib_flags"
272 echo "${target}_libs =$lib_depends"
273 echo "${target}_objects =$srcs"
276 for target
in $testtargets
278 eval "libs=\$${target}_libs"
279 [ -n "$libs" ] || libs
="$default_libs"
284 lib_depends
="${lib_depends} lib/lib${lib}.so"
285 lib_flags
="$lib_flags -l${lib}"
287 eval "sources=\$${target}_sources"
288 [ -n "$sources" ] || sources
="$target"
290 echo "${target}_lflags =$lib_flags"
291 echo "${target}_libs =$lib_depends"
294 for target
in $bintargets
297 echo "bin/${target} : \$(${target}_sources) \$(${target}_libs)"
298 if [ "$target" = transmute
]
300 printf '\tenv LD_LIBRARY_PATH=bootstrap/lib bootstrap/bin/transmute -t exe -L lib -o bin/%s %s\n' "$target" "$target"
302 printf '\tenv LD_LIBRARY_PATH=lib bin/transmute -t exe -L lib -o bin/%s %s\n' "$target" "$target"
305 for target
in $bootstrap_bintargets
308 echo "bootstrap/bin/${target} : \$(bootstrap_${target}_objects) \$(bootstrap_${target}_libs)"
309 printf '\t$(CC) $(CFLAGS) $(bootstrap_%s_objects) -o bootstrap/bin/%s -Lbootstrap/lib $(bootstrap_%s_lflags) $(LDFLAGS)\n' "$target" "$target" "$target"
312 for target
in $libtargets
314 target
="lib${target}"
316 echo "lib/${target}.so : \$(${target}_objects) \$(${target}_libs)"
317 printf '\t$(CC) $(CFLAGS) -shared $(%s_objects) -o lib/%s.so -Llib $(%s_lflags)\n' "$target" "$target" "$target"
320 for target
in $bootstrap_libtargets
322 target
="lib${target}"
324 echo "bootstrap/lib/${target}.so : \$(bootstrap_${target}_objects) \$(bootstrap_${target}_libs)"
325 printf '\t$(CC) $(CFLAGS) -shared $(bootstrap_%s_objects) -o bootstrap/lib/%s.so -Lbootstrap/lib $(bootsrap_%s_lflags)\n' "$target" "$target" "$target"
328 for target
in $legacy_testtargets
331 echo "test/${target} : \$(${target}_objects) \$(${target}_libs)"
332 printf '\t$(CC) $(CFLAGS) $(%s_objects) -o test/%s -Llib $(%s_lflags) $(LDFLAGS)\n' "$target" "$target" "$target"
337 .PHONY : all check clean default distclean
339 default : $(LIBTARGETS) $(BINTARGETS)
341 all : default $(TESTTARGETS)
344 cd test && case $(SRC) in /*) $(SRC)/src/test/test;; *) ../$(SRC)/src/test/test;; esac
349 -rm -r bin generated lib bootstrap/bin bootstrap/lib bootstrap/objects objects test Makefile
351 bootstrap : bootstrap/bin/transmute
354 for target
in $bintargets $libtargets
356 for x
in "$source_dir"/bootstrap
/src
/${target}/*.voo
360 t
="bootstrap/objects/${target}/$(basename "$x" .voo).o"
361 printf '\n%s : %s\n' "$t" "$x"
362 printf '\t$(VOODOOC) %s -o %s\n' "$x" "$t"
367 for target
in $bintargets $libtargets
369 for x
in "$source_dir"/src
/${target}/*.sb
373 b
=$
(basename "$x" .sb
)
374 g
="generated/${target}/${b}.voo"
375 t
="objects/${target}/${b}.o"
376 printf '\n%s : %s\n' "$t" "$g"
377 printf '\t$(VOODOOC) %s -o %s\n' "$g" "$t"
378 printf '\n%s : $(BOOTSTRAP_TRANSMUTE) %s\n' "$g" "$x"
379 printf '\t$(BOOTSTRAP_TRANSMUTE_ENV) $(BOOTSTRAP_TRANSMUTE) < %s > %s\n' "$x" "$g"
384 for x
in $legacy_testtargets
386 s
="$source_dir/src/test/$x.sb"
389 g
="generated/test/${x}.voo"
390 t
="objects/test/${x}.o"
391 printf '\n%s : %s\n' "$t" "$g"
392 printf '\t$(VOODOOC) %s -o %s\n' "$g" "$t"
393 printf '\n%s : bin/transmute %s\n' "$g" "$s"
394 printf '\tenv LD_LIBRARY_PATH=lib bin/transmute < %s > %s\n' "$s" "$g"
398 for x
in $testtargets
400 s
="$source_dir/src/test/$x.sb"
404 printf '\n%s : bin/transmute %s\n' "$t" "$s"
405 printf '\tenv LD_LIBRARY_PATH=lib bin/transmute -t exe -o %s -L lib -b %s/src/test %s\n' "$t" "$source_dir" "$s"
409 for target
in $bintargets $libtargets
411 for x
in "$source_dir"/src
/${target}/*.voo
415 b
=$
(basename "$x" .voo
)
416 t
="objects/${target}/${b}.o"
417 printf '\n%s : %s\n' "$t" "$x"
418 printf '\t$(VOODOOC) %s -o %s\n' "$x" "$t"
419 if [ \
! -f "$source_dir/bootstrap/src/${target}/$b.voo" ]
421 printf '\nbootstrap/%s : %s\n' "$t" "$x"
422 printf '\t$(VOODOOC) %s -o bootstrap/%s\n' "$x" "$t"
428 for target
in $bintargets $libtargets
430 for x
in "$source_dir"/src
/${target}/*.c
434 b
=$
(basename "$x" .c
)
435 t
="objects/${target}/${b}.o"
436 printf '\n%s : %s\n' "$t" "$x"
437 printf '\t$(CC) $(CFLAGS) -I$(SRC)/include -fPIC -c %s -o %s\n' "$x" "$t"
438 printf '\nbootstrap/%s : %s\n' "$t" "$x"
439 printf '\t$(CC) $(CFLAGS) -I$(SRC)/include -fPIC -c %s -o bootstrap/%s\n' "$x" "$t"
444 for x
in "$source_dir"/src
/test
/*.voo
448 b
=$
(basename "$x" .voo
)
449 t
="objects/test/${b}.o"
450 printf '\n%s : %s\n' "$t" "$x"
451 printf '\t$(VOODOOC) %s -o %s\n' "$x" "$t"
456 LDFLAGS
="$LDFLAGS -lgc"
457 bootstrap_transmute
="bootstrap/bin/transmute"
458 bootstrap_transmute_env
="env LD_LIBRARY_PATH=bootstrap/lib"
460 source_dir
="$(dirname "$0")"
462 mkdir
-p bin bootstrap
/bin bootstrap
/lib bootstrap
/objects generated \
463 generated
/test lib objects objects
/test test
464 for target
in $bintargets $libtargets
466 mkdir
-p bootstrap
/objects
/${target} generated/${target} objects/${target}
469 write_makefile
> Makefile