7 _voodoo_translator_libs
='
46 test_voodoo_translator
51 bootstrap_bintargets
="$bintargets"
52 bootstrap_libtargets
="$libtargets"
95 libvoodoo_translator_sources
='
106 transmute_libs
="$_voodoo_translator_libs"
107 test_anf_transform_libs
="$_voodoo_translator_libs"
108 test_symbol_encoder_libs
="$_voodoo_translator_libs"
109 test_to_core_libs
="$_voodoo_translator_libs"
110 test_voodoo_translator_libs
="$_voodoo_translator_libs"
111 test_voodoo_writer_libs
="$_voodoo_translator_libs"
116 BOOTSTRAP_TRANSMUTE = $bootstrap_transmute
117 BOOTSTRAP_TRANSMUTE_ENV = $bootstrap_transmute_env
122 makefile_bintargets
=''
123 for target
in $bintargets
125 makefile_bintargets
="$makefile_bintargets bin/${target}"
128 echo "BINTARGETS =$makefile_bintargets"
130 makefile_libtargets
=''
131 for target
in $libtargets
133 makefile_libtargets
="$makefile_libtargets lib/lib${target}.so"
135 echo "LIBTARGETS =$makefile_libtargets"
137 makefile_testtargets
=''
138 for target
in $testtargets
140 makefile_testtargets
="$makefile_testtargets test/${target}"
143 echo "TESTTARGETS =$makefile_testtargets"
145 makefile_bootstrap_bintargets
=''
146 for target
in $bootstrap_bintargets
148 makefile_bootstrap_bintargets
="$makefile_bootstrap_bintargets bootstrap/bin/${target}"
151 echo "BOOTSTRAP_BINTARGETS =$makefile_bootstrap_bintargets"
153 makefile_bootstrap_libtargets
=''
154 for target
in $bootstrap_libtargets
156 makefile_bootstrap_libtargets
="$makefile_bootstrap_libtargets bootstrap/lib/${target}"
158 echo "BOOTSTRAP_LIBTARGETS =$makefile_bootstrap_libtargets"
160 for target
in $bintargets
162 eval "libs=\$${target}_libs"
163 [ -n "$libs" ] || libs
="$default_libs"
168 lib_depends
="${lib_depends} lib/lib${lib}.so"
169 lib_flags
="$lib_flags -l${lib}"
171 eval "sources=\$${target}_sources"
172 [ -n "$sources" ] || sources
="$target"
173 srcs
=$
(echo ${target}/*)
175 echo "${target}_lflags =$lib_flags"
176 echo "${target}_libs =$lib_depends"
177 echo "${target}_sources =$srcs"
180 for target
in $bootstrap_bintargets
182 eval "libs=\$${target}_libs"
183 [ -n "$libs" ] || libs
="$default_libs"
188 lib_depends
="${lib_depends} bootstrap/lib/lib${lib}.so"
189 lib_flags
="$lib_flags -l${lib}"
192 for source in bootstrap
/src
/${target}/*.voo
194 base
=$
(basename ${source} .voo
)
195 srcs
="$srcs bootstrap/objects/${target}/${base}.o"
198 echo "bootstrap_${target}_lflags =$lib_flags"
199 echo "bootstrap_${target}_libs =$lib_depends"
200 echo "bootstrap_${target}_objects =$srcs"
203 for target
in $libtargets
205 eval "libs=\$lib${target}_libs"
210 lib_depends
="$lib_depends lib/lib${lib}.so"
211 lib_flags
="$lib_flags -l${lib}"
213 eval "sources=\$lib${target}_sources"
214 [ -n "$sources" ] || sources
="$target"
216 for source in $sources
218 srcs
="$srcs objects/${target}/${source}.o"
221 echo "lib${target}_lflags =$lib_flags"
222 echo "lib${target}_libs =$lib_depends"
223 echo "lib${target}_objects =$srcs"
226 for target
in $bootstrap_libtargets
228 eval "libs=\$lib${target}_libs"
233 lib_depends
="$lib_depends bootstrap/lib/lib${lib}.so"
234 lib_flags
="$lib_flags -l${lib}"
236 eval "sources=\$lib${target}_sources"
237 [ -n "$sources" ] || sources
="$target"
239 for source in $sources
241 srcs
="$srcs bootstrap/objects/${target}/${source}.o"
244 echo "bootstrap_lib${target}_lflags =$lib_flags"
245 echo "bootstrap_lib${target}_libs =$lib_depends"
246 echo "bootstrap_lib${target}_objects =$srcs"
249 for target
in $testtargets
251 eval "libs=\$${target}_libs"
252 [ -n "$libs" ] || libs
="$default_libs"
257 lib_depends
="${lib_depends} lib/lib${lib}.so"
258 lib_flags
="$lib_flags -l${lib}"
260 eval "sources=\$${target}_sources"
261 [ -n "$sources" ] || sources
="$target"
263 for source in $sources
265 srcs
="$srcs objects/test/${source}.o"
268 echo "${target}_lflags =$lib_flags"
269 echo "${target}_libs =$lib_depends"
270 echo "${target}_objects =$srcs"
273 for target
in $bintargets
276 echo "bin/${target} : \$(${target}_sources) \$(${target}_libs)"
277 if [ "$target" = transmute
]
279 printf '\tenv LD_LIBRARY_PATH=bootstrap/lib bootstrap/bin/transmute -t exe -L lib -o bin/%s %s\n' "$target" "$target"
281 printf '\tenv LD_LIBRARY_PATH=lib bin/transmute -t exe -L lib -o bin/%s %s\n' "$target" "$target"
284 for target
in $bootstrap_bintargets
287 echo "bootstrap/bin/${target} : \$(bootstrap_${target}_objects) \$(bootstrap_${target}_libs)"
288 printf '\t$(CC) $(CFLAGS) $(bootstrap_%s_objects) -o bootstrap/bin/%s -Lbootstrap/lib $(bootstrap_%s_lflags) $(LDFLAGS)\n' "$target" "$target" "$target"
291 for target
in $libtargets
293 target
="lib${target}"
295 echo "lib/${target}.so : \$(${target}_objects) \$(${target}_libs)"
296 printf '\t$(CC) $(CFLAGS) -shared $(%s_objects) -o lib/%s.so -Llib $(%s_lflags)\n' "$target" "$target" "$target"
299 for target
in $bootstrap_libtargets
301 target
="lib${target}"
303 echo "bootstrap/lib/${target}.so : \$(bootstrap_${target}_objects) \$(bootstrap_${target}_libs)"
304 printf '\t$(CC) $(CFLAGS) -shared $(bootstrap_%s_objects) -o bootstrap/lib/%s.so -Lbootstrap/lib $(bootsrap_%s_lflags)\n' "$target" "$target" "$target"
307 for target
in $testtargets
310 echo "test/${target} : \$(${target}_objects) \$(${target}_libs)"
311 printf '\t$(CC) $(CFLAGS) $(%s_objects) -o test/%s -Llib $(%s_lflags) $(LDFLAGS)\n' "$target" "$target" "$target"
316 .PHONY : all check clean default distclean
318 default : $(LIBTARGETS) $(BINTARGETS)
320 all : default $(TESTTARGETS)
323 cd test && case $(SRC) in /*) $(SRC)/src/test/test;; *) ../$(SRC)/src/test/test;; esac
328 -rm -r bin generated lib bootstrap/bin bootstrap/lib bootstrap/objects objects test Makefile
330 bootstrap : bootstrap/bin/transmute
333 for target
in $bintargets $libtargets
335 for x
in "$source_dir"/bootstrap
/src
/${target}/*.voo
339 t
="bootstrap/objects/${target}/$(basename "$x" .voo).o"
340 printf '\n%s : %s\n' "$t" "$x"
341 printf '\t$(VOODOOC) %s -o %s\n' "$x" "$t"
346 for target
in $bintargets $libtargets
348 for x
in "$source_dir"/src
/${target}/*.sb
352 b
=$
(basename "$x" .sb
)
353 g
="generated/${target}/${b}.voo"
354 t
="objects/${target}/${b}.o"
355 printf '\n%s : %s\n' "$t" "$g"
356 printf '\t$(VOODOOC) %s -o %s\n' "$g" "$t"
357 printf '\n%s : $(BOOTSTRAP_TRANSMUTE) %s\n' "$g" "$x"
358 printf '\t$(BOOTSTRAP_TRANSMUTE_ENV) $(BOOTSTRAP_TRANSMUTE) < %s > %s\n' "$x" "$g"
363 for x
in "$source_dir"/src
/test
/*.sb
367 b
=$
(basename "$x" .sb
)
368 g
="generated/test/${b}.voo"
369 t
="objects/test/${b}.o"
370 printf '\n%s : %s\n' "$t" "$g"
371 printf '\t$(VOODOOC) %s -o %s\n' "$g" "$t"
372 printf '\n%s : bin/transmute %s\n' "$g" "$x"
373 printf '\tenv LD_LIBRARY_PATH=lib bin/transmute < %s > %s\n' "$x" "$g"
377 for target
in $bintargets $libtargets
379 for x
in "$source_dir"/src
/${target}/*.voo
383 b
=$
(basename "$x" .voo
)
384 t
="objects/${target}/${b}.o"
385 printf '\n%s : %s\n' "$t" "$x"
386 printf '\t$(VOODOOC) %s -o %s\n' "$x" "$t"
387 if [ \
! -f "$source_dir/bootstrap/src/${target}/$b.voo" ]
389 printf '\nbootstrap/%s : %s\n' "$t" "$x"
390 printf '\t$(VOODOOC) %s -o bootstrap/%s\n' "$x" "$t"
396 for target
in $bintargets $libtargets
398 for x
in "$source_dir"/src
/${target}/*.c
402 b
=$
(basename "$x" .c
)
403 t
="objects/${target}/${b}.o"
404 printf '\n%s : %s\n' "$t" "$x"
405 printf '\t$(CC) $(CFLAGS) -I$(SRC)/include -fPIC -c %s -o %s\n' "$x" "$t"
406 printf '\nbootstrap/%s : %s\n' "$t" "$x"
407 printf '\t$(CC) $(CFLAGS) -I$(SRC)/include -fPIC -c %s -o bootstrap/%s\n' "$x" "$t"
412 for x
in "$source_dir"/src
/test
/*.voo
416 b
=$
(basename "$x" .voo
)
417 t
="objects/test/${b}.o"
418 printf '\n%s : %s\n' "$t" "$x"
419 printf '\t$(VOODOOC) %s -o %s\n' "$x" "$t"
424 LDFLAGS
="$LDFLAGS -lgc"
425 bootstrap_transmute
="bootstrap/bin/transmute"
426 bootstrap_transmute_env
="env LD_LIBRARY_PATH=bootstrap/lib"
428 source_dir
="$(dirname "$0")"
430 mkdir
-p bin bootstrap
/bin bootstrap
/lib bootstrap
/objects generated \
431 generated
/test lib objects objects
/test test
432 for target
in $bintargets $libtargets
434 mkdir
-p bootstrap
/objects
/${target} generated/${target} objects/${target}
437 write_makefile
> Makefile