moved Antimony symbols into a separate file
[antimony.git] / configure
blob8d4344e23c530a2c49bdc990fd5eebb6870f3547
1 #! /bin/sh
3 libantimony_sources='
4 antimony_reader
5 antimony_writer
6 array
7 allocate
8 blob
9 block
10 boolean
11 dynarray
12 fixnum
13 gensym
14 hash_table
15 init
16 list
17 stream
18 symbol
19 type
22 libvoodoo_translator_sources='
23 antimony_symbols
24 voodoo_translator
27 libvoodoo_writer_sources='
28 voodoo_writer
31 library_test_sources='
32 test_antimony_reader
33 test_antimony_writer
34 test_array
35 test_blob
36 test_dynarray
37 test_hash_table
38 test_list
39 test_stream
40 test_symbol
41 test_voodoo_translator
42 test_voodoo_writer
43 xyzzy
46 write_makefile() {
47 cat <<EOT
48 VOODOOC = voodooc
50 EOT
51 write_objects LIBANTIMONY_OBJECTS generated/ $libantimony_sources
52 write_objects LIBVOODOO_TRANSLATOR_OBJECTS generated/ \
53 $libvoodoo_translator_sources
54 write_objects LIBVOODOO_WRITER_OBJECTS generated/ $libvoodoo_writer_sources
55 write_objects TEST_OBJECTS test/ $library_test_sources
56 cat <<'EOT'
57 LIBOBJECTS = $(LIBANTIMONY_OBJECTS) \
58 $(LIBVOODOO_TRANSLATOR_OBJECTS) \
59 $(LIBVOODOO_WRITER_OBJECTS)
60 OBJECTS = $(LIBOBJECTS) $(TEST_OBJECTS) generated/transmute.o
61 BINTARGETS = bin/transmute
62 LIBTARGETS = lib/libantimony.so \
63 lib/libvoodoo_translator.so \
64 lib/libvoodoo_writer.so
65 EOT
66 write_targets TEST_TARGETS test/ $library_test_sources
68 cat <<'EOT'
69 default : $(BINTARGETS)
71 all : default $(TEST_TARGETS)
73 bootstrap :
74 [ \! -d generated ] || rm -r generated
75 cp -r bootstrap generated
76 $(MAKE) $(BINTARGETS)
78 clean :
79 -rm $(OBJECTS)
80 -rm -r generated
82 distclean : clean
83 -rm -r bin lib $(TEST_TARGETS) Makefile
85 bin :
86 mkdir -p bin
88 bin/transmute : bin generated/transmute.o $(LIBTARGETS)
89 $(CC) generated/transmute.o -o bin/transmute \
90 -Llib -lantimony -lgc -lvoodoo_translator -lvoodoo_writer
92 generated :
93 $(MAKE) bootstrap
95 lib :
96 mkdir -p lib
98 libs : generated $(LIBTARGETS)
100 lib/libantimony.so : lib $(LIBANTIMONY_OBJECTS)
101 $(CC) -shared $(LIBANTIMONY_OBJECTS) -o lib/libantimony.so
103 lib/libvoodoo_translator.so : lib $(LIBVOODOO_TRANSLATOR_OBJECTS)
104 $(CC) -shared $(LIBVOODOO_TRANSLATOR_OBJECTS) \
105 -o lib/libvoodoo_translator.so
107 lib/libvoodoo_writer.so : lib $(LIBVOODOO_WRITER_OBJECTS)
108 $(CC) -shared $(LIBVOODOO_WRITER_OBJECTS) -o lib/libvoodoo_writer.so
110 runtests : libs $(TEST_TARGETS)
111 (cd test && ./test)
113 test/test_voodoo_translator : test/test_voodoo_translator.o \
114 lib/libantimony.so lib/libvoodoo_translator.so lib/libvoodoo_writer.so
115 $(CC) $< -o $@ -Llib -lantimony -lgc -lvoodoo_translator \
116 -lvoodoo_writer
118 test/test_voodoo_writer : test/test_voodoo_writer.o \
119 lib/libantimony.so lib/libvoodoo_writer.so
120 $(CC) $< -o $@ -Llib -lantimony -lgc -lvoodoo_writer
122 .SUFFIXES : .o .sb .voo
124 .o : lib/libantimony.so
125 $(CC) $< -o $@ -Llib -lantimony -lgc
127 .voo.o :
128 $(VOODOOC) $< -o $@
130 generated/%.o : src/%.voo
131 $(VOODOOC) $< -o $@
133 generated/%.voo : src/%.sb generated
134 env LD_LIBRARY_PATH=$$PWD/lib bin/transmute < $< > $@
136 test/%.voo : test/%.sb libs bin/transmute
137 env LD_LIBRARY_PATH=$$PWD/lib bin/transmute < $< > $@
139 .PHONY : all bootstrap clean default distclean libs runtests
143 write_objects() {
144 # write_objects $name $prefix $names
145 printf '%s =' "$1"
146 shift
147 prefix="$1"
148 shift
149 for x in "$@"
151 printf ' \\\n\t%s%s.o' "$prefix" "$x"
152 done
153 printf '\n\n'
156 write_targets() {
157 # write_targets $name $prefix $names
158 printf '%s =' "$1"
159 shift
160 prefix="$1"
161 shift
162 for x in "$@"
164 printf ' \\\n\t%s%s' "$prefix" "$x"
165 done
166 printf '\n\n'
169 write_makefile > Makefile