1 ############################################################################### |
1 ############################################################################### |
2 # METIS MAKEFILE |
2 # METIS MAKEFILE |
3 # Copyright (c) 2001 Joe Hurd, distributed under the BSD License |
3 # Copyright (c) 2001 Joe Leslie-Hurd, distributed under the BSD License |
4 ############################################################################### |
4 ############################################################################### |
5 |
5 |
6 .SUFFIXES: |
6 .SUFFIXES: |
7 |
7 |
8 ############################################################################### |
8 ############################################################################### |
9 # The default action. |
9 # The default action. |
10 ############################################################################### |
10 ############################################################################### |
11 |
11 |
12 .PHONY: default |
12 .PHONY: default |
13 default: mosml |
13 default: |
|
14 @if command -v mlton > /dev/null ; then $(MAKE) mlton ; else if command -v polyc > /dev/null ; then $(MAKE) polyml ; else if command -v mosmlc > /dev/null ; then $(MAKE) mosml ; else echo "ERROR: No ML found on path: install either MLton, Poly/ML or Moscow ML." ; exit 1 ; fi ; fi ; fi |
14 |
15 |
15 ############################################################################### |
16 ############################################################################### |
16 # Cleaning temporary files. |
17 # Cleaning temporary files. |
17 ############################################################################### |
18 ############################################################################### |
18 |
19 |
19 TEMP = \ |
20 TEMP = \ |
20 $(MOSML_TARGETS) \ |
|
21 bin/mosml/*.sml bin/mosml/*.ui bin/mosml/*.uo bin/mosml/a.out \ |
|
22 $(MLTON_TARGETS) \ |
21 $(MLTON_TARGETS) \ |
23 bin/mlton/*.sml bin/mlton/*.mlb \ |
22 bin/mlton/*.sml bin/mlton/*.mlb \ |
24 $(POLYML_TARGETS) \ |
23 $(POLYML_TARGETS) \ |
25 bin/polyml/*.sml bin/polyml/*.log bin/polyml/*.o |
24 bin/polyml/*.sml bin/polyml/*.log \ |
|
25 $(MOSML_TARGETS) \ |
|
26 bin/mosml/*.sml bin/mosml/*.ui bin/mosml/*.uo bin/mosml/a.out |
26 |
27 |
27 .PHONY: clean |
28 .PHONY: clean |
28 clean: |
29 clean: |
29 @echo |
30 @echo |
30 @echo '********************' |
31 @echo '+------------------+' |
31 @echo '* Clean everything *' |
32 @echo '| Clean everything |' |
32 @echo '********************' |
33 @echo '+------------------+' |
33 @echo |
34 @echo |
34 rm -f $(TEMP) |
35 rm -f $(TEMP) |
35 $(MAKE) -C test $@ |
36 $(MAKE) -C test $@ |
36 |
37 |
37 ############################################################################### |
38 ############################################################################### |
96 MLPP = scripts/mlpp |
97 MLPP = scripts/mlpp |
97 |
98 |
98 MLPP_OPTS = |
99 MLPP_OPTS = |
99 |
100 |
100 ############################################################################### |
101 ############################################################################### |
101 # Building using Moscow ML. |
|
102 ############################################################################### |
|
103 |
|
104 MOSMLC = mosmlc -toplevel -q |
|
105 |
|
106 MOSML_SRC = \ |
|
107 src/Portable.sig src/PortableMosml.sml \ |
|
108 $(SRC) |
|
109 |
|
110 MOSML_TARGETS = \ |
|
111 bin/mosml/problems2tptp \ |
|
112 bin/mosml/metis |
|
113 |
|
114 include bin/mosml/Makefile.src |
|
115 |
|
116 .PHONY: mosml-info |
|
117 mosml-info: |
|
118 @echo |
|
119 @echo '*****************************************' |
|
120 @echo '* Build and test the Moscow ML programs *' |
|
121 @echo '*****************************************' |
|
122 @echo |
|
123 |
|
124 .PHONY: mosml |
|
125 mosml: mosml-info $(MOSML_OBJ) $(MOSML_TARGETS) test |
|
126 |
|
127 ############################################################################### |
|
128 # Building using MLton. |
102 # Building using MLton. |
129 ############################################################################### |
103 ############################################################################### |
130 |
104 |
131 MLTON = mlton |
105 MLTON = mlton |
132 |
106 |
134 |
108 |
135 MLTON_SRC = \ |
109 MLTON_SRC = \ |
136 src/Portable.sig src/PortableMlton.sml \ |
110 src/Portable.sig src/PortableMlton.sml \ |
137 $(SRC) |
111 $(SRC) |
138 |
112 |
139 METIS = bin/mlton/metis |
|
140 |
|
141 PROBLEMS2TPTP = bin/mlton/problems2tptp |
|
142 |
|
143 MLTON_TARGETS = \ |
113 MLTON_TARGETS = \ |
144 bin/mlton/selftest \ |
114 bin/mlton/selftest \ |
145 $(METIS) \ |
115 bin/mlton/metis \ |
146 $(PROBLEMS2TPTP) |
116 bin/mlton/problems2tptp |
147 |
117 |
148 bin/mlton/%.sml: $(MLTON_SRC) src/%.sml |
118 bin/mlton/%.sml: $(MLTON_SRC) src/%.sml |
149 @$(MLPP) $(MLPP_OPTS) -c mlton $^ > $@ |
119 @$(MLPP) $(MLPP_OPTS) -c mlton $^ > $@ |
150 |
120 |
151 bin/mlton/%.mlb: bin/mlton/%.sml |
121 bin/mlton/%.mlb: bin/mlton/%.sml |
152 echo '$$(SML_LIB)/basis/basis.mlb $$(SML_LIB)/basis/mlton.mlb $(notdir $<)' > $@ |
122 echo '$$(SML_LIB)/basis/basis.mlb $$(SML_LIB)/basis/mlton.mlb $(notdir $<)' > $@ |
153 |
123 |
154 bin/mlton/%: bin/mlton/%.mlb |
124 bin/mlton/%: bin/mlton/%.mlb |
155 @echo |
125 @echo |
156 @echo '***************************' |
126 @echo '+-------------------------+' |
157 @echo '* Compile a MLton program *' |
127 @echo '| Compile a MLton program |' |
158 @echo '***************************' |
128 @echo '+-------------------------+' |
159 @echo |
129 @echo |
160 @echo $@ |
130 @echo $@ |
161 cd bin/mlton ; $(MLTON) $(MLTON_OPTS) $(notdir $<) |
131 cd bin/mlton ; $(MLTON) $(MLTON_OPTS) $(notdir $<) |
162 @echo |
132 @echo |
163 |
133 |
164 .PHONY: mlton-info |
134 .PHONY: mlton-info |
165 mlton-info: |
135 mlton-info: |
166 @echo |
136 @echo |
167 @echo '*************************************' |
137 @echo '+-----------------------------------+' |
168 @echo '* Build and test the MLton programs *' |
138 @echo '| Build and test the MLton programs |' |
169 @echo '*************************************' |
139 @echo '+-----------------------------------+' |
170 @echo |
140 @echo |
171 |
141 |
172 .PHONY: mlton |
142 .PHONY: mlton |
173 mlton: mlton-info $(MLTON_TARGETS) |
143 mlton: mlton-info $(MLTON_TARGETS) |
174 $(MAKE) -C test mlton |
144 $(MAKE) -C test mlton |
175 |
145 |
176 ############################################################################### |
146 ############################################################################### |
177 # Building using Poly/ML. |
147 # Building using Poly/ML. |
178 ############################################################################### |
148 ############################################################################### |
179 |
149 |
180 POLYML = poly |
150 POLYML = polyc |
181 |
151 |
182 POLYML_OPTS = |
152 POLYML_OPTS = |
183 |
|
184 ifeq ($(shell uname), Darwin) |
|
185 POLYML_LINK_OPTS = -lpolymain -lpolyml -segprot POLY rwx rwx |
|
186 else |
|
187 POLYML_LINK_OPTS = -lpolymain -lpolyml |
|
188 endif |
|
189 |
153 |
190 POLYML_SRC = \ |
154 POLYML_SRC = \ |
191 src/Random.sig src/Random.sml \ |
155 src/Random.sig src/Random.sml \ |
192 src/Portable.sig src/PortablePolyml.sml \ |
156 src/Portable.sig src/PortablePolyml.sml \ |
193 $(SRC) |
157 $(SRC) |
199 |
163 |
200 bin/polyml/%.sml: src/%.sml $(POLYML_SRC) |
164 bin/polyml/%.sml: src/%.sml $(POLYML_SRC) |
201 @$(MLPP) $(MLPP_OPTS) -c polyml $(POLYML_SRC) > $@ |
165 @$(MLPP) $(MLPP_OPTS) -c polyml $(POLYML_SRC) > $@ |
202 @echo 'fun main () = let' >> $@ |
166 @echo 'fun main () = let' >> $@ |
203 @$(MLPP) $(MLPP_OPTS) -c polyml $< >> $@ |
167 @$(MLPP) $(MLPP_OPTS) -c polyml $< >> $@ |
204 @echo "in () end; PolyML.export(\"$(basename $(notdir $<))\", main);" >> $@ |
168 @echo "in () end handle e => (TextIO.output (TextIO.stdErr, \"FATAL EXCEPTION:\\\\n\"^ exnMessage e); OS.Process.exit OS.Process.failure);" >> $@ |
205 |
169 |
206 bin/polyml/%.o: bin/polyml/%.sml |
170 bin/polyml/%: bin/polyml/%.sml |
207 cd bin/polyml ; echo "use \"$(notdir $<)\";" | $(POLYML) $(POLYML_OPTS) > $(basename $(notdir $<)).log |
171 @echo |
208 @if test $@ -nt $< ; then echo 'compiled $@' ; else cat bin/polyml/$(basename $(notdir $<)).log ; exit 1 ; fi |
172 @echo '+---------------------------+' |
209 |
173 @echo '| Compile a Poly/ML program |' |
210 bin/polyml/%: bin/polyml/%.o |
174 @echo '+---------------------------+' |
211 @echo |
|
212 @echo '*****************************' |
|
213 @echo '* Compile a Poly/ML program *' |
|
214 @echo '*****************************' |
|
215 @echo |
175 @echo |
216 @echo $@ |
176 @echo $@ |
217 cd bin/polyml && $(CC) -o $(notdir $@) $(notdir $<) $(POLYML_LINK_OPTS) |
177 cd bin/polyml && $(POLYML) $(POLYML_OPTS) -o $(notdir $@) $(notdir $<) |
218 @echo |
178 @echo |
219 |
179 |
220 .PHONY: polyml-info |
180 .PHONY: polyml-info |
221 polyml-info: |
181 polyml-info: |
222 @echo |
182 @echo |
223 @echo '***************************************' |
183 @echo '+-------------------------------------+' |
224 @echo '* Build and test the Poly/ML programs *' |
184 @echo '| Build and test the Poly/ML programs |' |
225 @echo '***************************************' |
185 @echo '+-------------------------------------+' |
226 @echo |
186 @echo |
227 |
187 |
228 .PHONY: polyml |
188 .PHONY: polyml |
229 polyml: polyml-info $(POLYML_TARGETS) |
189 polyml: polyml-info $(POLYML_TARGETS) |
230 $(MAKE) -C test polyml |
190 $(MAKE) -C test polyml |
231 |
191 |
232 ############################################################################### |
192 ############################################################################### |
|
193 # Building using Moscow ML. |
|
194 ############################################################################### |
|
195 |
|
196 MOSMLC = mosmlc -toplevel -q |
|
197 |
|
198 MOSML_SRC = \ |
|
199 src/Portable.sig src/PortableMosml.sml \ |
|
200 $(SRC) |
|
201 |
|
202 MOSML_TARGETS = \ |
|
203 bin/mosml/problems2tptp \ |
|
204 bin/mosml/metis |
|
205 |
|
206 include bin/mosml/Makefile.src |
|
207 |
|
208 .PHONY: mosml-info |
|
209 mosml-info: |
|
210 @echo |
|
211 @echo '+---------------------------------------+' |
|
212 @echo '| Build and test the Moscow ML programs |' |
|
213 @echo '+---------------------------------------+' |
|
214 @echo |
|
215 |
|
216 .PHONY: mosml |
|
217 mosml: mosml-info $(MOSML_OBJ) $(MOSML_TARGETS) test |
|
218 |
|
219 ############################################################################### |
233 # Development. |
220 # Development. |
234 ############################################################################## |
221 ############################################################################## |
235 |
222 |
236 include Makefile.dev |
223 include Makefile.dev |
237 |
224 |