File: rules

package info (click to toggle)
binutils-mingw-w64 2%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 72 kB
  • sloc: makefile: 66
file content (95 lines) | stat: -rwxr-xr-x 2,541 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
#!/usr/bin/make -f
# -*- makefile -*-
# Copyright © 2010 Stephen Kitt <steve@sk2.org>

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

top_dir := $(shell pwd)
binutils_dir := /usr/src/binutils
upstream_dir := $(top_dir)/upstream
build_dir := $(top_dir)/build
source_version := $(shell dpkg-query -W -f="\$${Version}\n" binutils-source)
deb_version := $(source_version)+$(shell dpkg-parsechangelog | sed -ne "s/^Version: \(.*\)/\1/p")
deb_upstream_version := $(shell echo $(deb_version) | cut -d- -f1)
gnu_upstream_version := $(shell echo $(deb_upstream_version) | cut -d. -f1-3)

targets := i686-w64-mingw32 x86_64-w64-mingw32

CFLAGS = $(shell dpkg-buildflags --get CFLAGS)
CFLAGS += -Wall

unpack: unpack-stamp
unpack-stamp:
	tar xf $(binutils_dir)/binutils-$(gnu_upstream_version).tar.*
	rm -rf $(upstream_dir)
	mv binutils-$(deb_upstream_version) $(upstream_dir)
	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -rf *-stamp $(build_dir) $(upstream_dir) $(patsubst %,debian/%-dllwrap.1,$(targets))
	dh_clean

configure-stamp: unpack-stamp
	dh_testdir
	for target in $(targets); do \
		dh_auto_configure -B$(build_dir)/$$target -D$(upstream_dir) -- \
				  --prefix=/usr --disable-multilib --enable-lto --enable-plugins --target=$$target; \
	done
	touch $@

build-arch-stamp: configure-stamp
	dh_testdir
	for target in $(targets); do \
		dh_auto_build --parallel -B$(build_dir)/$$target; \
	done
	touch $@

build-indep-stamp:
	touch $@

install-arch: install-arch-stamp
install-arch-stamp: build-arch-stamp
	dh_testdir
	dh_testroot
	dh_prep
	for target in $(targets); do \
		dh_auto_install -B$(build_dir)/$$target; \
	done

	# Drop files which will conflict with other packages
	rm -rf debian/tmp/usr/lib/*.a
	rm -rf debian/tmp/usr/share/info
	rm -rf debian/tmp/usr/share/locale

	# The following aren't necessary and don't comply with the FHS
	rm -rf $(patsubst %,debian/tmp/usr/%,$(targets))

	# Copy the dllwrap manpages
	for target in $(targets); do \
		cp debian/dllwrap.1 debian/$$target-dllwrap.1; \
	done

	touch $@

build: build-arch build-indep
build-arch: build-arch-stamp
build-indep: build-indep-stamp

binary-indep: build-indep
	dh $@

binary-arch: install-arch
	dh $@

override_dh_installchangelogs:
	dh_installchangelogs $(upstream_dir)/ChangeLog

override_dh_gencontrol:
	dh_gencontrol -- -v$(deb_version) -Vlocal:Version=$(deb_upstream_version) -Vbinutils:Version=$(source_version)

binary: binary-indep binary-arch

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