-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile_dist
299 lines (247 loc) · 7.63 KB
/
Makefile_dist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
#########################################################################
## ##
## Applied Type System ##
## ##
## Hongwei Xi ##
## ##
#########################################################################
##
## ATS/Anairiats - Unleashing the Potential of Types!
##
## Copyright (C) 2002-2008 Hongwei Xi.
##
## ATS is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2.1, or (at your option) any later
## version.
##
## ATS is distributed in the hope that it will be useful, but WITHOUT ANY
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
## for more details.
##
## You should have received a copy of the GNU General Public License
## along with ATS; see the file COPYING. If not, write to the Free
## Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
## 02110-1301, USA.
##
######
##
## Author: Hongwei Xi (hwxi AT cs DOT bu DOT edu)
## Author: Likai Liu (liulk AT cs DOT bu DOT edu)
## Author: Yuri D'Elia (wavexx AT thregr DOT org)
##
.SUFFIXES:
all:: Makefile
######
# integration with autoconf.
SRC_CONFIG_FILES := config.mk.in config.h.in
BUILT_CONFIG_FILES := $(SRC_CONFIG_FILES:%.in=%)
Makefile: config.mk
config.status: configure
./configure
touch $@
$(BUILT_CONFIG_FILES): %: config.status $(filter-out %,$(SRC_CONFIG_FILES))
./config.status
touch $(BUILT_CONFIG_FILES)
config.h.in: configure.ac
autoheader $<
touch $@
configure: configure.ac $(SRC_CONFIG_FILES)
aclocal
automake --add-missing --foreign || true
autoconf
touch $(BUILT_CONFIG_FILES)
-include config.mk
######
DESTDIR :=
export ATSHOME
export ATSHOMERELOC
export ATSHOMEQ
######
#
# HX-2011-06-01:
# This part is by Georg Bauhaus (bauhaus AT arcor DOT de):
# It addresses the issue that the [-D] option is not available
# for $(INSTALL) on MacOSX.
#
.PHONY: install_dirs
install_dirs:: config.h
#
# make all subdirectories needed by install.
#
cd $(abs_top_srcdir)
[ -d $(DESTDIR)/$(bindir) ] || $(MKDIR_P) $(DESTDIR)/$(bindir)
$(MKDIR_P) $(DESTDIR)$(ATSNEWHOME)/bin
find ccomp contrib doc libats libc prelude -type d \
-exec $(MKDIR_P) $(DESTDIR)$(ATSNEWHOME)/\{} \; \
-print
install_files:: install_dirs
#
# recursively install all files in the list except .svn control files.
#
for d in ccomp/runtime contrib doc libats libc prelude; do \
cd $(abs_top_srcdir) && \
$(INSTALL) -d $(DESTDIR)$(ATSNEWHOME)/"$$d" && \
find "$$d" -name .svn -prune -o -type f \
-exec $(INSTALL) -m 644 \{} $(DESTDIR)$(ATSNEWHOME)/\{} \; \
-print && \
find "$$d" -name .svn -prune -o -type l \
-exec cp -d \{} $(DESTDIR)$(ATSNEWHOME)/\{} \; \
-print; \
done
#
# install specific files in the list as regular files.
#
for f in \
COPYING INSTALL *.txt ccomp/lib/*.a ccomp/lib64/*.a config.h; \
do \
[ -f "$$f" ] || continue; \
cd $(abs_top_srcdir) && \
$(INSTALL) -m 644 "$$f" $(DESTDIR)$(ATSNEWHOME)/"$$f" && \
echo "$$f"; \
done
#
# install specific files in the list as executables.
#
for f in bin/*; do \
cd $(abs_top_srcdir) && \
$(INSTALL) -m 755 "$$f" $(DESTDIR)$(ATSNEWHOME)/"$$f" && \
echo "$$f"; \
done
#
# install multiple copies of wrapper script, for each binary.
#
for f in bin/*; do \
b=`basename "$$f"`; \
cd $(abs_top_srcdir) && \
$(INSTALL) -m 755 ats_env.sh $(DESTDIR)$(bindir)/"$$b" && \
echo install ats_env.sh to $(bindir)/"$$b"; \
done
install:: install_files
######
all:: \
atsopt1 \
bin/atscc \
bin/atslib \
libfiles libfiles_mt \
bin/atspack \
bin/atslex \
ccomp/runtime/GCATS/gc.o \
ccomp/runtime/GCATS/gc_mt.o \
atsopt1_gc \
contrib
@echo "ATS/Anairiats has been built up successfully!"
@echo "The value of ATSHOME for this build is \"$(ATSHOME)\"."
@echo "The value of ATSHOMERELOC for this build is \"$(ATSHOMERELOC)\"."
###### w/o GC ######
atsopt1::
$(MAKE) -C bootstrap1 -f ../Makefile_bootstrap BOOTSTRAP1=1 atsopt
cp bootstrap1/atsopt $(ATSHOMEQ)/bin/atsopt
###### with GC ######
atsopt1_gc::
$(MAKE) -C bootstrap1 -f ../Makefile_bootstrap BOOTSTRAP1=1 atsopt_gc
cp bootstrap1/atsopt_gc $(ATSHOMEQ)/bin/atsopt
###### contrib libraries ######
contrib::
ifeq (1,1)
$(MAKE) -C contrib/parcomb all
endif
ifeq ($(HAVE_LIBGLIB20),1)
$(MAKE) -C contrib/glib all
endif
ifeq ($(HAVE_LIBGTK20),1)
$(MAKE) -C contrib/cairo all
$(MAKE) -C contrib/pango all
$(MAKE) -C contrib/GTK all
endif
ifeq ($(HAVE_LIBSDL10),1)
$(MAKE) -C contrib/SDL all
endif
###### some toplevel commands ######
bin/atscc bin/atslib:
$(MAKE) -C utils/scripts atscc
$(CPF) utils/scripts/atscc $(ATSHOMEQ)/bin
$(MAKE) -C utils/scripts atslib
$(CPF) utils/scripts/atslib $(ATSHOMEQ)/bin
$(MAKE) -C utils/scripts clean
bin/atspack:
$(MAKE) -C utils/scripts atspack
cp utils/scripts/atspack $(ATSHOMEQ)/bin
###### library ######
ATS_PROOFCHECK=
#
# ATS_PROOFCHECK=-D_ATS_PROOFCHECK # it should be turned on from time to time
#
# [CC -E] for preprocessing
#
ATSLIB=$(ATSHOMEQ)/bin/atslib
.libfiles_local: .libfiles ; $(CC) -E -P -x c -o $@ $<
libfiles: .libfiles_local
$(ATSLIB) $(ATS_PROOFCHECK) -O2 --libats
$(ATSLIB) $(ATS_PROOFCHECK) -O2 --libats_lex
$(ATSLIB) $(ATS_PROOFCHECK) -O2 --libats_smlbas
lib32files: .libfiles_local
$(ATSLIB) $(ATS_PROOFCHECK) -m32 -O2 --libats
$(ATSLIB) $(ATS_PROOFCHECK) -m32 -O2 --libats_lex
$(ATSLIB) $(ATS_PROOFCHECK) -m32 -O2 --libats_smlbas
lib64files: .libfiles_local
$(ATSLIB) $(ATS_PROOFCHECK) -m64 -O2 --libats
$(ATSLIB) $(ATS_PROOFCHECK) -m64 -O2 --libats_lex
$(ATSLIB) $(ATS_PROOFCHECK) -m64 -O2 --libats_smlbas
.libfiles_mt_local: .libfiles_mt ; $(CC) -E -P -x c -o $@ $<
libfiles_mt: .libfiles_mt_local
$(ATSLIB) $(ATS_PROOFCHECK) -D_ATS_MULTITHREAD -O2 --libats_mt
###### a lexer for ATS ######
bin/atslex:
cd utils/atslex; $(MAKE) atslex; cp atslex $(ATSHOMEQ)/bin
cd utils/atslex; $(MAKE) clean
###### GC runtime ######
ccomp/runtime/GCATS/gc.o:
cd ccomp/runtime/GCATS; $(MAKE) gc.o; $(MAKE) clean
ccomp/runtime/GCATS/gc_mt.o:
cd ccomp/runtime/GCATS; $(MAKE) gc_mt.o; $(MAKE) clean
######
CPF=cp -f
RMF=rm -f
######
clean::
$(RMF) bootstrap1/*.o
$(MAKE) -C utils/scripts clean
$(MAKE) -C utils/atslex clean
$(MAKE) -C ccomp/runtime/GCATS clean
cleanall::
$(RMF) bootstrap1/*.o
$(RMF) $(BUILT_CONFIG_FILES)
$(RMF) .libfiles_local
$(RMF) .libfiles_mt_local
$(RMF) bin/atsopt bin/atscc bin/atslib bin/atslex bin/atspack
$(RMF) ccomp/lib/libats.a
$(RMF) ccomp/lib/libats_mt.a
$(RMF) ccomp/lib/libats_lex.a
$(RMF) ccomp/lib/libats_smlbas.a
$(RMF) ccomp/lib/output/*
$(RMF) ccomp/lib64/libats.a
$(RMF) ccomp/lib64/libats_mt.a
$(RMF) ccomp/lib64/libats_lex.a
$(RMF) ccomp/lib64/libats_smlbas.a
$(RMF) ccomp/lib64/output/*
$(RMF) contrib/glib/atsctrb_glib.o
$(RMF) contrib/cairo/atsctrb_cairo.o
$(RMF) contrib/pango/atsctrb_pango.o
$(RMF) contrib/X11/atsctrb_X11.o
$(RMF) contrib/GTK/atsctrb_GTK.o
$(RMF) contrib/GL/atsctrb_GL.o
$(RMF) contrib/GL/atsctrb_glut.o
$(RMF) contrib/GL/atsctrb_gtkglext.o
$(RMF) contrib/SDL/atsctrb_SDL.o
cleanall:: ; $(MAKE) -C utils/atslex cleanall
cleanall:: ; $(MAKE) -C utils/scripts cleanall
cleanall:: ; $(MAKE) -C ccomp/runtime/GCATS cleanall
distclean:: cleanall
distclean:: ; find . -name .svn -prune -o -name \*~ -exec rm \{} \;
######
#
# end of [Makefile_dist]
#
######