File: rules

package info (click to toggle)
smlnj-runtime 110.44-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,968 kB
  • ctags: 5,368
  • sloc: ansic: 24,674; asm: 4,195; makefile: 1,353; sh: 91
file content (148 lines) | stat: -rwxr-xr-x 4,280 bytes parent folder | download
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
#! /usr/bin/make -f
# Debian/Fink build script for the SML/NJ runtime system.

# NOTE: I would like to keep debhelper(1) commands out of the "all"
# and "install" targets, since this tool is typically not used in
# Fink.  I do use it extensively below in the Debian targets "build"
# and "binary".   --league

package=smlnj-runtime
upstream=110.44
compatversion=110.42

# Installation directories.  Feel free to override any of these on the
# command line, but do not expect SML/NJ to work if you use different
# settings to install each sub-system!  In most cases, you should just
# set `prefix'.  If the relative path from `bindir' to `rundir'
# changes, then also set `runrel'.
prefix=/usr
docdir=${prefix}/share/doc/${package}
exec_prefix=${prefix}
bindir=${exec_prefix}/bin
localbindir=${exec_prefix}/local/bin
heapdir=${exec_prefix}/lib/smlnj/${upstream}
compatheapdir=${exec_prefix}/lib/smlnj/${compatversion}
localheapdir=${prefix}/local/lib/smlnj/${upstream}
compatlocalheapdir=${prefix}/local/lib/smlnj/${compatversion}
rundir=${exec_prefix}/lib/smlnj/${upstream}
runrel=../lib/smlnj/${upstream}
pkgdir=${exec_prefix}/lib/pkgconfig

# Determine architecture and operating system.  Supported types are
# listed below.  SML/NJ supports many different architectures, but
# usually expects the "native" Unix (sparc-solaris, hppa-hpux, etc).
# Some (probably minor) porting work is needed upstream to support
# these other architectures with Linux.

# Here are the supported system types, for now:
#   i386-linux
#   powerpc-linux
#   powerpc-darwin

system=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE 2>/dev/null)
_system=$(subst -, ,${system})
arch:=$(subst powerpc,ppc,$(subst i386,x86,$(word 1,${_system})))
opsys:=$(word 2,${_system})
heap:=$(arch)-$(opsys)

# Distinguish Mac OS 10.1 (Darwin 5.x)
ifeq ($(opsys), darwin)
  ifeq ($(shell uname -r | cut -f1 -d.), 5)
    opsys:=darwin5
  endif
endif

default: all

all: runtime run smlnj.pc debian/postinst debian/prerm debian/preinst

runtime: objs/mk.$(arch)-$(opsys)
	$(MAKE) -C objs -f mk.$(arch)-$(opsys)
	ln -s objs/run.$(arch)-$(opsys) runtime

run: debian/_run vars.sed
	sed -f vars.sed $< >$@

smlnj.pc: debian/_smlnj.pc vars.sed
	sed -f vars.sed $< >$@

debian/preinst: debian/_preinst vars.sed
	sed -f vars.sed $< >$@

debian/postinst: debian/_postinst vars.sed
	sed -f vars.sed $< >$@

debian/prerm: debian/_prerm vars.sed
	sed -f vars.sed $< >$@

vars.sed: debian/rules
	@echo s,@package@,$(package),g >$@
	@echo s,@upstream@,$(upstream),g >>$@
	@echo s,@prefix@,$(prefix),g >>$@
	@echo s,@bindir@,$(bindir),g >>$@
	@echo s,@localbindir@,$(localbindir),g >>$@
	@echo s,@heapdir@,$(heapdir),g >>$@
	@echo s,@localheapdir@,$(localheapdir),g >>$@
	@echo s,@rundir@,$(rundir),g >>$@
	@echo s,@runrel@,$(runrel),g >>$@
	@echo s,@arch@,$(arch),g >>$@
	@echo s,@heap@,$(heap),g >>$@
	@echo s,@compatversion@,$(compatversion),g >>$@
	@echo s,@compatheapdir@,$(compatheapdir),g >>$@
	@echo s,@compatlocalheapdir@,$(compatlocalheapdir),g >>$@

instdirs=install -d
instdata=install -m 644
instprog=install
compress=gzip -9
distro=Debian

install: all
	$(instdirs) -d $(rundir) $(docdir) $(pkgdir)
	$(instprog) runtime run $(rundir)
	$(instdata) smlnj.pc $(pkgdir)
	$(instdata) debian/copyright $(docdir)
	$(instdata) debian/changelog.$(distro) $(docdir)
	$(compress) $(docdir)/changelog.$(distro)
	$(instdata) debian/README $(docdir)/README.$(distro)

clean:
	rm -rf debian/tmp
	rm -f runtime run vars.sed smlnj.pc 
	rm -f debian/postinst debian/prerm debian/preinst
	rm -f *~ debian/*~
	rm -f debian/substvars debian/files debian/*.debhelper
	$(MAKE) -C objs clean >/dev/null

# Debian targets

build: all
binary: binary-indep binary-arch
binary-indep: build

binary-arch: build
	rm -rf debian/tmp
	$(MAKE) -f debian/rules install prefix=debian/tmp/usr
	dh_strip
	dh_installdocs
	dh_installdeb
	dh_fixperms
	dh_shlibdeps
	dh_gencontrol
	dh_builddeb

# Fink targets
version=$(upstream)-2
md5=$(shell md5sum ../$(package)_$(upstream).orig.tar.gz | cut -f1 -d' ')

fink-patch: 
	gunzip -c ../$(package)_$(upstream)-*.diff.gz \
	  >../$(package)-$(version).patch

fink-info: debian/finkinfo vars.sed
	sed -f vars.sed $< |\
	sed "s,@runtime-md5@,$(md5),g" \
	  >../$(package)-$(version).info

fink: fink-patch fink-info