Backport from sid to buster
[hcoop/debian/mlton.git] / Makefile.binary
... / ...
CommitLineData
1# Specify C compiler and binutils.
2# Can be used for alternative tools (e.g., `CC=clang` or `CC=gcc-7`).
3CC := gcc
4
5# Specify GMP include and library paths, if not on default search paths.
6WITH_GMP_DIR :=
7ifneq ($(WITH_GMP_DIR),)
8WITH_GMP_INC_DIR := $(WITH_GMP_DIR)/include
9WITH_GMP_LIB_DIR := $(WITH_GMP_DIR)/lib
10endif
11
12# Specify installation prefix and staged install destination.
13PREFIX := /usr/local
14
15SED := sed
16
17######################################################################
18######################################################################
19
20ROOT := $(shell pwd)
21
22CP := cp -fpR
23MKDIR := mkdir -p
24
25######################################################################
26
27SBIN := $(ROOT)/bin
28SLIB := $(ROOT)/lib/mlton
29SMAN := $(ROOT)/share/man/man1
30SDOC := $(ROOT)/share/doc/mlton
31
32prefix := $(PREFIX)
33exec_prefix := $(prefix)
34bindir := $(exec_prefix)/bin
35datarootdir := $(prefix)/share
36docdir := $(datarootdir)/doc/mlton
37libdir := $(exec_prefix)/lib
38mandir := $(datarootdir)/man
39man1dir := $(mandir)/man1
40
41TBIN := $(bindir)
42TLIB := $(libdir)/mlton
43TMAN := $(man1dir)
44TDOC := $(docdir)
45TEXM := $(TDOC)/examples
46
47.PHONY: install
48install:
49 mkdir -p "$(TBIN)" "$(TLIB)" "$(TMAN)" "$(TDOC)"
50 $(CP) "$(SBIN)/." "$(TBIN)/"
51 $(CP) "$(SLIB)/." "$(TLIB)/"
52 $(CP) "$(SMAN)/." "$(TMAN)/"
53 if [ -d "$(SDOC)" ]; then $(CP) "$(SDOC)/." "$(TDOC)/"; fi
54
55.PHONY: update
56update:
57 $(CP) "$(SBIN)/mlton" "$(SBIN)/mlton.bak"
58 $(SED) \
59 -e "s;^CC=.*;CC=\"$(CC)\";" \
60 -e "s;^GMP_INC_DIR=.*;GMP_INC_DIR=\"$(WITH_GMP_INC_DIR)\";" \
61 -e "s;^GMP_LIB_DIR=.*;GMP_LIB_DIR=\"$(WITH_GMP_LIB_DIR)\";" \
62 < "$(SBIN)/mlton.bak" > "$(SBIN)/mlton"
63 chmod a+x "$(SBIN)/mlton"
64 $(RM) "$(SBIN)/mlton.bak"