lose more stuff we don't actually need from the package
[debian/cc1111] / debian / rules
1 #!/usr/bin/make -f
2
3 include /usr/share/quilt/quilt.make
4 export DH_VERBOSE=1
5
6 # These are used for cross-compiling and for saving the configure script
7 # from having to guess our platform (since we know it already)
8 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
9 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
10
11 export HOME=$(CURDIR)/build
12
13 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
14         CFLAGS += -g -O0
15         export STRIP=true
16 endif
17 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
18         INSTALL_PROGRAM += -s
19 endif
20
21 clean: clean-patched unpatch
22 clean-patched:
23         dh_testdir
24         dh_testroot
25         # Clean up files that Makefile should have cleaned
26         rm -rf $(CURDIR)/build
27         rm -f support/cpp/configargs.h,.log
28         rm -f support/cpp/config.log
29         rm -f support/cpp/config.status
30         rm -f sim/ucsim/config.guess
31         rm -f sim/ucsim/config.sub
32         rm -f sim/ucsim/config.status
33         rm -f sim/ucsim/config.log
34         rm -f config.log
35         rm -f device/lib/small-stack-auto/Makefile
36         rm -f as/link/asxxxx_config.h
37         rm -f device/lib/large/*.asm
38         rm -f device/lib/medium/*.asm
39         rm -f device/lib/small/*.asm
40         rm -f device/lib/small-stack-auto/*.asm
41         rm -f support/cpp/configargs.h
42         find -type f -name '*.o' -exec rm -f {} \;
43         find -type f -name '.stamp' -exec rm -f {} \;
44         find . -name '*.rel' -exec rm -f {} \;
45         #find 'device/lib/{small*,large,medium}' -name *.asm -exec rm -f {} \;
46         find . -name '*.sym' -exec rm -f {} \;
47         find . -name '*.lst' -exec rm -f {} \;
48         # Clean up the Debian specific files
49         rm -f config.status doc/sdccman.ps
50         rm -f build-stamp configure-stamp install-arch-stamp install-indep-stamp install-stamp
51         rm -f as/link/lk_readnl.c       # Remove in next version
52         rm -f as/link/lk_readnl.h       # Remove in next version
53         [ ! -f Makefile ] || $(MAKE) distclean
54         dh_clean
55
56 configure: configure-stamp
57 configure-stamp: $(QUILT_STAMPFN)
58         dh_testdir
59         mkdir -p $(CURDIR)/build
60         cp /usr/share/misc/config.sub sim/ucsim/config.sub
61         cp /usr/share/misc/config.guess sim/ucsim/config.guess
62         cp debian/lk_readnl.h as/link/lk_readnl.h       # Remove in next version
63         cp debian/lk_readnl.c as/link/lk_readnl.c       # Remove in next version
64         ./configure \
65                 --host=$(DEB_HOST_GNU_TYPE) \
66                 --build=$(DEB_BUILD_GNU_TYPE) \
67                 --prefix=/usr \
68                 --disable-avr-port \
69                 --disable-ds390-port \
70                 --disable-ds400-port \
71                 --disable-gbz80-port \
72                 --disable-hc08-port \
73                 --enable-mcs51-port \
74                 --disable-pic-port \
75                 --disable-pic16-port \
76                 --disable-xa51-port \
77                 --disable-z80-port \
78                 --disable-z80-port 
79         touch $@
80
81 build: build-stamp
82 build-stamp:  configure-stamp
83         dh_testdir
84         $(MAKE)
85         cd doc && lyx -e ps sdccman.lyx
86         touch $@
87
88 install: install-stamp
89 install-stamp: build
90         dh_testdir
91         dh_testroot
92         dh_installdirs 
93         dh_prep
94         $(MAKE) install prefix=$(CURDIR)/debian/tmp/usr
95         mkdir -p debian/tmp/usr/share/doc/cc1111
96         install -o root -g root -m 644 doc/sdccman.ps debian/tmp/usr/share/doc/cc1111
97         mv debian/tmp/usr/share/doc/sdcc/* debian/tmp/usr/share/doc/cc1111/
98         # Add some scripts
99         mkdir -p debian/tmp/usr/share/sdcc/scripts
100         install -o root -g root -m 755  support/scripts/inc2h.pl       debian/tmp/usr/share/sdcc/scripts
101         install -o root -g root -m 755  support/scripts/keil2sdcc.pl   debian/tmp/usr/share/sdcc/scripts
102
103         #Remove extra license file
104         rm -f $(CURDIR)/debian/tmp/usr/share/sdcc/lib/src/pic16/COPYING
105         # Remove empty dirs:
106         find $(CURDIR)/debian/tmp -type d -empty -delete
107
108         #Clean up unnecessary directories
109         rm -rf `find $(CURDIR)/debian/tmp -type d -name .deps`
110
111         dh_install --sourcedir=debian/tmp
112
113
114         mkdir -p $(CURDIR)/debian/cc1111/usr/share/lintian/overrides/
115         install -p -o root -g root -m 644 $(CURDIR)/debian/cc1111.overrides \
116                 $(CURDIR)/debian/cc1111/usr/share/lintian/overrides/cc1111
117         # Install examples
118         cp -a device/examples $(CURDIR)/debian/cc1111/usr/share/doc/cc1111
119         rm -rf $(CURDIR)/debian/cc1111/usr/share/doc/cc1111/examples/ds400
120         rm -rf $(CURDIR)/debian/cc1111/usr/share/doc/cc1111/examples/ds390
121         rm -rf $(CURDIR)/debian/cc1111/usr/share/doc/cc1111/examples/xa51
122         # clean up things cc1111 doesn't need
123         rm -rf $(CURDIR)/debian/cc1111/usr/share/sdcc/lib/src/pic
124         rm -rf $(CURDIR)/debian/cc1111/usr/share/sdcc/lib/src/pic16
125         rm -rf $(CURDIR)/debian/cc1111/usr/share/sdcc/lib/src/ds400
126         rm -rf $(CURDIR)/debian/cc1111/usr/share/sdcc/lib/src/hc08
127         rm -rf $(CURDIR)/debian/cc1111/usr/share/sdcc/lib/src/z80
128         rm -rf $(CURDIR)/debian/cc1111/usr/share/sdcc/lib/src/ds390
129         rm -rf $(CURDIR)/debian/cc1111/usr/share/sdcc/lib/src/gbz80
130         touch $@
131
132 # Must not depend on anything. This is to be called by binary-arch/binary-indep
133 # in another 'make' thread.
134 binary-common:
135         dh_testdir
136         dh_testroot
137         dh_installchangelogs ChangeLog
138         dh_installdocs
139         dh_installman
140         dh_installemacsen
141         dh_link
142         dh_strip -Xusr/share/sdcc/lib/
143         dh_compress 
144         dh_fixperms
145         dh_installdeb
146         dh_shlibdeps
147         dh_gencontrol
148         dh_md5sums
149         dh_builddeb
150
151 # Build architecture-independent files here.
152 binary-indep: install
153         $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
154
155 # Build architecture-dependent files here.
156 binary-arch: install
157         $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
158
159 binary: binary-arch binary-indep
160 .PHONY: build clean binary-indep binary-arch binary install install-arch install-indep