File: rules

package info (click to toggle)
nhc98 1.16-15
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 62,544 kB
  • ctags: 103,012
  • sloc: ansic: 831,077; haskell: 60,111; java: 4,116; makefile: 3,045; sh: 2,183; cpp: 212
file content (174 lines) | stat: -rwxr-xr-x 5,257 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
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
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

PACKAGE=nhc98
DOCDIR=nhc98-doc
HMAKE=/usr/bin/hmake
VARFILE=/usr/lib/haskell-utils/nhc98_vars

ifeq '$(findstring $(shell dpkg-architecture -qDEB_HOST_ARCH), powerpc)' ''
USE_GCC_295=no
else
USE_GCC_295=yes
endif

build: config build-stamp
build-stamp: 
	dh_testdir
	# Verify install scripts
	bash -n debian/nhc98-doc.postinst
	bash -n debian/nhc98-doc.prerm

	$(MAKE) all

	mkdir debian/test-build
	echo 'main = putStrLn "Foo"' > debian/test-build/foo.hs
	script/nhc98 debian/test-build/foo.hs -o debian/test-build/foo
	[ "$$(debian/test-build/foo)" = "Foo" ]                    
	rm debian/test-build/*
	echo 'main = putStrLn "Foo"' > debian/test-build/foo.hs
	script/nhc98 debian/test-build/foo.hs -o debian/test-build/foo -O2
	[ "$$(debian/test-build/foo)" = "Foo" ]

	touch build-stamp


config: config-stamp
config-stamp:
ifeq '${USE_GCC_295}' 'yes'
	CC=gcc-2.95 ./configure --prefix=/usr --mandir=/usr/share/man/man1 \
						    --buildwith=gcc-2.95
else
	./configure --prefix=/usr --mandir=/usr/share/man/man1
endif

	touch config-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp install-stamp config-stamp

	-$(MAKE) clean
	-rm src/runtime/Builtin/haskell2c.h
	-rm src/runtime/Builtin/HsFFI.h
	-rm src/runtime/Builtin/twopass.h
	-rm src/runtime/Integer/flt.h
	-rm src/runtime/Kernel/bytecode.h
	-rm src/runtime/Kernel/bytecode_o.h
	-rm src/runtime/Kernel/cinterface.h
	-rm src/runtime/Kernel/mutlib.h
	-rm src/runtime/Kernel/newbytecode.h
	-rm src/runtime/Kernel/newmacros.h
	-rm src/runtime/Kernel/node.h
	-rm src/runtime/Kernel/runtime.h
	-rm src/runtime/Kernel/stableptr.h
	-rm src/runtime/Mk/mkByHand.h
	-rm src/runtime/Mk/mkByProg.h
	-rm src/runtime/Mk/mk.h
	-rm src/runtime/Mk/mutlib.h
	-rm script/Main.hi src/compiler98/ghc_floats.c src/runtime/nhc98heap.c
	-rm src/prelude/GreenCard/GreenCard_.hs script/nhc98 script/hmake
	-rm script/hmake-config script/hi script/greencard-nhc98
	-rm src/interpreter/Unlit.hc
	-rm src/interpreter/Compiler.hc
	-rm src/interpreter/Config.hc
	-rm src/interpreter/Platform.hc
	-rm -r src/prelude/*-Linux
	-rm -r lib/*-*
	-rm -r targets
	-rm -rf debian/test-build

	dh_clean

install: install-stamp
install-stamp: build-stamp
	dh_testdir
	#dh_testroot
	dh_clean -k
	dh_installdirs
	dh_installdocs README

	$(MAKE) DESTDIR=`pwd`/debian/nhc98 install
	cp `pwd`/debian/hood.1 `pwd`/debian/nhc98/usr/share/man/man1
	cp `pwd`/debian/greencard-nhc98.1 `pwd`/debian/nhc98/usr/share/man/man1
	cp `pwd`/debian/tprofprel.1 `pwd`/debian/nhc98/usr/share/man/man1

	for i in debian/nhc98/usr/bin/*; \
		do  mv "$$i" "$$i.old"; \
		    sed "s/^MACHINE=.*/MACHINE=$$(script/harch)/" < "$$i.old" \
			                                              > "$$i"; \
			chmod --reference="$$i.old" "$$i"; \
			rm "$$i.old"; \
		done
	$(MAKE) -f debian/in-rules all
	# Remove hmake and friends (now in their own source
	# release for hmake)
	-rm `pwd`/debian/nhc98/usr/share/man/man1/hmake*
	-rm `pwd`/debian/nhc98/usr/share/man/man1/harch*
	-rm -r `pwd`/debian/nhc98/usr/lib/hmake
	-rm -r `pwd`/debian/nhc98/usr/bin/hmake*
	-rm `pwd`/debian/nhc98/usr/bin/harch
	-rm `pwd`/debian/nhc98/usr/bin/hi

	/usr/bin/install -c -m 755 -d debian/nhc98/`dirname $(VARFILE)`
	echo 'nhc98_arches="arm hppa i386 mips mipsel powerpc s390"' > debian/nhc98/$(VARFILE)
	echo 'nhc98_lib_bdeps="nhc98 (>= 1.16-7) [$$nhc98_arches]"' >> debian/nhc98/$(VARFILE)
	echo 'nhc98_lib_deps="nhc98 (>= 1.16-7)"' >> debian/nhc98/$(VARFILE)
	echo 'nhc98_app_bdeps="nhc98 [$$nhc98_arches]"' >> debian/nhc98/$(VARFILE)

ifeq '${USE_GCC_295}' 'yes'
	echo "gcc=gcc-2.95" >> debian/nhc98.substvars
else
	echo "gcc=gcc-3.3 (>= 1:3.3.3-2)" >> debian/nhc98.substvars
endif

	touch install-stamp

# Build architecture-independent files here.
binary-indep: build install
# Documentation!
	cp -ar docs/* `pwd`/debian/$(DOCDIR)/usr/share/doc/$(DOCDIR)
	-rm -r `pwd`/debian/$(DOCDIR)/usr/share/doc/$(DOCDIR)/CVS
	-rm -r `pwd`/debian/$(DOCDIR)/usr/share/doc/$(DOCDIR)/bugs/CVS
	-rm -r `pwd`/debian/$(DOCDIR)/usr/share/doc/$(DOCDIR)/examples/CVS
	-rm -r `pwd`/debian/$(DOCDIR)/usr/share/doc/$(DOCDIR)/hmake/CVS
	-rm -r `pwd`/debian/$(DOCDIR)/usr/share/doc/$(DOCDIR)/implementation-notes/CVS
	-rm -r `pwd`/debian/$(DOCDIR)/usr/share/doc/$(DOCDIR)/libs/CVS
	cp `pwd`/debian/hmake-doc `pwd`/debian/$(DOCDIR)/usr/share/doc-base
	cp `pwd`/debian/nhc98-docs `pwd`/debian/$(DOCDIR)/usr/share/doc-base
	cp `pwd`/debian/nhc98-libs-doc `pwd`/debian/$(DOCDIR)/usr/share/doc-base


# Build architecture-dependent files here.
binary-arch: build install
#	dh_testversion
	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installexamples
	dh_installmenu
#	dh_installemacsen
#	dh_installinit
#	dh_installcron
#	dh_installmanpages
#	dh_undocumented
	dh_installchangelogs
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_makeshlibs
	dh_md5sums
	dh_builddeb

source diff:                                                                  
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

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