File: rules

package info (click to toggle)
avra 1.2.3a-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze, wheezy
  • size: 1,384 kB
  • ctags: 1,092
  • sloc: ansic: 6,329; asm: 747; pascal: 624; makefile: 82; sh: 5
file content (114 lines) | stat: -rwxr-xr-x 2,311 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
#!/usr/bin/make -f

DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

CFLAGS = -Wall -g

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif

DEST = $(CURDIR)/debian/avra

# These are replaced by autoreconf, preserve them
KEEP_FILES = configure \
	INSTALL \
	Makefile.in \
	Makefile

# These are generated by autoreconf and need to cleaned up
AUTORECONF_FILES = aclocal.m4 \
	depcomp \
	install-sh \
	missing

config.status: configure
	dh_testdir

	for i in $(KEEP_FILES) ; do \
		if ! [ -f $$i.dist ] ; then \
			cp $$i $$i.dist; \
		fi; \
	done

	autoreconf -isf
	CFLAGS="$(CFLAGS)" ./configure \
	       --host=$(DEB_HOST_GNU_TYPE) \
	       --build=$(DEB_BUILD_GNU_TYPE) \
	       --prefix=/usr

build: build-stamp
build-stamp: config.status
	dh_testdir

	$(MAKE)

	touch build-stamp

clean-distclean:
	dh_testdir
	dh_testroot

	# Work around upstream leaving a generated Makefile in the source
	# package. Only make distclean if we generated the Makefile ourselves.
	# This is quite a hack but works for now.
	if [ -f Makefile ] && [ -f Makefile.dist ] ; then \
		$(MAKE) distclean; \
	fi

	# explicitely remove build leftovers from upstream
	rm -rf avra .deps

	rm -f $(AUTORECONF_FILES)

clean: clean-distclean
	dh_testdir
	dh_testroot
	rm -f build-stamp

	for i in $(KEEP_FILES) ; do \
		if [ -f $$i.dist ] ; then \
			mv -f $$i.dist $$i; \
		fi; \
	done

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	$(MAKE) install DESTDIR=$(DEST)

binary-indep: build install
# We have nothing to do by default.

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs ChangeLog
	dh_installdocs README
	dh_installman debian/avra.1
	dh_installexamples
	# These are shipped 744 and lintian would complain about it, so chmod them
	find $(DEST)/usr/share/doc/avra/examples -type f | xargs chmod 644
	# Install the register and bit-name definitions shipped in AVR000.zip
	unzip AVR000.zip -d $(DEST)/usr/share/avra/
	dh_install
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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