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
|
############################################################-*-Makefile-*-####
# Project Installation and Distribution
##############################################################################
# $Id$
# scala documents
DOCUMENTS_ROOT = $(PROJECT_DOCUMENTDIR)
DOCUMENTS_FILES += $(DOCUMENTS_ROOT)/reference/ScalaReference.pdf
DOCUMENTS_FILES += $(DOCUMENTS_ROOT)/reference/ScalaByExample.pdf
DOCUMENTS_FILES += $(DOCUMENTS_ROOT)/tutorial/ScalaTutorial.pdf
# scala examples
EXAMPLES_ROOT = $(PROJECT_SOURCEDIR)/examples
EXAMPLES_LIST += $(call READLIST, $(PROJECT_LISTDIR)/examples.lst)
EXAMPLES_FILES = $(EXAMPLES_LIST:%=$(EXAMPLES_ROOT)/%)
# emacs scala-mode
EMACS_ROOT = $(PROJECT_SUPPORTDIR)/emacs
EMACS_LIST += $(call READLIST,$(PROJECT_LISTDIR)/emacs.lst)
EMACS_FILES = $(EMACS_LIST:%=$(EMACS_ROOT)/%)
# jedit scala-mode
JEDIT_ROOT = $(PROJECT_SUPPORTDIR)/jedit
JEDIT_LIST += scala.xml
JEDIT_FILES = $(JEDIT_LIST:%=$(JEDIT_ROOT)/%)
# ultraedit scala-mode
ULTRAEDIT_ROOT = $(PROJECT_SUPPORTDIR)/ultraedit
ULTRAEDIT_LIST += scala.txt
ULTRAEDIT_FILES = $(ULTRAEDIT_LIST:%=$(ULTRAEDIT_ROOT)/%)
# scala test
TEST_ROOT = $(PROJECT_ROOT)/test
TEST_LIST += $(call READLIST,$(PROJECT_LISTDIR)/test-pos.lst)
TEST_LIST += $(call READLIST,$(PROJECT_LISTDIR)/test-neg.lst)
TEST_LIST += $(call READLIST,$(PROJECT_LISTDIR)/test-run.lst)
TEST_FILES = $(TEST_LIST:%=$(TEST_ROOT)/%)
##############################################################################
# beta versions
##############################################################################
INSTALL_ROOT = $(PROJECT_DISTRIBDIR)
INSTALL_NAME = $(PROJECT_NAME)
INSTALL_VERSION := $(shell $(DATE) -u "+%Y%m%d-%H%M%S")
INSTALL_PACKAGE = $(PROJECT_NAME)-$(INSTALL_VERSION)
INSTALL_PREFIX = $(INSTALL_ROOT)/$(INSTALL_PACKAGE)
INSTALL_BINDIR = $(INSTALL_PREFIX)/bin
INSTALL_DOCDIR = $(INSTALL_PREFIX)/doc
INSTALL_APIDOCDIR = $(INSTALL_DOCDIR)/api
INSTALL_LIBDIR = $(INSTALL_PREFIX)/lib
INSTALL_SRCDIR = $(INSTALL_PREFIX)/src
INSTALL_EXAMPLEDIR = $(INSTALL_PREFIX)/examples
INSTALL_SUPPORTDIR = $(INSTALL_PREFIX)/support
INSTALL_TESTDIR = $(INSTALL_PREFIX)/test
INSTALL_RUNTIME_JARFILE = $(INSTALL_LIBDIR)/$(PROJECT_NAME).jar
INSTALL_TOOLS_JARFILE = $(INSTALL_LIBDIR)/$(TOOLS_NAME).jar
INSTALL_FJBG_JARFILE = $(INSTALL_LIBDIR)/fjbg.jar
INSTALL_MSIL_JARFILE = $(INSTALL_LIBDIR)/msil.jar
install : $(LIBRARY_JAR_ARCHIVE)
install : $(TOOLS_JAR_ARCHIVE)
$(MAKE) -C $(DOCUMENTS_ROOT)/reference
$(MAKE) -C $(DOCUMENTS_ROOT)/tutorial
$(INSTALL) -m 755 -d $(INSTALL_PREFIX)
$(INSTALL) -m 644 -p $(PROJECT_ROOT)/README $(INSTALL_PREFIX)
$(INSTALL) -m 644 -p $(PROJECT_ROOT)/LICENSE $(INSTALL_PREFIX)
$(ECHO) $(INSTALL_VERSION) > $(INSTALL_PREFIX)/VERSION
$(CHMOD) 644 $(INSTALL_PREFIX)/VERSION
$(INSTALL) -m 755 -d $(INSTALL_BINDIR)
$(INSTALL) -m 644 -p $(SCRIPTS_WRAPPER).tmpl $(INSTALL_BINDIR)
@$(make) \
SCRIPTS_PREFIX=$(INSTALL_BINDIR) \
INSTALL_PREFIX=$(INSTALL_PREFIX) \
MACRO_VERSION=$(INSTALL_VERSION) \
MACRO_RUNTIME_SOURCES=$(INSTALL_SRCDIR) \
MACRO_RUNTIME_CLASSES=$(INSTALL_RUNTIME_JARFILE) \
MACRO_TOOLS_CLASSES=$(INSTALL_TOOLS_JARFILE) \
MACRO_FJBG_CLASSES=$(INSTALL_FJBG_JARFILE) \
MACRO_MSIL_CLASSES=$(INSTALL_MSIL_JARFILE) \
MACRO_JAVA_ARGS= \
scripts
$(RM) $(INSTALL_BINDIR)/$(notdir $(SCRIPTS_WRAPPER)).tmpl
$(INSTALL) -m 755 -d $(INSTALL_LIBDIR)
$(INSTALL) -m 644 -p $(LIBRARY_JAR_ARCHIVE) $(INSTALL_RUNTIME_JARFILE)
$(INSTALL) -m 644 -p $(TOOLS_JAR_ARCHIVE) $(INSTALL_TOOLS_JARFILE)
$(INSTALL) -m 644 -p $(FJBG_JARFILE) $(INSTALL_FJBG_JARFILE)
$(INSTALL) -m 644 -p $(MSIL_JARFILE) $(INSTALL_MSIL_JARFILE)
$(INSTALL) -m 755 -d $(INSTALL_SRCDIR)
$(strip $(MIRROR) -m 644 -p -C $(LIBRARY_ROOT) $(LIBRARY_LIST:%='%') \
$(INSTALL_SRCDIR)/$(PROJECT_NAME))
$(INSTALL) -m 755 -d $(INSTALL_DOCDIR)
$(INSTALL) -m 644 -p $(DOCUMENTS_FILES) $(INSTALL_DOCDIR)
$(INSTALL) -m 755 -d $(INSTALL_APIDOCDIR)
@$(make) \
target=LIBRARY \
SCALADOC=$(INSTALL_BINDIR)/scaladoc \
PROJECT_VERSION=$(INSTALL_VERSION) \
PROJECT_SOURCEDIR=$(INSTALL_SRCDIR) \
LIBRARY_SDC_OUTPUTDIR=$(INSTALL_APIDOCDIR) \
sdc
$(INSTALL) -m 755 -d $(INSTALL_EXAMPLEDIR)
$(strip $(MIRROR) -m 644 -p -C $(EXAMPLES_ROOT) $(EXAMPLES_LIST) \
$(INSTALL_EXAMPLEDIR))
$(INSTALL) -m 755 -d $(INSTALL_SUPPORTDIR)
$(INSTALL) -m 755 -d $(INSTALL_SUPPORTDIR)/emacs
$(strip $(MIRROR) -m 644 -p -C $(EMACS_ROOT) $(EMACS_LIST) \
$(INSTALL_SUPPORTDIR)/emacs)
$(INSTALL) -m 755 -d $(INSTALL_SUPPORTDIR)/jedit
$(strip $(MIRROR) -m 644 -p -C $(JEDIT_ROOT) $(JEDIT_LIST) \
$(INSTALL_SUPPORTDIR)/jedit)
$(INSTALL) -m 755 -d $(INSTALL_SUPPORTDIR)/ultraedit
$(strip $(MIRROR) -m 644 -p -C $(ULTRAEDIT_ROOT) $(ULTRAEDIT_LIST) \
$(INSTALL_SUPPORTDIR)/ultraedit)
$(INSTALL) -m 755 -d $(INSTALL_TESTDIR)
$(INSTALL) -m 755 -d $(INSTALL_TESTDIR)/bin
$(INSTALL) -m 755 $(TEST_ROOT)/bin/scala-test $(INSTALL_TESTDIR)/bin
$(strip $(MIRROR) -m 644 -p -C $(TEST_ROOT)/files $(TEST_LIST) \
$(INSTALL_TESTDIR)/files)
$(strip $(MIRROR) -m 644 -p -C $(TEST_ROOT)/files \
$(shell cd $(TEST_ROOT)/files; ls $(TEST_LIST:%.scala=%.check) 2>/dev/null) \
$(INSTALL_TESTDIR)/files)
$(strip $(MIRROR) -m 644 -p -C $(TEST_ROOT)/files \
$(shell cd $(TEST_ROOT)/files; ls $(TEST_LIST:%.scala=%.flags) 2>/dev/null) \
$(INSTALL_TESTDIR)/files)
$(strip $(MIRROR) -m 644 -p -C $(TEST_ROOT)/files \
$(shell cd $(TEST_ROOT)/files; ls $(TEST_LIST:%.scala=%.dtd) 2>/dev/null) \
$(INSTALL_TESTDIR)/files)
$(strip $(MIRROR) -m 644 -p -C $(TEST_ROOT)/files \
$(shell cd $(TEST_ROOT)/files; ls $(TEST_LIST:%.scala=%.xml) 2>/dev/null) \
$(INSTALL_TESTDIR)/files)
install-windows : install
@if [ ! -d "$(INSTALL_PREFIX)" ]; then \
echo "Could not find UNIX install '$(INSTALL_PREFIX)'"; \
exit 1; \
fi
$(UNIX2DOS) $(INSTALL_PREFIX)/README
$(UNIX2DOS) $(INSTALL_PREFIX)/LICENSE
$(UNIX2DOS) $(INSTALL_PREFIX)/VERSION
$(TOUCH) $(INSTALL_PREFIX)/VERSION-$(INSTALL_VERSION)
@root=`cd "$(INSTALL_PREFIX)"; pwd`; \
for file in "" $(SCRIPTS_WRAPPER_ALIASES); do \
if [ -z "$$file" ]; then continue; fi; \
echo -n "Generating $$file.bat ... "; \
srcfile="$(PROJECT_SUPPORTDIR)/windows/scala_wrapper"; \
nixfile="$(INSTALL_PREFIX)/bin/$$file"; \
winfile="$(INSTALL_PREFIX)/bin/$$file.bat"; \
nixexec=`SCALA_EXEC=echo $$nixfile`; \
winexec="$$nixexec"; \
winexec=`echo "$$winexec" | sed -es"#$$root#%SCALA_HOME%#g"`; \
winexec=`echo "$$winexec" | tr '/' '\\\\' | tr ':' ';'`; \
winexec=`echo "$$winexec" | sed -es"#Xbootclasspath.a;#Xbootclasspath/a:#g"`; \
$(RM) -f "$$winfile"; \
( \
$(CAT) "$$srcfile-header.bat"; \
$(ECHO) "set VERSION=$(INSTALL_VERSION)"; \
$(ECHO) "set COMMAND=$$winexec"; \
$(CAT) "$$srcfile-footer.bat"; \
) | $(UNIX2DOS) >> "$$winfile"; \
$(RM) "$$nixfile"; \
echo "done"; \
done
$(RM) $(INSTALL_PREFIX)/bin/.scala_wrapper
$(FIND) $(INSTALL_SRCDIR) -type f -exec $(UNIX2DOS) "{}" ";"
$(FIND) $(INSTALL_APIDOCDIR) -type f -exec $(UNIX2DOS) "{}" ";"
$(FIND) $(INSTALL_EXAMPLEDIR) -type f -exec $(UNIX2DOS) "{}" ";"
$(FIND) $(INSTALL_SUPPORTDIR) -type f -exec $(UNIX2DOS) "{}" ";"
$(RM) -r $(INSTALL_TESTDIR)
install-addons :
$(RM) -r $(DISTRIB_ARCHIVE).addons
$(INSTALL) -d $(DISTRIB_ARCHIVE).addons
$(INSTALL) -d $(DISTRIB_ARCHIVE).addons/doc
$(INSTALL) $(DOCUMENTS_ROOT)/reference/ProgrammingInScala.pdf \
$(DISTRIB_ARCHIVE).addons/doc
.PHONY : install
.PHONY : install-windows
.PHONY : install-addons
##############################################################################
IA_CONFIG_PREFIX = $(PROJECT_CONFIGDIR)/ia
IA_CONFIG_IMAGESDIR = $(IA_CONFIG_PREFIX)/images
IA_CONFIG_LOCALESDIR = $(IA_CONFIG_PREFIX)/locales
IA_PROJECTFILE = $(IA_CONFIG_PREFIX)/$(PROJECT_NAME).iap_xml
IA_CUSTOMFILE = custom
IA_LICENSEFILE = LICENSE
IA_BUILD_PREFIX = /tmp/IA_Build_$(PROJECT_NAME)
IA_BUILD_IMAGESDIR = $(IA_BUILD_PREFIX)/images
IA_BUILD_LOCALESDIR = $(IA_BUILD_PREFIX)/$(PROJECT_NAME)locales
IA_BUILD_ARCHIVE_TGZ = $(IA_BUILD_PREFIX)/$(PROJECT_NAME).tar.gz
IA_BUILD_ARCHIVE_ZIP = $(IA_BUILD_PREFIX)/$(PROJECT_NAME).zip
IA_BUILD_OUTPUTDIR = $(IA_BUILD_PREFIX)/$(PROJECT_NAME)_Build_Output
IA_INSTALL_PREFIX = $(INSTALL_PREFIX).ia
ia-build :
$(RM) -r $(IA_BUILD_PREFIX)
$(INSTALL) -m 755 -d $(IA_BUILD_PREFIX)
$(INSTALL) -m 644 -p $(IA_PROJECTFILE) $(IA_BUILD_PREFIX)
$(INSTALL) -m 755 -d $(IA_BUILD_LOCALESDIR)
@for locale in "" `ls -d $(IA_CONFIG_LOCALESDIR)/?? | $(XARGS) -n 1 $(BASENAME)`; do \
if [ -z "$$locale" ]; then continue; fi; \
$(INSTALL) -m 644 -p $(IA_CONFIG_LOCALESDIR)/"$$locale"/$(IA_CUSTOMFILE) \
$(IA_BUILD_LOCALESDIR)/$(IA_CUSTOMFILE)"_$$locale"; \
$(INSTALL) -m 644 -p $(IA_CONFIG_LOCALESDIR)/"$$locale"/$(IA_LICENSEFILE).html \
$(IA_BUILD_PREFIX)/$(IA_LICENSEFILE)"_$$locale".html; \
done
$(INSTALL) -m 755 -d $(IA_BUILD_IMAGESDIR)
@for file in "" `$(FIND) $(IA_CONFIG_IMAGESDIR)/* -type f`; do \
if [ -z "$$file" ]; then continue; fi; \
$(INSTALL) -m 644 -p "$$file" $(IA_BUILD_IMAGESDIR); \
done
$(TAR) xzf $(INSTALL_PREFIX).tar.gz -C $(IA_BUILD_PREFIX)
$(strip cd $(IA_BUILD_PREFIX)/$(PROJECT_NAME)-$(INSTALL_VERSION); \
$(TAR) czf ../$(PROJECT_NAME).tar.gz .)
$(RM) -r $(IA_BUILD_PREFIX)/$(PROJECT_NAME)-$(INSTALL_VERSION)
$(UNZIP) -q $(INSTALL_PREFIX).zip -d $(IA_BUILD_PREFIX)
$(strip cd $(IA_BUILD_PREFIX)/$(PROJECT_NAME)-$(INSTALL_VERSION); \
$(ZIP) -q -r ../$(PROJECT_NAME).zip .)
$(RM) -r $(IA_BUILD_PREFIX)/$(PROJECT_NAME)-$(INSTALL_VERSION)
$(IA) $(IA_BUILD_PREFIX)/$(notdir $(IA_PROJECTFILE))
$(INSTALL) -m 755 -d $(IA_INSTALL_PREFIX)
$(strip $(TAR) cf - -C $(IA_BUILD_OUTPUTDIR) Web_Installers | \
$(TAR) xf - -C $(IA_INSTALL_PREFIX))
##############################################################################
DISTRIB_ROOT = $(PROJECT_DISTRIBDIR)
DISTRIB_PACKAGE = $(INSTALL_PACKAGE)
DISTRIB_ARCHIVE = $(DISTRIB_ROOT)/$(DISTRIB_PACKAGE)
distrib : distrib-build-all
$(RM) -rf $(INSTALL_PREFIX)
distrib-build-all : distrib-build-unix
distrib-build-all : distrib-build-windows
distrib-build-all : distrib-build-ia
distrib-build-all : distrib-build-addons
distrib-build-unix : install
$(RM) $(DISTRIB_ARCHIVE).tar
$(RM) $(DISTRIB_ARCHIVE).tar.gz
$(RM) $(DISTRIB_ARCHIVE).tar.bz2
$(strip $(TAR) cf $(DISTRIB_ARCHIVE).tar -C $(dir $(INSTALL_PREFIX)) \
$(notdir $(INSTALL_PREFIX)))
$(BZIP2) --best -c $(DISTRIB_ARCHIVE).tar > $(DISTRIB_ARCHIVE).tar.bz2
$(GZIP) --best -c $(DISTRIB_ARCHIVE).tar > $(DISTRIB_ARCHIVE).tar.gz
$(RM) $(DISTRIB_ARCHIVE).tar
distrib-build-windows : install-windows
@$(call RUN,cd $(dir $(INSTALL_PREFIX))); \
$(call RUN,$(RM) $(DISTRIB_PACKAGE).zip); \
$(call RUN,$(ZIP) -q -r $(DISTRIB_PACKAGE).zip \
$(notdir $(INSTALL_PREFIX)))
@archive=$(dir $(INSTALL_PREFIX))/$(DISTRIB_PACKAGE).zip; \
if [ ! $(DISTRIB_ARCHIVE).zip -ef $$archive ]; then \
$(call RUN,$(RM) $(DISTRIB_ARCHIVE).zip); \
$(call RUN,$(CP) $(dir $(INSTALL_PREFIX))/$(DISTRIB_PACKAGE).zip \
$(DISTRIB_ARCHIVE).zip); \
fi
distrib-build-ia : ia-build
distrib-build-addons : install-addons
distrib-official : version-update
@$(make) distrib INSTALL_VERSION='$$(PROJECT_VERSION)'
$(CVS) tag "release-$(subst .,_,$(PROJECT_VERSION))" $(PROJECT_ROOT)
@$(make) version-increment
.PHONY : distrib
.PHONY : distrib-build-all
.PHONY : distrib-build-unix
.PHONY : distrib-build-windows
.PHONY : distrib-build-ia
.PHONY : distrib-build-website
.PHONY : distrib-official
##############################################################################
|