File: rules

package info (click to toggle)
sdcc 3.8.0+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 99,208 kB
  • sloc: ansic: 918,594; cpp: 69,526; makefile: 56,790; sh: 29,616; asm: 12,364; perl: 12,136; yacc: 7,179; lisp: 1,672; python: 812; lex: 773; awk: 495; sed: 89
file content (189 lines) | stat: -rwxr-xr-x 6,001 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

export DH_VERBOSE=1

export DEB_BUILD_MAINT_OPTIONS := hardening=+pie,+bindnow
export CPPFLAGS=$(shell dpkg-buildflags --get CPPFLAGS)
export CFLAGS=$(shell dpkg-buildflags --get CFLAGS)
export CXXFLAGS=$(shell dpkg-buildflags --get CXXFLAGS)
export LDFLAGS=$(shell dpkg-buildflags --get LDFLAGS)

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

ifneq (,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
	NJOBS := -j $(subst parallel=,,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
endif

export HOME=$(CURDIR)/build

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -g -O0
	export STRIP=true
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
endif

clean:
	dh_testdir
	dh_testroot
	[ ! -f Makefile ] || $(MAKE) distclean
	rm -rf $(CURDIR)/build
	rm -f support/sdbinutils/binutils/arlex.c
	rm -f support/sdbinutils/binutils/arparse.c
	rm -f support/sdbinutils/binutils/arparse.h
	rm -f confdefs.h
	rm -f install-arch install-indep
	rm -f doc/sdcc_version
	rm -f sim/ucsim/cmd.src/cmdlex.cc
	rm -f device/lib/stm8-large/Makefile
	rm -f device/lib/stm8-large/*.asm
	rm -f device/lib/stm8-large/*.lst
	rm -f device/lib/stm8-large/*.rel
	rm -f device/lib/stm8-large/*.sym
	rm -f support/sdbinutils/binutils/mcparse.[c,h]
	rm -f support/sdbinutils/binutils/rcparse.[c,h]
	rm -f support/sdbinutils/binutils/sysinfo.[c,h]
	rm -f support/sdbinutils/binutils/syslex.[c,h]
	rm -f support/sdbinutils/binutils/defparse.[c,h]
	rm -f sim/ucsim/config.log
	rm -f sim/ucsim/lex.yy.c
	rm -f support/sdbinutils/bfd/doc/bfd.info
	rm -f support/sdbinutils/bfd/doc/bfdver.texi
	find . -type f -name 'Makefile' -exec rm -vf {} \;
	find . -type f -name 'config.log' -exec rm -vf {} \;
	dh_clean

configure: configure-stamp
configure-stamp:
	dh_testdir
	mkdir -p $(CURDIR)/build
	chmod a-x device/lib/*.c
	dh_update_autotools_config
	CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" \
	./configure \
		--host=$(DEB_HOST_GNU_TYPE) \
		--build=$(DEB_BUILD_GNU_TYPE) \
		--disable-non-free \
		--disable-pic14-port \
		--disable-pic16-port \
		--prefix=/usr
	touch $@

build: build-arch build-indep
build-arch: build-arch-stamp
build-arch-stamp: configure-stamp 
	dh_testdir
	$(MAKE) $(NJOBS)
	touch $@

build-indep: build-indep-stamp
build-indep-stamp: configure-stamp
	dh_testdir
	cd doc && make
	touch $@

install: install-arch install-indep
install-indep: build
	dh_testdir
	dh_testroot
	dh_installdirs 
	dh_prep
	$(MAKE) install prefix=$(CURDIR)/debian/tmp/usr
	mkdir -p debian/tmp/usr/share/doc/sdcc-doc
	install -o root -g root -m 644 doc/sdccman.pdf debian/tmp/usr/share/doc/sdcc-doc
	mv debian/tmp/usr/share/doc/sdcc/* debian/tmp/usr/share/doc/sdcc-doc/
	rm -f debian/tmp/usr/share/doc/sdcc-doc/z80/combined_i186_z80_design.tex
	rm -f debian/tmp/usr/share/doc/sdcc-doc/z80/Makefile
	#Remove extra license file
	rm -f $(CURDIR)/debian/tmp/usr/share/sdcc/lib/src/pic16/COPYING
	# Remove empty dirs:
	find $(CURDIR)/debian/tmp -type d -empty -delete

	#Clean up unnecessary directories
	rm -rf `find $(CURDIR)/debian/tmp -type d -name .deps`

	dh_install -i --sourcedir=debian/tmp --list-missing

	# Install examples
	#cp -a device/examples $(CURDIR)/debian/sdcc-doc/usr/share/doc/sdcc-doc
	rm -f $(CURDIR)/debian/sdcc-doc/usr/share/doc/sdcc-doc/examples/mcs51/simple*/go*
	rm -f debian/sdcc-libraries/usr/share/sdcc/lib/src/pic14/GPL
	rm -f debian/sdcc-libraries/usr/share/sdcc/lib/src/pic14/LGPL

	touch $@

install-arch: build-arch
	dh_testdir
	dh_testroot
	dh_installdirs 
	dh_prep
	$(MAKE) install prefix=$(CURDIR)/debian/tmp/usr
	rm -f $(CURDIR)/debian/tmp/usr/bin/sdld6808
	cd $(CURDIR)/debian/tmp/usr/bin/ && ln -s sdld sdld6808
	rm -f $(CURDIR)/debian/tmp/usr/bin/sdldz80
	cd $(CURDIR)/debian/tmp/usr/bin/ && ln -s sdld sdldz80
	rm -f $(CURDIR)/debian/tmp/usr/bin/sdldgb
	cd $(CURDIR)/debian/tmp/usr/bin/ && ln -s sdld sdldgb

	# Remove empty dirs:
	find $(CURDIR)/debian/tmp -type d -empty -delete

	#Clean up unnecessary directories
	rm -rf `find $(CURDIR)/debian/tmp -type d -name .deps`
	# Add some scripts
	mkdir -p debian/tmp/usr/share/sdcc/scripts
	install -o root -g root -m 755  support/scripts/*.pl debian/tmp/usr/share/sdcc/scripts
	install -o root -g root -m 755  support/scripts/*.py debian/tmp/usr/share/sdcc/scripts
	# Remove an unnecessary script 
	rm -f debian/tmp/usr/share/sdcc/scripts/gen_known_bugs.pl
	dh_install -a --sourcedir=debian/tmp --list-missing

	touch $@

# Must not depend on anything. This is to be called by binary-arch/binary-indep
# in another 'make' thread.
binary-common:
	dh_testdir
	dh_testroot
	dh_installchangelogs ChangeLog
	dh_installdocs
	dh_installman
	#dh_installexamples -psdcc-doc device/examples/* -X\.bat  
	dh_installemacsen
	dh_link
	dh_lintian
	dh_strip -Xusr/share/sdcc/lib/
	dh_compress --exclude=.c --exclude=.h --exclude=.cpp
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Build architecture-independent files here.
binary-indep: install-indep
	$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common

# Build architecture-dependent files here.
binary-arch: install-arch
	$(MAKE) -f debian/rules DH_OPTIONS=-s binary-common

get-orig-source:
	set -e;\
	VER=$(DEB_VERSION_UPSTREAM);\
	uscan --force-download --rename --download-version=$$VER --destdir=. && (\
	tar -xj --exclude device/non-free --exclude sim/ucsim/libltdl -f sdcc_$$VER.orig.tar.bz2 ; \
	mv sdcc-$$VER sdcc-$$VER+dfsg;\
	tar -caf sdcc_$$VER+dfsg.orig.tar.xz sdcc-$$VER+dfsg; \
	rm -rf sdcc-$$VER+dfsg ;\
	rm -f sdcc_$$VER.orig.tar.bz2);

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