Backport from sid to buster
[hcoop/debian/mlton.git] / Makefile
CommitLineData
7f918cf1
CE
1## Copyright (C) 2009,2011,2013,2017-2018 Matthew Fluet.
2 # Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh
3 # Jagannathan, and Stephen Weeks.
4 # Copyright (C) 1997-2000 NEC Research Institute.
5 #
6 # MLton is released under a BSD-style license.
7 # See the file MLton-LICENSE for details.
8 ##
9
10# Specify C compiler and binutils.
11# Can be used for alternative tools (e.g., `CC=clang` or `CC=gcc-7`).
12CC := gcc
13AR := ar
14RANLIB := ranlib
15STRIP := strip
16
17# Specify GMP include and library paths, if not on default search paths.
18WITH_GMP_DIR :=
19ifneq ($(WITH_GMP_DIR),)
20WITH_GMP_INC_DIR := $(WITH_GMP_DIR)/include
21WITH_GMP_LIB_DIR := $(WITH_GMP_DIR)/lib
22endif
23
24# Specify installation prefix and staged install destination.
25PREFIX := /usr/local
26DESTDIR :=
27
28# Specify runtime and compile arguments given to (the to-be-built) `mlton` when
29# compiling distributed executables ((self-compiled) `mlton`, `mllex`, `mlyacc`,
30# `mlprof`, and `mlnlffigen`).
31# Can be used for testing (e.g., `MLTON_COMPILE_ARGS="-codegen c"`) or for
32# downstream packaging.
33MLTON_RUNTIME_ARGS :=
34MLTON_COMPILE_ARGS :=
35
36# Specify runtime and compile arguments given to "old" `mlton` when compiling
37# "bootstrapped" `mlton`.
38# Can be used to work around bugs in "old" `mlton` when compiling "bootstrapped"
39# `mlton` (e.g., `BOOTSTRAP_MLTON_COMPILE_ARGS="-drop-pass 'deepFlatten'"`).
40BOOTSTRAP_MLTON_RUNTIME_ARGS :=
41BOOTSTRAP_MLTON_COMPILE_ARGS :=
42
43# Specify standard tools.
44# Can be used for alternative tools (e.g., `SED=gsed`).
45DIFF := diff
46FIND := find
47GIT := git
48GREP := grep
49GZIP := gzip
50PATCH := patch
51SED := sed
52TAR := tar
53XARGS := xargs
54
55######################################################################
56######################################################################
57
58SRC := $(shell pwd)
59BUILD := $(SRC)/build
60BIN := $(BUILD)/bin
61LIB := $(BUILD)/lib/mlton
62INC := $(LIB)/include
63
64PATH := $(BIN):$(shell echo $$PATH)
65
66MLTON_VERSION := 20180207
67
68HOST_ARCH := $(shell ./bin/host-arch)
69HOST_OS := $(shell ./bin/host-os)
70TARGET := self
71TARGET_ARCH := $(HOST_ARCH)
72TARGET_OS := $(HOST_OS)
73
74ifeq (mingw, $(TARGET_OS))
75EXE := .exe
76else
77EXE :=
78endif
79
80CP := cp -fpR
81MKDIR := mkdir -p
82MV := mv -f
83RM := rm -rf
84
85######################################################################
86
87# If we're compiling with another version of MLton, then we want to do another
88# round of compilation so that we get a MLton built without stubs.
89ifeq (other, $(shell if [ ! -x "$(BIN)/mlton" ]; then echo other; fi))
90BOOTSTRAP:=true
91else
92BOOTSTRAP:=false
93endif
94CHECK_FIXPOINT:=false
95
96.PHONY: all
97all:
98 $(MAKE) dirs runtime
99 $(MAKE) compiler CHECK_FIXPOINT=false # tools0 + mlton0 -> mlton1
100 $(MAKE) script basis-no-check constants basis-check libraries
101 $(MAKE) tools CHECK_FIXPOINT=false # tools0 + mlton1 -> tools1
102ifeq (true, $(findstring true,$(BOOTSTRAP) $(CHECK_FIXPOINT)))
103 $(RM) "$(SRC)/mlton/mlton-compile$(EXE)"
104 $(MAKE) -C "$(SRC)/mlton/front-end" clean
105 $(MAKE) compiler CHECK_FIXPOINT=false # tools1 + mlton1 -> mlton2
106ifeq (true, $(CHECK_FIXPOINT))
107 $(MAKE) tools-clean
108 $(MAKE) tools CHECK_FIXPOINT=true # tools1 + mlton1 -> tools2; tools2 == tools1
109 $(RM) "$(SRC)/mlton/mlton-compile$(EXE)"
110 $(MAKE) -C "$(SRC)/mlton/front-end" clean
111 $(MAKE) compiler CHECK_FIXPOINT=true # tools2 + mlton2 -> mlton3; mlton3 == mlton2
112endif
113endif
114 @echo 'Build of MLton succeeded.'
115
116.PHONY: basis-no-check
117basis-no-check:
118 $(RM) "$(LIB)/sml/basis"
119 $(MKDIR) "$(LIB)/sml/basis"
120 ( \
121 cd "$(SRC)/basis-library" && \
122 $(FIND) . -type f '(' -name '*.mlb' -o -name '*.sml' -o -name '*.sig' -o -name '*.fun' ')' | \
123 $(XARGS) $(TAR) cf - | \
124 ( cd "$(LIB)/sml/basis" && $(TAR) xf - ) \
125 )
126
127.PHONY: basis-check
128basis-check:
129 @echo 'Type checking basis.'
130 "$(BIN)/mlton" -disable-ann deadCode -stop tc '$$(SML_LIB)/basis/libs/all.mlb' >/dev/null
131
132.PHONY: basis
133basis:
134 $(MAKE) basis-no-check
135 $(MAKE) basis-check
136
137.PHONY: bootstrap-smlnj
138bootstrap-smlnj:
139 $(MAKE) smlnj-mlton
140 $(RM) "$(BIN)/mlton"
141 $(MAKE) BOOTSTRAP_MLTON=mlton.smlnj all
142 smlnj_heap_suffix=`echo 'TextIO.output (TextIO.stdErr, SMLofNJ.SysInfo.getHeapSuffix ());' | sml 2>&1 1> /dev/null` && $(RM) "$(LIB)/mlton/mlton-smlnj.$$smlnj_heap_suffix"
143 $(RM) "$(BIN)/mlton.smlnj"
144
145.PHONY: bootstrap-polyml
146bootstrap-polyml:
147 $(MAKE) polyml-mlton
148 $(RM) "$(BIN)/mlton"
149 $(MAKE) BOOTSTRAP_MLTON=mlton.polyml all
150 $(RM) "$(LIB)/mlton-polyml$(EXE)"
151 $(RM) "$(BIN)/mlton.polyml"
152
153.PHONY: clean
154clean:
155 ./bin/clean --exclude package
156
157.PHONY: clean-git
158clean-git:
159 $(FIND) . -type d -name .git -prune -exec $(RM) '{}' ';'
160
161.PHONY: compiler
162compiler:
163 $(MAKE) -C "$(SRC)/mlton" MLTON_OUTPUT=mlton-compile
164ifeq (true, $(CHECK_FIXPOINT))
165 $(DIFF) -b "$(SRC)/mlton/mlton-compile$(EXE)" "$(LIB)/mlton-compile$(EXE)"
166endif
167 $(CP) "$(SRC)/mlton/mlton-compile$(EXE)" "$(LIB)/"
168
169.PHONY: constants
170constants:
171 @echo 'Creating constants file.'
172 "$(BIN)/mlton" -target "$(TARGET)" -build-constants true > build-constants.c
173 "$(BIN)/mlton" -target "$(TARGET)" -output build-constants build-constants.c
174 ./build-constants$(EXE) >"$(LIB)/targets/$(TARGET)/constants"
175 $(RM) build-constants$(EXE) build-constants.c
176
177.PHONY: debugged
178debugged:
179 $(MAKE) -C "$(SRC)/mlton" MLTON_OUTPUT=mlton-compile.debug \
180 MLTON_COMPILE_ARGS="$(MLTON_COMPILE_ARGS) -debug true -const 'Exn.keepHistory true' -profile-val true -const 'MLton.debug true' -disable-pass 'deepFlatten'"
181 $(CP) "$(SRC)/mlton/mlton-compile.debug$(EXE)" "$(LIB)/"
182 $(SED) -e 's/mlton-compile/mlton-compile.debug/' \
183 < "$(BIN)/mlton" \
184 > "$(BIN)/mlton.debug"
185 chmod u+x "$(BIN)/mlton.debug"
186
187.PHONY: dirs
188dirs:
189 $(MKDIR) "$(BIN)" "$(LIB)" "$(INC)"
190 $(MKDIR) "$(LIB)/targets/$(TARGET)/include"
191 $(MKDIR) "$(LIB)/targets/$(TARGET)/sml"
192
193.PHONY: docs
194docs:
195 $(MAKE) -C "$(SRC)/mllex" docs
196 $(MAKE) -C "$(SRC)/mlyacc" docs
197 $(MAKE) -C "$(SRC)/doc/guide"
198
199define LIBRARIES_NO_CHECK_TEMPLATE
200 $(RM) "$(LIB)/sml/$(1)"
201 $(MKDIR) "$(LIB)/sml/$(1)"
202 ( \
203 cd "$(SRC)/lib/$(1)$(2)" && \
204 $(FIND) . '!' -path '*/.cm/*' $(3) -type f '(' -name '*.mlb' -o -name '*.sml' -o -name '*.sig' -o -name '*.fun' ')' | \
205 $(XARGS) $(TAR) cf - | \
206 ( cd "$(LIB)/sml/$(1)" && $(TAR) xf - ) \
207 )
208
209endef
210
211.PHONY: libraries-no-check
212libraries-no-check:
213 $(MAKE) -C "$(SRC)/lib/ckit-lib"
214 $(call LIBRARIES_NO_CHECK_TEMPLATE,ckit-lib,/ckit/src,)
215 $(call LIBRARIES_NO_CHECK_TEMPLATE,cml,,'!' -path '*/tests/*')
216 $(MAKE) -C "$(SRC)/lib/mllpt-lib"
217 $(call LIBRARIES_NO_CHECK_TEMPLATE,mllpt-lib,/ml-lpt/lib,)
218 $(MAKE) -C "$(SRC)/lib/mlnlffi-lib"
219 $(call LIBRARIES_NO_CHECK_TEMPLATE,mlnlffi-lib,,)
220 $(MAKE) -C "$(SRC)/lib/mlrisc-lib"
221 $(call LIBRARIES_NO_CHECK_TEMPLATE,mlrisc-lib,/MLRISC,'!' -path '*/demo/*' '!' -path '*/Tools/*' '!' -path './autoload.sml' '!' -path './make*.sml')
222 $(call LIBRARIES_NO_CHECK_TEMPLATE,mlyacc-lib,,)
223 $(MAKE) -C "$(SRC)/lib/smlnj-lib"
224 $(call LIBRARIES_NO_CHECK_TEMPLATE,smlnj-lib,/smlnj-lib,'!' -path '*/examples/*' '!' -path '*/tests/*' '!' -path '*/Tests/*')
225
226define LIBRARIES_CHECK_TEMPLATE
227 @echo "Type checking $(1) library."
228 "$(BIN)/mlton" -disable-ann deadCode -stop tc '$$(SML_LIB)/$(1)/$(1).mlb' >/dev/null
229endef
230
231.PHONY: libraries-check
232libraries-check:
233 $(call LIBRARIES_CHECK_TEMPLATE,ckit-lib)
234 $(call LIBRARIES_CHECK_TEMPLATE,cml)
235 $(call LIBRARIES_CHECK_TEMPLATE,mllpt-lib)
236 $(call LIBRARIES_CHECK_TEMPLATE,mlnlffi-lib)
237 $(call LIBRARIES_CHECK_TEMPLATE,mlrisc-lib)
238 $(call LIBRARIES_CHECK_TEMPLATE,mlyacc-lib)
239 $(call LIBRARIES_CHECK_TEMPLATE,smlnj-lib)
240
241.PHONY: libraries
242libraries:
243 $(MAKE) libraries-no-check
244 $(MAKE) libraries-check
245
246.PHONY: polyml-mlton
247polyml-mlton:
248 $(MAKE) dirs runtime
249 $(MAKE) -C "$(SRC)/mlton" polyml-mlton
250 $(CP) "$(SRC)/mlton/mlton-polyml$(EXE)" "$(LIB)/"
251 $(MAKE) script basis-no-check constants libraries-no-check
252 $(SED) \
253 -e 's;doitMLton "$$@";# doitMLton "$$@";' \
254 -e 's;doitSMLNJ "$$@";# doitSMLNJ "$$@";' \
255 < "$(BIN)/mlton" \
256 > "$(BIN)/mlton.polyml"
257 chmod u+x "$(BIN)/mlton.polyml"
258 @echo 'Build of MLton (with Poly/ML) succeeded.'
259
260define PROFILED_TEMPLATE
261 $(MAKE) -C "$(SRC)/mlton" MLTON_OUTPUT=mlton-compile.$(1) \
262 MLTON_COMPILE_ARGS="$(MLTON_COMPILE_ARGS) -profile $(1)"
263 $(CP) "$(SRC)/mlton/mlton-compile.$(1)$(EXE)" "$(LIB)/"
264 $(SED) -e "s/mlton-compile/mlton-compile.$(1)/" \
265 < "$(BIN)/mlton" \
266 >"$(BIN)/mlton.$(1)"
267 chmod u+x "$(BIN)/mlton.$(1)"
268endef
269
270.PHONY: profiled-alloc
271profiled-alloc:
272 $(call PROFILED_TEMPLATE,alloc)
273
274.PHONY: profiled-count
275profiled-count:
276 $(call PROFILED_TEMPLATE,count)
277
278.PHONY: profiled-time
279profiled-time:
280 $(call PROFILED_TEMPLATE,time)
281
282.PHONY: profiled
283 $(MAKE) profiled-alloc
284 $(MAKE) profiled-count
285 $(MAKE) profiled-time
286
287.PHONY: runtime
288runtime:
289 @echo 'Compiling MLton runtime system for $(TARGET).'
290 $(MAKE) -C "$(SRC)/runtime"
291 $(CP) "$(SRC)/include/"*.h "$(INC)/"
292 $(CP) "$(SRC)/runtime/"*.a "$(LIB)/targets/$(TARGET)/"
293 $(CP) "$(SRC)/runtime/gen/sizes" "$(LIB)/targets/$(TARGET)/"
294 $(CP) "$(SRC)/runtime/gen/c-types.sml" "$(LIB)/targets/$(TARGET)/sml/"
295 echo "$(TARGET_OS)" > "$(LIB)/targets/$(TARGET)/os"
296 echo "$(TARGET_ARCH)" > "$(LIB)/targets/$(TARGET)/arch"
297 $(CP) "$(SRC)/runtime/gen/basis-ffi.sml" \
298 basis-library/primitive/basis-ffi.sml
299 $(CP) "$(SRC)/runtime/"*.h "$(INC)/"
300 $(MV) "$(INC)/c-types.h" "$(LIB)/targets/$(TARGET)/include"
301 for d in basis basis/Real basis/Word gc platform util; do \
302 $(MKDIR) "$(INC)/$$d"; \
303 $(CP) "$(SRC)/runtime/$$d/"*.h "$(INC)/$$d"; \
304 done
305
306.PHONY: script
307script:
308 $(SED) \
309 -e "s;^EXE=.*;EXE=\"$(EXE)\";" \
310 -e "s;^CC=.*;CC=\"$(CC)\";" \
311 -e "s;^GMP_INC_DIR=.*;GMP_INC_DIR=\"$(WITH_GMP_INC_DIR)\";" \
312 -e "s;^GMP_LIB_DIR=.*;GMP_LIB_DIR=\"$(WITH_GMP_LIB_DIR)\";" \
313 < "$(SRC)/bin/mlton-script" > "$(BIN)/mlton"
314 chmod a+x "$(BIN)/mlton"
315 $(CP) "$(SRC)/bin/static-library" "$(LIB)"
316ifeq (mingw, $(TARGET_OS))
317 $(CP) "$(SRC)/bin/static-library.bat" "$(LIB)"
318endif
319
320.PHONY: smlnj-mlton
321smlnj-mlton:
322 $(MAKE) dirs runtime
323 $(MAKE) -C "$(SRC)/mlton" smlnj-mlton
324 smlnj_heap_suffix=`echo 'TextIO.output (TextIO.stdErr, SMLofNJ.SysInfo.getHeapSuffix ());' | sml 2>&1 1> /dev/null` && $(CP) "$(SRC)/mlton/mlton-smlnj.$$smlnj_heap_suffix" "$(LIB)/"
325 $(MAKE) script basis-no-check constants libraries-no-check
326 $(SED) \
327 -e 's;doitMLton "$$@";# doitMLton "$$@";' \
328 -e 's;doitPolyML "$$@";# doitPolyML "$$@";' \
329 < "$(BIN)/mlton" \
330 > "$(BIN)/mlton.smlnj"
331 chmod u+x "$(BIN)/mlton.smlnj"
332 @echo 'Build of MLton (with SML/NJ) succeeded.'
333
334.PHONY: smlnj-mlton-x2
335smlnj-mlton-x2:
336 $(MAKE) SMLNJ_CM_SERVERS_NUM=2 smlnj-mlton
337
338.PHONY: smlnj-mlton-x4
339smlnj-mlton-x4:
340 $(MAKE) SMLNJ_CM_SERVERS_NUM=4 smlnj-mlton
341
342.PHONY: smlnj-mlton-x8
343smlnj-mlton-x8:
344 $(MAKE) SMLNJ_CM_SERVERS_NUM=8 smlnj-mlton
345
346.PHONY: smlnj-mlton-x16
347smlnj-mlton-x16:
348 $(MAKE) SMLNJ_CM_SERVERS_NUM=16 smlnj-mlton
349
350.PHONY: traced
351traced:
352 $(MAKE) -C "$(SRC)/mlton" MLTON_OUTPUT=mlton-compile.trace \
353 MLTON_COMPILE_ARGS="$(MLTON_COMPILE_ARGS) -const 'Exn.keepHistory true' -profile-val true -const 'MLton.debug true' -disable-pass 'deepFlatten'"
354 $(CP) "$(SRC)/mlton/mlton-compile.trace$(EXE)" "$(LIB)/"
355 $(SED) -e 's/mlton-compile/mlton-compile.trace/' \
356 < "$(BIN)/mlton" \
357 > "$(BIN)/mlton.trace"
358 chmod u+x "$(BIN)/mlton.trace"
359
360ifeq (true, $(CHECK_FIXPOINT))
361define TOOLS_TEMPLATE_CHECK_FIXPOINT
362 $(DIFF) -b "$(SRC)/$(1)/$(1)$(EXE)" "$(BIN)/$(1)$(EXE)"
363endef
364else
365define TOOLS_TEMPLATE_CHECK_FIXPOINT
366endef
367endif
368
369define TOOLS_TEMPLATE
370 $(MAKE) -C "$(SRC)/$(1)"
371 $(call TOOLS_TEMPLATE_CHECK_FIXPOINT,$(1))
372 $(CP) "$(1)/$(1)$(EXE)" "$(BIN)/"
373endef
374
375.PHONY: tools
376tools:
377 $(call TOOLS_TEMPLATE,mllex)
378 $(call TOOLS_TEMPLATE,mlyacc)
379 $(call TOOLS_TEMPLATE,mlprof)
380 $(call TOOLS_TEMPLATE,mlnlffigen)
381
382.PHONY: tools-clean
383tools-clean:
384 $(MAKE) -C "$(SRC)/mllex" clean
385 $(MAKE) -C "$(SRC)/mlyacc" clean
386 $(MAKE) -C "$(SRC)/mlprof" clean
387 $(MAKE) -C "$(SRC)/mlnlffigen" clean
388
389.PHONY: check
390check:
391 ./bin/regression $(CHECK_ARGS)
392
393
394.PHONY: version
395version:
396 @echo 'Instantiating version numbers.'
397 for f in \
398 "$(SRC)/Makefile" \
399 "$(SRC)/mlton/Makefile" \
400 "$(SRC)/doc/guide/Makefile" \
401 ; do \
402 $(SED) -e "s/^MLTON_VERSION := .*/MLTON_VERSION := $(MLTON_VERSION)/" <"$$f" >z && \
403 mv z "$$f"; \
404 done
405
406
407prefix := $(PREFIX)
408exec_prefix := $(prefix)
409bindir := $(exec_prefix)/bin
410datarootdir := $(prefix)/share
411docdir := $(datarootdir)/doc/mlton
412libdir := $(exec_prefix)/lib
413mandir := $(datarootdir)/man
414man1dir := $(mandir)/man1
415
416TBIN := $(DESTDIR)$(bindir)
417TLIB := $(DESTDIR)$(libdir)/mlton
418TMAN := $(DESTDIR)$(man1dir)
419TDOC := $(DESTDIR)$(docdir)
420TEXM := $(TDOC)/examples
421
422GZIP_MAN := true
423ifeq ($(findstring $(TARGET_OS), openbsd solaris), $(TARGET_OS))
424GZIP_MAN := false
425endif
426
427.PHONY: install
428install: install-no-strip install-strip install-docs
429
430MAN_PAGES := \
431 mllex.1 \
432 mlnlffigen.1 \
433 mlprof.1 \
434 mlton.1 \
435 mlyacc.1
436
437.PHONY: install-no-strip
438install-no-strip:
439 $(MKDIR) "$(TBIN)" "$(TLIB)" "$(TMAN)"
440 $(CP) "$(BIN)/." "$(TBIN)/"
441 $(CP) "$(LIB)/." "$(TLIB)/"
442 cd "$(SRC)/man" && $(CP) $(MAN_PAGES) "$(TMAN)/"
443ifeq (true, $(GZIP_MAN))
444 cd "$(TMAN)" && $(GZIP) --force --best $(MAN_PAGES);
445endif
446
447.PHONY: install-strip
448install-strip: install-no-strip
449 for f in "$(TLIB)/mlton-compile$(EXE)" \
450 "$(TBIN)/mllex$(EXE)" \
451 "$(TBIN)/mlyacc$(EXE)" \
452 "$(TBIN)/mlprof$(EXE)" \
453 "$(TBIN)/mlnlffigen$(EXE)"; do \
454 $(STRIP) "$$f"; \
455 done
456
457REGRESSION_EXAMPLES := \
458 callcc.sml command-line.sml hello-world.sml same-fringe.sml \
459 signals.sml size.sml taut.sml thread1.sml thread2.sml \
460 thread-switch.sml timeout.sml
461
462.PHONY: install-docs
463install-docs:
464 $(MKDIR) "$(TDOC)" "$(TDOC)/license"
465 ( \
466 cd "$(SRC)" && \
467 $(CP) CHANGELOG.adoc README.adoc "$(TDOC)/" && \
468 $(CP) LICENSE "$(TDOC)/license/MLton-LICENSE" \
469 )
470 ( \
471 cd "$(SRC)/doc" && \
472 $(FIND) examples -type f '!' -name .gitignore \
473 | $(XARGS) $(TAR) cf - \
474 | ( cd "$(TDOC)/" && $(TAR) xf - ) \
475 )
476 ( \
477 cd "$(SRC)/doc" && \
478 $(FIND) license -type f '!' -name .gitignore \
479 | $(XARGS) $(TAR) cf - \
480 | ( cd "$(TDOC)/" && $(TAR) xf - ) \
481 )
482 if [ -d "$(SRC)/doc/guide/localhost" ]; then \
483 $(CP) "$(SRC)/doc/guide/localhost" "$(TDOC)/guide"; \
484 fi
485 if [ -r "$(SRC)/doc/guide/mlton-guide.pdf" ]; then \
486 $(CP) "$(SRC)/doc/guide/mlton-guide.pdf" "$(TDOC)/"; \
487 fi
488 if [ -r "mllex/mllex.pdf" ]; then \
489 $(CP) "mllex/mllex.pdf" "$(TDOC)/"; \
490 fi
491 if [ -r "mlyacc/mlyacc.pdf" ]; then \
492 $(CP) "mlyacc/mlyacc.pdf" "$(TDOC)/"; \
493 fi
494 ( \
495 cd "$(SRC)/util" && \
496 $(FIND) cm2mlb -type f '!' -name .gitignore \
497 | $(XARGS) $(TAR) cf - \
498 | ( cd "$(TDOC)/" && $(TAR) xf - ) \
499 )
500 ( \
501 cd "$(SRC)/regression" && \
502 $(CP) $(REGRESSION_EXAMPLES) "$(TEXM)/" \
503 )
504
505
506.PHONY: source-release
507source-release:
508 $(MAKE) clean
509 $(MAKE) MLTON_VERSION=$(MLTON_VERSION) version
510 ( cd "$(SRC)/mllex" ; latexmk -pdf lexgen ; latexmk -c lexgen )
511 $(MAKE) -C "$(SRC)/mllex" mllex.pdf
512 ( cd "$(SRC)/mlyacc/doc"; latexmk -pdf mlyaccc ; latexmk -c mlyacc )
513 $(MAKE) -C "$(SRC)/mlyacc" mlyacc.pdf
514 $(MAKE) -C doc/guide
515 $(TAR) cvzf ../mlton-$(MLTON_VERSION).src.tgz \
516 --exclude .git --exclude package \
517 --transform "s@^@mlton-$(MLTON_VERSION)/@S" \
518 *
519
520MLTON_BINARY_RELEASE := 1
521MLTON_BINARY_RELEASE_SUFFIX :=
522.PHONY: binary-release
523binary-release:
524 $(MAKE) all docs
525 $(RM) "$(SRC)/mlton-$(MLTON_VERSION)-$(MLTON_BINARY_RELEASE).$(TARGET_ARCH)-$(TARGET_OS)$(MLTON_BINARY_RELEASE_SUFFIX)"
526 $(MKDIR) "$(SRC)/mlton-$(MLTON_VERSION)-$(MLTON_BINARY_RELEASE).$(TARGET_ARCH)-$(TARGET_OS)$(MLTON_BINARY_RELEASE_SUFFIX)"
527 $(MAKE) DESTDIR="$(SRC)/mlton-$(MLTON_VERSION)-$(MLTON_BINARY_RELEASE).$(TARGET_ARCH)-$(TARGET_OS)$(MLTON_BINARY_RELEASE_SUFFIX)" PREFIX="" install
528 $(CP) "$(SRC)/Makefile.binary" "$(SRC)/mlton-$(MLTON_VERSION)-$(MLTON_BINARY_RELEASE).$(TARGET_ARCH)-$(TARGET_OS)$(MLTON_BINARY_RELEASE_SUFFIX)/Makefile"
529 $(CP) "$(SRC)/CHANGELOG.adoc" "$(SRC)/LICENSE" "$(SRC)/README.adoc" "$(SRC)/mlton-$(MLTON_VERSION)-$(MLTON_BINARY_RELEASE).$(TARGET_ARCH)-$(TARGET_OS)$(MLTON_BINARY_RELEASE_SUFFIX)/"
530 $(TAR) cvzf ../mlton-$(MLTON_VERSION)-$(MLTON_BINARY_RELEASE).$(TARGET_ARCH)-$(TARGET_OS)$(MLTON_BINARY_RELEASE_SUFFIX).tgz \
531 mlton-$(MLTON_VERSION)-$(MLTON_BINARY_RELEASE).$(TARGET_ARCH)-$(TARGET_OS)$(MLTON_BINARY_RELEASE_SUFFIX)
532 $(RM) mlton-$(MLTON_VERSION)-$(MLTON_BINARY_RELEASE).$(TARGET_ARCH)-$(TARGET_OS)$(MLTON_BINARY_RELEASE_SUFFIX)
533
534BSDSRC := /tmp/mlton-$(MLTON_VERSION)
535MLTON_FREEBSD_RELEASE := 1
536.PHONY: freebsd
537freebsd:
538 $(MAKE) clean clean-git version
539 $(RM) "$(BSDSRC)"
540 $(MKDIR) "$(BSDSRC)"
541 ( cd $(SRC) && tar -cpf - . ) | ( cd "$(BSDSRC)" && tar -xpf - )
542 cd /tmp && tar -cpf - mlton-$(MLTON_VERSION) | \
543 $(GZIP) --force --best >/usr/ports/distfiles/mlton-$(MLTON_VERSION)-$(MLTON_FREEBSD_RELEASE).freebsd.src.tgz
544 # do not change "make" to "$(MAKE)" in the following line
545 cd "$(BSDSRC)/package/freebsd" && MAINTAINER_MODE=yes make build-package