7 _voodoo_translator_libs
='
44 test_voodoo_translator
49 bootstrap_bintargets
="$bintargets"
50 bootstrap_libtargets
="$libtargets"
90 libvoodoo_translator_sources
='
101 transmute_libs
="$_voodoo_translator_libs"
102 test_anf_transform_libs
="$_voodoo_translator_libs"
103 test_symbol_encoder_libs
="$_voodoo_translator_libs"
104 test_to_core_libs
="$_voodoo_translator_libs"
105 test_voodoo_translator_libs
="$_voodoo_translator_libs"
106 test_voodoo_writer_libs
="$_voodoo_translator_libs"
111 BOOTSTRAP_TRANSMUTE = $bootstrap_transmute
112 BOOTSTRAP_TRANSMUTE_ENV = $bootstrap_transmute_env
117 makefile_bintargets
=''
118 for target
in $bintargets
120 makefile_bintargets
="$makefile_bintargets bin/${target}"
123 echo "BINTARGETS =$makefile_bintargets"
125 makefile_libtargets
=''
126 for target
in $libtargets
128 makefile_libtargets
="$makefile_libtargets lib/lib${target}.so"
130 echo "LIBTARGETS =$makefile_libtargets"
132 makefile_testtargets
=''
133 for target
in $testtargets
135 makefile_testtargets
="$makefile_testtargets test/${target}"
138 echo "TESTTARGETS =$makefile_testtargets"
140 makefile_bootstrap_bintargets
=''
141 for target
in $bootstrap_bintargets
143 makefile_bootstrap_bintargets
="$makefile_bootstrap_bintargets bootstrap/bin/${target}"
146 echo "BOOTSTRAP_BINTARGETS =$makefile_bootstrap_bintargets"
148 makefile_bootstrap_libtargets
=''
149 for target
in $bootstrap_libtargets
151 makefile_bootstrap_libtargets
="$makefile_bootstrap_libtargets bootstrap/lib/${target}"
153 echo "BOOTSTRAP_LIBTARGETS =$makefile_bootstrap_libtargets"
155 for target
in $bintargets
157 eval "libs=\$${target}_libs"
158 [ -n "$libs" ] || libs
="$default_libs"
163 lib_depends
="${lib_depends} lib/lib${lib}.so"
164 lib_flags
="$lib_flags -l${lib}"
166 eval "sources=\$${target}_sources"
167 [ -n "$sources" ] || sources
="$target"
169 for source in $sources
171 srcs
="$srcs objects/${target}/${source}.o"
174 echo "${target}_lflags =$lib_flags"
175 echo "${target}_libs =$lib_depends"
176 echo "${target}_objects =$srcs"
179 for target
in $bootstrap_bintargets
181 eval "libs=\$${target}_libs"
182 [ -n "$libs" ] || libs
="$default_libs"
187 lib_depends
="${lib_depends} bootstrap/lib/lib${lib}.so"
188 lib_flags
="$lib_flags -l${lib}"
190 eval "sources=\$${target}_sources"
191 [ -n "$sources" ] || sources
="$target"
193 for source in $sources
195 srcs
="$srcs bootstrap/objects/${target}/${source}.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}_objects) \$(${target}_libs)"
277 printf '\t$(CC) $(CFLAGS) $(%s_objects) -o bin/%s -Llib $(%s_lflags) $(LDFLAGS)\n' "$target" "$target" "$target"
280 for target
in $bootstrap_bintargets
283 echo "bootstrap/bin/${target} : \$(bootstrap_${target}_objects) \$(bootstrap_${target}_libs)"
284 printf '\t$(CC) $(CFLAGS) $(bootstrap_%s_objects) -o bootstrap/bin/%s -Lbootstrap/lib $(bootstrap_%s_lflags) $(LDFLAGS)\n' "$target" "$target" "$target"
287 for target
in $libtargets
289 target
="lib${target}"
291 echo "lib/${target}.so : \$(${target}_objects) \$(${target}_libs)"
292 printf '\t$(CC) $(CFLAGS) -shared $(%s_objects) -o lib/%s.so -Llib $(%s_lflags)\n' "$target" "$target" "$target"
295 for target
in $bootstrap_libtargets
297 target
="lib${target}"
299 echo "bootstrap/lib/${target}.so : \$(bootstrap_${target}_objects) \$(bootstrap_${target}_libs)"
300 printf '\t$(CC) $(CFLAGS) -shared $(bootstrap_%s_objects) -o bootstrap/lib/%s.so -Lbootstrap/lib $(bootsrap_%s_lflags)\n' "$target" "$target" "$target"
303 for target
in $testtargets
306 echo "test/${target} : \$(${target}_objects) \$(${target}_libs)"
307 printf '\t$(CC) $(CFLAGS) $(%s_objects) -o test/%s -Llib $(%s_lflags) $(LDFLAGS)\n' "$target" "$target" "$target"
312 .PHONY : all check clean default distclean
314 default : $(LIBTARGETS) $(BINTARGETS)
316 all : default $(TESTTARGETS)
319 cd test && case $(SRC) in /*) $(SRC)/src/test/test;; *) ../$(SRC)/src/test/test;; esac
324 -rm -r bin generated lib bootstrap/bin bootstrap/lib bootstrap/objects objects test Makefile
326 bootstrap : bootstrap/bin/transmute
329 for target
in $bintargets $libtargets
331 for x
in "$source_dir"/bootstrap
/src
/${target}/*.voo
335 t
="bootstrap/objects/${target}/$(basename "$x" .voo).o"
336 printf '\n%s : %s\n' "$t" "$x"
337 printf '\t$(VOODOOC) %s -o %s\n' "$x" "$t"
342 for target
in $bintargets $libtargets
344 for x
in "$source_dir"/src
/${target}/*.sb
348 b
=$
(basename "$x" .sb
)
349 g
="generated/${target}/${b}.voo"
350 t
="objects/${target}/${b}.o"
351 printf '\n%s : %s\n' "$t" "$g"
352 printf '\t$(VOODOOC) %s -o %s\n' "$g" "$t"
353 printf '\n%s : $(BOOTSTRAP_TRANSMUTE) %s\n' "$g" "$x"
354 printf '\t$(BOOTSTRAP_TRANSMUTE_ENV) $(BOOTSTRAP_TRANSMUTE) < %s > %s\n' "$x" "$g"
359 for x
in "$source_dir"/src
/test
/*.sb
363 b
=$
(basename "$x" .sb
)
364 g
="generated/test/${b}.voo"
365 t
="objects/test/${b}.o"
366 printf '\n%s : %s\n' "$t" "$g"
367 printf '\t$(VOODOOC) %s -o %s\n' "$g" "$t"
368 printf '\n%s : bin/transmute %s\n' "$g" "$x"
369 printf '\tenv LD_LIBRARY_PATH=lib bin/transmute < %s > %s\n' "$x" "$g"
373 for target
in $bintargets $libtargets
375 for x
in "$source_dir"/src
/${target}/*.voo
379 b
=$
(basename "$x" .voo
)
380 t
="objects/${target}/${b}.o"
381 printf '\n%s : %s\n' "$t" "$x"
382 printf '\t$(VOODOOC) %s -o %s\n' "$x" "$t"
383 if [ \
! -f "$source_dir/bootstrap/src/${target}/$b.voo" ]
385 printf '\nbootstrap/%s : %s\n' "$t" "$x"
386 printf '\t$(VOODOOC) %s -o bootstrap/%s\n' "$x" "$t"
392 for target
in $bintargets $libtargets
394 for x
in "$source_dir"/src
/${target}/*.c
398 b
=$
(basename "$x" .c
)
399 t
="objects/${target}/${b}.o"
400 printf '\n%s : %s\n' "$t" "$x"
401 printf '\t$(CC) $(CFLAGS) -I$(SRC)/include -fPIC -c %s -o %s\n' "$x" "$t"
402 printf '\nbootstrap/%s : %s\n' "$t" "$x"
403 printf '\t$(CC) $(CFLAGS) -I$(SRC)/include -fPIC -c %s -o bootstrap/%s\n' "$x" "$t"
408 for x
in "$source_dir"/src
/test
/*.voo
412 b
=$
(basename "$x" .voo
)
413 t
="objects/test/${b}.o"
414 printf '\n%s : %s\n' "$t" "$x"
415 printf '\t$(VOODOOC) %s -o %s\n' "$x" "$t"
420 LDFLAGS
="$LDFLAGS -lgc"
421 bootstrap_transmute
="bootstrap/bin/transmute"
422 bootstrap_transmute_env
="env LD_LIBRARY_PATH=bootstrap/lib"
424 source_dir
="$(dirname "$0")"
426 mkdir
-p bin bootstrap
/bin bootstrap
/lib bootstrap
/objects generated \
427 generated
/test lib objects objects
/test test
428 for target
in $bintargets $libtargets
430 mkdir
-p bootstrap
/objects
/${target} generated/${target} objects/${target}
433 write_makefile
> Makefile