r10517: Automated commit for Debian build of ctsim upstream-version-4.3.2
[ctsim.git] / debian / rules
1 #!/usr/bin/make -f
2
3 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
4         CFLAGS += -g
5 endif
6 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
7         INSTALL_PROGRAM += -s
8 endif
9
10 host_arch       := $(shell dpkg-architecture -qDEB_HOST_ARCH)
11
12 pkg             := ctsim
13 pkg-p4          := ctsim-pentium4
14 pkg-athlon      := ctsim-athlon
15 pkg-help        := ctsim-help
16 pkg-doc         := ctsim-doc
17
18 ctsim-shared    := usr/share/ctsim
19
20 prefix          := debian/$(pkg)
21 prefix-p4       := debian/$(pkg-p4)
22 prefix-athlon   := debian/$(pkg-athlon)
23 prefix-help     := debian/$(pkg-help)
24 prefix-doc      := debian/$(pkg-doc)
25
26 DESTDIR         := `pwd`/$(prefix)
27 DESTDIR-P4      := `pwd`/$(prefix-p4)
28 DESTDIR-ATHLON  := `pwd`/$(prefix-athlon)
29 HELPDIR         := `pwd`/$(prefix-help)/$(ctsim-shared)
30 doc-dir         := usr/share/doc/$(pkg-doc)
31 pixmap-dir      := usr/share/pixmaps
32
33
34 configure: configure-stamp
35 configure-stamp:
36         dh_testdir
37         touch configure.in && \
38         touch aclocal.m4 && \
39         touch configure
40
41         ./configure --prefix=$(DESTDIR)/usr --mandir=$(DESTDIR)/usr/share/man --datadir=$(HELPDIR) --with-ctn
42         touch configure-stamp
43
44
45 build-arch: configure-stamp build-arch-stamp
46 build-arch-stamp:
47         dh_testdir
48         # Add here commands to compile the package.
49         $(MAKE) all
50         touch build-arch-stamp
51
52 build-indep: configure-stamp  build-indep-stamp
53 build-indep-stamp:
54         dh_testdir
55         # Add here command to compile/build the arch indep package.
56         # It's ok not to do anything here, if you don't need to build
57         #  anything for this package.
58         #/usr/bin/docbook-to-man debian/#PACKAGE#.sgml > #PACKAGE#.1
59         (cd docs; tar xzf html.tar.gz)
60         touch build-indep-stamp
61
62 build: build-arch build-indep
63
64 clean:
65         dh_testdir
66         dh_testroot
67         rm -f build-arch-stamp build-indep-stamp configure-stamp
68         # Add here commands to clean up after the build process.
69         -$(MAKE) distclean
70         find . -type f -and -name \*~ -or -name .\*~ -exec rm -f {} \;
71         rm -f debian/ctsim.postinst.* debian/ctsim.prerm.*
72         # Ensure up-to-date versions of config.sub and config.guess
73         -test -r /usr/share/misc/config.sub && \
74            cp -f /usr/share/misc/config.sub config.sub
75         -test -r /usr/share/misc/config.guess && \
76            cp -f /usr/share/misc/config.guess config.guess
77         dh_clean
78
79 install: DH_OPTIONS=
80 install: build
81         dh_testdir
82         dh_testroot
83         dh_clean -k
84         dh_installdirs
85         #
86         dh_installdirs -p $(pkg-help) $(ctsim-shared)
87         ${MAKE} install
88         # Testing for i386 optimized builds
89         echo Host architecture is $(host_arch)
90 ifneq (,$(findstring i386,$(host_arch)))
91         # Building CPU-specific i386 flavors
92         # Pentium 4
93         ${MAKE} clean
94         ./configure --prefix=$(DESTDIR-P4)/usr --mandir=$(DESTDIR-P4)/usr/share/man --datadir=$(HELPDIR) --with-ctn --with-mcpu=pentium4
95         $(MAKE) all
96         ${MAKE} install
97         # Athlon
98         ${MAKE} clean
99         ./configure --prefix=$(DESTDIR-ATHLON)/usr --mandir=$(DESTDIR-ATHLON)/usr/share/man --datadir=$(HELPDIR) --with-ctn --with-mcpu=athlon
100         $(MAKE) all
101         ${MAKE} install
102         dh_installdirs -p $(pkg-p4) $(pixmap-dir)
103         dh_installdirs -p $(pkg-athlon) $(pixmap-dir)
104         dh_install -p $(pkg-p4) debian/ctsim.xpm $(pixmap-dir)
105         dh_install -p $(pkg-athlon) debian/ctsim.xpm $(pixmap-dir)
106 endif
107         # Add here commands to install the package into debian/ctsim.
108         dh_installdirs -p $(pkg) $(pixmap-dir)
109         dh_install -p $(pkg) debian/ctsim.xpm $(pixmap-dir)
110         dh_install -p $(pkg-help) docs/ctsim.htb $(ctsim-shared)
111         dh_install -p $(pkg-doc) docs/html $(doc-dir)
112         dh_link -p $(pkg-doc) $(doc-dir)/html/$(pkg)_contents.html $(doc-dir)/html/index.html
113         gzip -9 docs/ctsim.pdf
114         dh_install -p $(pkg-doc) docs/ctsim.pdf.gz $(doc-dir)
115         gunzip docs/ctsim.pdf.gz
116         chmod +x helical/*.sh tools/*.sh
117
118 # Build architecture-independent files here.
119 # Pass -i to all debhelper commands in this target to reduce clutter.
120 binary-indep: build install
121         dh_testdir -i
122         dh_testroot -i
123 #       dh_installdebconf -i
124         dh_installdocs -i
125         dh_installexamples -i
126         dh_installmenu -i
127 #       dh_installlogrotate -i
128 #       dh_installemacsen -i
129 #       dh_installpam -i
130 #       dh_installmime -i
131 #       dh_installinit -i
132         dh_installcron -i
133 #       dh_installman -i
134         dh_installinfo -i
135 #       dh_undocumented -i
136         dh_installchangelogs ChangeLog -i
137         dh_link -i
138         dh_compress -i
139         dh_fixperms -i
140         dh_installdeb -i
141 #       dh_perl -i
142         dh_gencontrol -i
143         dh_md5sums -i
144         dh_builddeb -i
145
146 # Build architecture-dependent files here.
147 binary-arch: build install
148         dh_testdir -a
149         dh_testroot -a
150 #       dh_installdebconf -a
151         dh_installdocs -a
152         dh_installexamples -p $(pkg) tools/sample-ctsim.sh helical/sample-helical.sh
153 ifneq (,$(findstring i386,$(host_arch)))
154         dh_installexamples -p $(pkg-p4) tools/sample-ctsim.sh helical/sample-helical.sh
155         dh_installexamples -p $(pkg-athlon) tools/sample-ctsim.sh helical/sample-helical.sh
156 endif
157 #       dh_installlogrotate -a
158 #       dh_installemacsen -a
159 #       dh_installpam -a
160 #       dh_installmime -a
161 #       dh_installinit -a
162 #       dh_installcron -a
163 #       dh_installman -a
164 #       dh_installinfo -a
165 #       dh_undocumented -a
166 #       dh_makeshlibs -a
167 #       dh_perl -a
168 ifeq (,$(findstring i386,$(host_arch)))
169         dh_installchangelogs -p $(pkg)ChangeLog 
170         dh_strip -p $(pkg)
171         dh_link -p $(pkg)
172         dh_compress -p $(pkg)
173         dh_fixperms -p $(pkg)
174         dh_installmenu -p $(pkg)
175         dh_installdeb -p $(pkg)
176         dh_gencontrol -p $(pkg)
177         dh_shlibdeps -p $(pkg)
178         dh_md5sums -p $(pkg)
179         dh_builddeb -p $(pkg)
180 else
181         dh_installchangelogs ChangeLog -a
182         dh_strip -a
183         dh_link -a
184         dh_compress -a
185         dh_fixperms -a
186         dh_installmenu -a
187         dh_installdeb -a
188         dh_gencontrol -a
189         dh_shlibdeps -a
190         dh_md5sums -a
191         dh_builddeb -a
192 endif
193
194 binary: binary-indep binary-arch
195
196 .PHONY: build clean binary-indep binary-arch binary install configure
197