File: rules

package info (click to toggle)
hat 2.05%2Brerolled-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 9,292 kB
  • ctags: 1,077
  • sloc: haskell: 74,306; ansic: 9,588; sh: 1,628; makefile: 596
file content (126 lines) | stat: -rwxr-xr-x 3,690 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
#!/usr/bin/make -f
# debian/rules for hat
# Based on a debhelper example

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

# Include dpatch
include /usr/share/dpatch/dpatch.make

# This has to be exported to make some magic below work.
export DH_OPTIONS

DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

# Handle noopt in DEB_BUILD_OPTIONS
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
  BUILDOPTS := -O0
else
  ifneq (,$(findstring $(DEB_HOST_ARCH),"arm m68k"))
    BUILDOPTS := -O0
  else
    BUILDOPTS := -O2
  endif
endif

# Call gcc with -O0 when compiling PreludeBasic as cc1 will
# consume an awfull lot of memory otherwise.
BUILDENV := PreludeBasic_hcflags="-optc-O0"

# Disable deprection warnings
BUILDOPTS += -fno-warn-deprecations

VERSION := $(strip $(shell grep "^HATVERSION" Makefile.inc | cut -f 2 -d = ))
MACHINE = $(shell script/harch)

GHC6_LIBDIR := $(shell ghc6 --print-libdir)

configure: configure-stamp
configure-stamp: patch-stamp
	dh_testdir
	sed -e "s%@VERSION@%$(VERSION)%g" \
	    debian/libghc6-hat-dev.postinst.in > \
	    debian/libghc6-hat-dev.postinst
	./configure --prefix=/usr --mandir=/usr/share/man/man1 \
	    --buildwith=ghc6 --buildopts="$(BUILDOPTS)" 
	touch configure-stamp


build: build-stamp
build-stamp: configure-stamp
	dh_testdir
	$(BUILDENV) $(MAKE)
	touch build-stamp

clean: clean-patched unpatch
clean-patched:
	dh_testdir
	dh_testroot
	rm -f configure-stamp build-stamp
	[ ! -f lib/$(MACHINE)/config ] || $(MAKE) clean
	rm -f script/black-hat script/hat-anim script/hat-check \
	    script/hat-cover script/hat-delta script/hat-detect \
	    script/hat-explore script/hat-graph script/hat-nonterm \
	    script/hat-observe script/hat-stack script/hat-trail \
	    script/hat-trans script/hat-view script/pretty-hat
	find src -name "*.hi" -exec rm {} \;
	rm -f src/hatlib/Hat.pkgconf src/hattools/for_foreign_imports.h
	rm -rf include/hat lib targets 
	rm -f debian/libghc6-hat-dev.postinst
	dh_clean

install: DH_OPTIONS=
install: build-stamp
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	DESTDIR=$(CURDIR)/debian/hat ./configure --install +lib +bin +man +incx -inc 
	DESTDIR=$(CURDIR)/debian/libghc6-hat-dev ./configure --install -lib -bin -man -incx +inc 
	for i in debian/hat/usr/bin/hat-*; \
	    do  mv "$$i" "$$i.old"; \
	        sed "s/^MACHINE=.*/MACHINE=$$(script/harch)/" < "$$i.old" \
	                                                      > "$$i"; \
	        chmod --reference="$$i.old" "$$i"; \
	        rm "$$i.old"; \
	    done
	rm -f  debian/hat/usr/bin/harch
	dh_install

# This single target is used to build all the packages, all at once, or
# one at a time. So keep in mind: any options passed to commands here will
# affect _all_ packages. Anything you want to only affect one package
# should be put in another target, such as the install target.
binary-common:
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_installexamples
	dh_installmenu
	dh_strip
	dh_link
	dh_compress
	dh_fixperms
	dh_installdeb
	sh -e debian/mk-haskell-depends
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Build architecture independant packages using the common target.
binary-indep: build-stamp
	 $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common

# Build architecture dependant packages using the common target.
binary-arch: install
	$(MAKE) -f debian/rules DH_OPTIONS=-s binary-common

# Any other binary targets build just one binary package at a time.
binary-%: build install
	make -f debian/rules binary-common DH_OPTIONS=-p$*

binary: binary-indep binary-arch
.PHONY: build clean clean-patched binary-indep binary-arch binary-common binary install configure