7 _voodoo_translator_libs
='
45 test_voodoo_translator
50 bootstrap_bintargets
="$bintargets"
51 bootstrap_libtargets
="$libtargets"
91 libvoodoo_translator_sources
='
102 transmute_libs
="$_voodoo_translator_libs"
103 test_anf_transform_libs
="$_voodoo_translator_libs"
104 test_symbol_encoder_libs
="$_voodoo_translator_libs"
105 test_to_core_libs
="$_voodoo_translator_libs"
106 test_voodoo_translator_libs
="$_voodoo_translator_libs"
107 test_voodoo_writer_libs
="$_voodoo_translator_libs"
112 BOOTSTRAP_TRANSMUTE = $bootstrap_transmute
113 BOOTSTRAP_TRANSMUTE_ENV = $bootstrap_transmute_env
118 makefile_bintargets
=''
119 for target
in $bintargets
121 makefile_bintargets
="$makefile_bintargets bin/${target}"
124 echo "BINTARGETS =$makefile_bintargets"
126 makefile_libtargets
=''
127 for target
in $libtargets
129 makefile_libtargets
="$makefile_libtargets lib/lib${target}.so"
131 echo "LIBTARGETS =$makefile_libtargets"
133 makefile_testtargets
=''
134 for target
in $testtargets
136 makefile_testtargets
="$makefile_testtargets test/${target}"
139 echo "TESTTARGETS =$makefile_testtargets"
141 makefile_bootstrap_bintargets
=''
142 for target
in $bootstrap_bintargets
144 makefile_bootstrap_bintargets
="$makefile_bootstrap_bintargets bootstrap/bin/${target}"
147 echo "BOOTSTRAP_BINTARGETS =$makefile_bootstrap_bintargets"
149 makefile_bootstrap_libtargets
=''
150 for target
in $bootstrap_libtargets
152 makefile_bootstrap_libtargets
="$makefile_bootstrap_libtargets bootstrap/lib/${target}"
154 echo "BOOTSTRAP_LIBTARGETS =$makefile_bootstrap_libtargets"
156 for target
in $bintargets
158 eval "libs=\$${target}_libs"
159 [ -n "$libs" ] || libs
="$default_libs"
164 lib_depends
="${lib_depends} lib/lib${lib}.so"
165 lib_flags
="$lib_flags -l${lib}"
167 eval "sources=\$${target}_sources"
168 [ -n "$sources" ] || sources
="$target"
169 srcs
=$
(echo ${target}/*)
171 echo "${target}_lflags =$lib_flags"
172 echo "${target}_libs =$lib_depends"
173 echo "${target}_sources =$srcs"
176 for target
in $bootstrap_bintargets
178 eval "libs=\$${target}_libs"
179 [ -n "$libs" ] || libs
="$default_libs"
184 lib_depends
="${lib_depends} bootstrap/lib/lib${lib}.so"
185 lib_flags
="$lib_flags -l${lib}"
188 for source in bootstrap
/src
/${target}/*.voo
190 base
=$
(basename ${source} .voo
)
191 srcs
="$srcs bootstrap/objects/${target}/${base}.o"
194 echo "bootstrap_${target}_lflags =$lib_flags"
195 echo "bootstrap_${target}_libs =$lib_depends"
196 echo "bootstrap_${target}_objects =$srcs"
199 for target
in $libtargets
201 eval "libs=\$lib${target}_libs"
206 lib_depends
="$lib_depends lib/lib${lib}.so"
207 lib_flags
="$lib_flags -l${lib}"
209 eval "sources=\$lib${target}_sources"
210 [ -n "$sources" ] || sources
="$target"
212 for source in $sources
214 srcs
="$srcs objects/${target}/${source}.o"
217 echo "lib${target}_lflags =$lib_flags"
218 echo "lib${target}_libs =$lib_depends"
219 echo "lib${target}_objects =$srcs"
222 for target
in $bootstrap_libtargets
224 eval "libs=\$lib${target}_libs"
229 lib_depends
="$lib_depends bootstrap/lib/lib${lib}.so"
230 lib_flags
="$lib_flags -l${lib}"
232 eval "sources=\$lib${target}_sources"
233 [ -n "$sources" ] || sources
="$target"
235 for source in $sources
237 srcs
="$srcs bootstrap/objects/${target}/${source}.o"
240 echo "bootstrap_lib${target}_lflags =$lib_flags"
241 echo "bootstrap_lib${target}_libs =$lib_depends"
242 echo "bootstrap_lib${target}_objects =$srcs"
245 for target
in $testtargets
247 eval "libs=\$${target}_libs"
248 [ -n "$libs" ] || libs
="$default_libs"
253 lib_depends
="${lib_depends} lib/lib${lib}.so"
254 lib_flags
="$lib_flags -l${lib}"
256 eval "sources=\$${target}_sources"
257 [ -n "$sources" ] || sources
="$target"
259 for source in $sources
261 srcs
="$srcs objects/test/${source}.o"
264 echo "${target}_lflags =$lib_flags"
265 echo "${target}_libs =$lib_depends"
266 echo "${target}_objects =$srcs"
269 for target
in $bintargets
272 echo "bin/${target} : \$(${target}_sources) \$(${target}_libs)"
273 if [ "$target" = transmute
]
275 printf '\tenv LD_LIBRARY_PATH=bootstrap/lib bootstrap/bin/transmute -t exe -L lib -o bin/%s %s\n' "$target" "$target"
277 printf '\tenv LD_LIBRARY_PATH=lib bin/transmute -t exe -L lib -o bin/%s %s\n' "$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