File: rules

package info (click to toggle)
binutils-avr 2.26.20160125%2BAtmel3.5.3-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 42,896 kB
  • ctags: 23
  • sloc: makefile: 150; sh: 7
file content (169 lines) | stat: -rwxr-xr-x 4,667 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
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

PACKAGE=binutils-avr
TARGET=avr

#ifeq (,$(DEB_BUILD_GNU_TYPE))
#  include /usr/share/dbs/dpkg-arch.mk
#endif

CONFARGS = --prefix=/usr \
           --build=$(DEB_BUILD_GNU_TYPE) \
           --host=$(DEB_HOST_GNU_TYPE) \
           --target=$(TARGET) \
           --with-gnu-ld \
           --with-gnu-as \
		   --with-system-zlib \
           --enable-install-libbfd \
           --with-dwarf2 \
           --disable-static \
           --disable-gdb --disable-libdecnumber --disable-readline \
           --disable-sim \
           $(shell dpkg-buildflags --export=configure) 


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

#TAR_DIR=binutils-*
#TAR_DIR=TAR_DIR=binutils-*
#include /usr/share/dbs/dbs-build.mk
#include debian/dbs-build.mk

BUILD_TREE=src

# the dbs rules
#include /usr/src/toolchain/patches/binutils/dbs-build.mk
#
unpack: unpack-stamp
unpack-stamp:
	tar xjf avr-binutils-*.tar.bz2
	mv `ls -d binutils* | grep -v tar` src
	#mkdir build
	touch unpack-stamp

patch-stamp: unpack-stamp
	cd $(BUILD_TREE) && for p in `cat ../debian/patchlist`; do echo; echo Applying $$p ...; patch -p1 < ../debian/$$p; done
	touch patch-stamp

configure: configure-stamp
configure-stamp: unpack-stamp patch-stamp
	dh_testdir

	# Add here commands to configure the package.
	#cd $(BUILD_TREE)/ld && aclocal-1.9 && automake-1.9 
	#cd $(BUILD_TREE) && env CC="gcc" CFLAGS="-Wno-error=unused-but-set-variable -Wno-error=unused-but-set-parameter" ./configure $(CONFARGS)
	cd $(BUILD_TREE) && ./configure $(CONFARGS)
	make -C src maybe-configure-bfd
	make -C src/bfd/ headers
	touch configure-stamp

build: configure-stamp build-stamp
build-stamp:
	dh_testdir

	# Add here commands to compile the package.
	cd $(BUILD_TREE) && $(MAKE)
	#/usr/bin/docbook-to-man debian/$(PACKAGE).sgml > $(PACKAGE).1

	touch build-stamp

build-arch: build
build-indep: build	

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp a.out unpack-stamp patch-stamp

	# Add here commands to clean up after the build process.
	#-$(MAKE) clean
	rm -rf $(BUILD_TREE) 
	#rm binutils-2.18.tar.bz2 

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# Add here commands to install the package into debian/$(PACKAGE).
	cd $(BUILD_TREE) && $(MAKE) install prefix=$(CURDIR)/debian/$(PACKAGE)/usr
	#cp debian/gasp.1 debian/$(PACKAGE)/usr/share/man/man1/avr-gasp.1

	# Non standard avr dir to keep FHS happy
	mv debian/binutils-avr/usr/avr debian/binutils-avr/usr/lib/

	# Convert hardlinks to softlinks
	cd debian/binutils-avr/usr/lib/avr/bin && for f in *; do \
	    rm ../../../bin/avr-$$f; \
	    ln -s ../lib/avr/bin/$$f ../../../bin/avr-$$f; \
	done

	# Emptying the dependency_libs field of .la files
	sed -i "/dependency_libs/ s/'.*'/''/" `find debian/binutils-avr -name '*.la'`

	# Adjust paths
	sed -i 's/\/usr\/x86_64-linux-gnu\/avr/\/usr\/lib\/avr\/x86_64-linux-gnu/' `find debian/binutils-avr -name '*.la'`

	ln -s avr-ld.1.gz debian/binutils-avr/usr/share/man/man1/avr-ld.bfd.1.gz

	# Files also in main binutils pkg
	cd debian/$(PACKAGE)/usr && \
	rm -rf lib/libiberty.* lib/libbfd.* lib/libopcodes* \
	include/bfd.h include/ansidecl.h include/bfdlink.h \
	share/locale include/symcat.h include/dis-asm.h \
	info share/info share/man/man1/avr-c++filt.1.gz

	mv debian/binutils-avr/usr/$(DEB_HOST_GNU_TYPE)/avr \
	   debian/binutils-avr/usr/lib/avr/$(DEB_HOST_GNU_TYPE)
	rm -r debian/binutils-avr/usr/$(DEB_HOST_GNU_TYPE)

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
#	dh_installdebconf	
	dh_installdocs -n
#	dh_installexamples
#	dh_installmenu
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_installinit
#	dh_installcron
	dh_installman
#	dh_installinfo
	dh_installchangelogs 
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
#	dh_makeshlibs
	dh_installdeb
#	dh_perl
	dh_shlibdeps

	# Update toolchain-source version reference (won't work as it's a source dependency)
	#touch debian/substvars
	#-grep -v '^toolchain-source-version=' debian/substvars > debian/substvars.tmp
	#mv debian/substvars.tmp debian/substvars
	#echo >> debian/substvars
	#echo -n 'toolchain-source-version=' >> debian/substvars
	#dpkg -s toolchain-source | grep Version: | sed -e 's/Version: //' >> debian/substvars

	dh_gencontrol
	dh_md5sums
	dh_builddeb

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