File: rules

package info (click to toggle)
mingw32-binutils 2.20-0.2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 22,788 kB
  • sloc: makefile: 96
file content (145 lines) | stat: -rwxr-xr-x 3,551 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
#!/usr/bin/make -f
#
# debian/rules file to build a Mingw32 cross compiler toolchain.
#
# Created 30 Jan 2001, by Ron Lee <ron@debian.org>

#export DH_VERBOSE=1

package = mingw32-binutils
package64 = mingw64-binutils
target  = i586-mingw32msvc
target64 = amd64-mingw32msvc

top_dir      := $(shell pwd)
upstream_dir := $(top_dir)/upstream
build_dir    := $(top_dir)/build_dir
build_src    := $(build_dir)/src
build_objs   := $(build_dir)/objs
build_objs64 := $(build_dir)/objs64

PACKAGE_BASENAME = $(patsubst %-src.tar,%,$(basename $(notdir $(wildcard $(upstream_dir)/$(1)*))))

binutils := $(call PACKAGE_BASENAME,binutils)

ifneq ($(words $(binutils)),1)
  $(error binutils defined as '$(binutils)')
endif


build : build-stamp build64-stamp

# XXX Work around another gratuitous change in the source dir name.
#     They did so well for so long, *sigh*.
#     Temporary hack here until we know how permanent this one may be
#configure-stamp: binutils_dir := $(binutils)-src
#
# Not so permanent I guess, we have yet another arbitrary change to the
# internal structure again ...  this time we fix the tarball, and we'll
# wait to see what happens again next time.
configure-stamp: unpack-stamp
	mkdir -p $(build_objs)
	cd $(build_objs)					\
		&& $(build_src)/$(binutils)/configure -v	\
					--disable-werror	\
					--prefix=/usr		\
					--target=$(target)
	touch $@

configure64-stamp: unpack-stamp
	mkdir -p $(build_objs64)
	cd $(build_objs64)					\
		&& $(build_src)/$(binutils)/configure -v	\
					--disable-werror	\
					--prefix=/usr		\
					--target=$(target64)
	touch $@

build-stamp : configure-stamp
	dh_testdir
	cd $(build_objs) && $(MAKE)

	touch $@

build64-stamp : configure64-stamp
	dh_testdir
	cd $(build_objs64) && $(MAKE)

	touch $@

install : install-stamp

install-stamp : build-stamp build64-stamp
	dh_testdir
	dh_testroot
	dh_clean -k

	dh_installdirs usr/share/lintian/overrides
	cd $(build_objs)								\
		&& $(MAKE) install prefix=$(top_dir)/debian/$(package)/usr		\
				   mandir=$(top_dir)/debian/$(package)/usr/share/man
	cd $(build_objs64)								\
		&& $(MAKE) install prefix=$(top_dir)/debian/$(package)/usr		\
				   mandir=$(top_dir)/debian/$(package)/usr/share/man

	# remove some non-cross stuff that will clash with other packages
	rm -rf debian/$(package)/usr/info
	rm -rf debian/$(package)/usr/share/info
	rm -rf debian/$(package)/usr/lib
	rm -rf debian/$(package)/usr/share/locale

	# install override for the non fhs target dir gcc wants to use
	# (until we find a better solution or change policy)
	cp debian/lintian-overrides debian/$(package)/usr/share/lintian/overrides/$(package)

	touch $@


unpack-stamp:
	dh_testdir
	mkdir -p $(build_src)

	# unpack upstream tarballs
	@cd $(build_src) \
		&& for f in $(binutils) ; do					\
			echo "unpacking $$f";					\
			if [ -r $(upstream_dir)/$$f-src.tar.gz ]; then	\
				tar zxf $(upstream_dir)/$$f-src.tar.gz;	\
			elif [ -r $(upstream_dir)/$$f-src.tar.bz2 ]; then	\
				tar jxf $(upstream_dir)/$$f-src.tar.bz2;	\
			else							\
				echo " *** Error: Failed to unpack $$f";	\
				exit 1;						\
			fi;							\
		   done;

	touch $@


clean:
	dh_testdir
	dh_testroot
	rm -rf $(build_dir) *-stamp
	dh_clean


binary-indep:
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installman debian/$(target)-dllwrap.1
	dh_installchangelogs
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch

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