File: rules

package info (click to toggle)
smlnj 110.79-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 82,508 kB
  • ctags: 117,516
  • sloc: ansic: 32,532; asm: 6,314; sh: 2,303; makefile: 1,821; perl: 1,170; pascal: 295; yacc: 190; cs: 78; python: 77; lisp: 19
file content (171 lines) | stat: -rwxr-xr-x 5,120 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f
# -*- makefile -*-

export DH_OPTIONS

SHELL:=/bin/sh

ROOT:=$(CURDIR)/build-dir

CONFIGDIR:=$(ROOT)/config
SRCDIR:=$(ROOT)/src
BS_SML:=$(ROOT)/bootstrap/bin/sml
BS_LINK:=$(ROOT)/bootstrap/bin/.link-sml

SMLNJ_HOME:=/usr/lib/smlnj
BINDIR:=$(SMLNJ_HOME)/bin
HEAPDIR:=$(BINDIR)/heap
RUNDIR:=$(BINDIR)/run
LIBDIR:=$(BINDIR)/lib

VERSION=$(shell cat $(CONFIGDIR)/version)

srcdirs:=ckit cml config doc eXene heap2asm ml-burg ml-lex ml-lpt MLRISC ml-yacc nlffi pgraph smlnj-c smlnj-lib trace-debug-profile
basedirs:=cm compiler old-basis runtime system

notlibs:=smlnj-runtime smlnj-doc
libpkgs:=$(filter-out $(notlibs),$(shell dh_listpackages))

vars.sed:
	echo "s,@SHELL@,$(SHELL),g" > vars.sed
	echo "s,@SMLNJ_HOME@,$(SMLNJ_HOME)," >> vars.sed
	echo "s,@BINDIR@,$(BINDIR)," >> vars.sed
	echo "s,@VERSION@,$(VERSION)," >> vars.sed

arch-n-opsys: $(CONFIGDIR)/_arch-n-opsys vars.sed
	cat $< | sed -f vars.sed > $@
	chmod 777 $@

$(BS_SML):
	for f in $(srcdirs); do cp -a $$f $(ROOT)/bootstrap; done
	mkdir -p $(ROOT)/bootstrap/base
	for f in $(basedirs); do cp -a base/$$f $(ROOT)/bootstrap/base; done
	cd $(ROOT)/bootstrap && URLGETTER=/bin/false ./config/install.sh

boot.%.tgz: $(BS_SML)
	cd $(ROOT)/base/system && echo "CMB.make();" | $< "\$$smlnj/cmb.cm";
	cd $(ROOT)/base/system/sml.boot.$* \
	   && $(BS_LINK) @SMLboot=BOOTLIST @SMLheap=sml @SMLalloc=1M \
	                 @SMLrebuild="foo"
	rm -r $(ROOT)/base/system/sml.boot.$*
	rm -r $(ROOT)/base/system/*.bin.$*
	mv $(ROOT)/base/system/foo.boot.$* $(ROOT)/base/system/sml.boot.$*
	cd $(ROOT)/base/system && tar zcf $(ROOT)/$@ sml.boot.$*;

boot: arch-n-opsys
	eval `./arch-n-opsys` && $(MAKE) -f debian/rules boot.$$ARCH-unix.tgz;

smlnj: boot
	cd $(ROOT) && ./config/install.sh
	
	mkdir -p $(ROOT)/wrapper
	for c in `cd $(ROOT)/bin && ls`; do \
	  cat debian/wrapper.in | sed -f vars.sed -e "s/@CMD@/$$c/g" > $(ROOT)/wrapper/$$c; \
	  chmod 555 $(ROOT)/wrapper/$$c; \
	done

$(ROOT):
	mkdir -p $(ROOT)
	for d in $$(ls -A | grep -v -e debian -e build-dir); do cp -a $$d $(ROOT); done

# Architecture
build: build-arch-stamp build-indep-stamp

build-arch: build-arch-stamp
build-arch-stamp: $(ROOT)
	cp debian/targets build-dir/config/targets
	$(MAKE) -f debian/rules smlnj
	
	touch $@

build-indep: build-indep-stamp
build-indep-stamp: $(ROOT)
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	cd $(ROOT)/base/cm/Doc; latex manual.tex && latex manual.tex && dvipdfmx -o cm_manual.pdf manual.dvi
	cd $(ROOT)/ml-lpt/doc; latex manual.tex && latex manual.tex && dvipdfmx -o ml-lpt_manual.pdf manual.dvi
	cd $(ROOT)/ml-burg/doc; transfig -L ps tree.fig && make && latex doc.tex && latex doc.tex && dvipdfmx -o ml-burg_manual.pdf doc.dvi
	cd $(ROOT)/nlffi/lib/Doc/manual; latex nlffi.tex && latex nlffi.tex && dvipdfmx nlffi.dvi
	cd $(ROOT)/MLRISC/Doc; make
	cd $(ROOT)/MLRISC/Tools/Doc; make
	cd $(ROOT)/ml-lex; latex lexgen.tex && latex lexgen.tex && dvipdfmx lexgen.dvi
	cd $(ROOT)/ml-yacc/doc; latex mlyacc.tex && latex mlyacc.tex && dvipdfmx mlyacc.dvi
endif
	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f *-stamp
	
	rm -rf $(ROOT)
	rm -f vars.sed
	rm -f arch-n-opsys
	rm -f boot*tgz
	rm -rf $(SRCDIR)/system/foo.* $(SRCDIR)/system/sml.*
	
	rm -rf sml.boot.*
	
	dh_clean

install: install-arch-stamp install-indep-stamp

install-indep: build-indep-stamp
	dh_testdir
	dh_testroot
	dh_installdirs -i
	dh_install -i --list-missing

install-arch: build-arch-stamp
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs -a
	
	dh_installchangelogs -psmlnj base/compiler/ChangeLog upstream
	dh_installchangelogs -plibcml-smlnj cml/CHANGES upstream
	dh_installchangelogs -plibexene-smlnj eXene/CHANGES upstream
	dh_installchangelogs -plibsmlnj-smlnj smlnj-lib/CHANGES upstream
	dh_installchangelogs -plibckit-smlnj ckit/HISTORY upstream
	
	dh_install -a --list-missing
	
# make sure that the build path doesn't sneak in the link and run scripts
	sed -i 's/BIN_DIR=".*smlnj.*"/BIN_DIR="\/usr\/lib\/smlnj\/bin\/"/' $(CURDIR)/debian/smlnj-runtime/usr/lib/smlnj/bin/.*-sml
# install extrapathconfig rules to smlnj-runtime package to use as a seed for
# the trigger-generated pathconfig file
	install -m 644 config/extrapathconfig $(CURDIR)/debian/smlnj-runtime/usr/lib/smlnj/lib/
	echo bindir ../bin >> $(CURDIR)/debian/smlnj-runtime/usr/lib/smlnj/lib/extrapathconfig

binary-arch: install-arch
	dh_testdir -a
	dh_testroot -a 
	dh_installchangelogs -a
	dh_installdocs --exclude=".cvsignore" -a
	dh_installexamples --exclude=".cvsignore" -a
	dh_installman -a
	dh_strip -a --no-automatic-dbgsym
	dh_compress -a
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary-indep: install-indep
	dh_testdir -i
	dh_testroot -i 
	dh_installchangelogs -i
	dh_installdocs --exclude=".cvsignore" -i
	dh_installexamples --exclude=".cvsignore" -i
	dh_installman -i
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_shlibdeps -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

binary: binary-arch binary-indep
.PHONY: build build-arch build-indep clean binary-arch binary-indep binary install install-arch install-indep