r5231: Auto commit for Debian build
[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-p3          := ctsim-pentium3
15 pkg-athlon      := ctsim-athlon
16 pkg-help        := ctsim-help
17 pkg-doc         := ctsim-doc
18
19 ctsim-shared    := usr/share/ctsim
20
21 prefix          := debian/$(pkg)
22 prefix-p4       := debian/$(pkg-p4)
23 prefix-p3       := debian/$(pkg-p3)
24 prefix-athlon   := debian/$(pkg-athlon)
25 prefix-help     := debian/$(pkg-help)
26 prefix-doc      := debian/$(pkg-doc)
27
28 DESTDIR         := `pwd`/$(prefix)
29 DESTDIR-P4      := `pwd`/$(prefix-p4)
30 DESTDIR-P3      := `pwd`/$(prefix-p3)
31 DESTDIR-ATHLON  := `pwd`/$(prefix-athlon)
32 HELPDIR         := `pwd`/$(prefix-help)/$(ctsim-shared)
33 doc-dir         := usr/share/doc/$(pkg-doc)
34 pixmap-dir      := usr/X11R6/include/X11/pixmaps
35
36
37 configure: configure-stamp
38 configure-stamp:
39         dh_testdir
40         # Add here commands to configure the package.
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         dh_clean
73
74 install: DH_OPTIONS=
75 install: build
76         dh_testdir
77         dh_testroot
78         dh_clean -k
79         dh_installdirs
80         #
81         dh_installdirs -p $(pkg-help) $(ctsim-shared)
82         ${MAKE} install
83         # Testing for i386 optimized builds
84         echo Host architecture is $(host_arch)
85 ifneq (,$(findstring i386,$(host_arch)))
86         # Building CPU-specific i386 flavors
87         # Pentium 3
88         ${MAKE} clean
89         ./configure --prefix=$(DESTDIR-P3)/usr --mandir=$(DESTDIR-P3)/usr/share/man --datadir=$(HELPDIR) --with-ctn --with-mcpu=pentium3
90         $(MAKE) all
91         ${MAKE} install
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-p3) $(pixmap-dir)
103         dh_installdirs -p $(pkg-p4) $(pixmap-dir)
104         dh_installdirs -p $(pkg-athlon) $(pixmap-dir)
105         dh_install -p $(pkg-p3) debian/ctsim.xpm $(pixmap-dir)
106         dh_install -p $(pkg-p4) debian/ctsim.xpm $(pixmap-dir)
107         dh_install -p $(pkg-athlon) debian/ctsim.xpm $(pixmap-dir)
108 endif
109         # Add here commands to install the package into debian/ctsim.
110         dh_installdirs -p $(pkg) $(pixmap-dir)
111         dh_install -p $(pkg) debian/ctsim.xpm $(pixmap-dir)
112         dh_install -p $(pkg-help) docs/ctsim.htb $(ctsim-shared)
113         dh_install -p $(pkg-doc) docs/html $(doc-dir)
114         dh_link -p $(pkg-doc) $(doc-dir)/html/$(pkg)_contents.html $(doc-dir)/html/index.html
115         gzip -9 docs/ctsim.pdf
116         dh_install -p $(pkg-doc) docs/ctsim.pdf.gz $(doc-dir)
117         gunzip docs/ctsim.pdf.gz
118         chmod +x helical/*.sh tools/*.sh
119
120 # Build architecture-independent files here.
121 # Pass -i to all debhelper commands in this target to reduce clutter.
122 binary-indep: build install
123         dh_testdir -i
124         dh_testroot -i
125 #       dh_installdebconf -i
126         dh_installdocs -i
127         dh_installexamples -i
128         dh_installmenu -i
129 #       dh_installlogrotate -i
130 #       dh_installemacsen -i
131 #       dh_installpam -i
132 #       dh_installmime -i
133 #       dh_installinit -i
134         dh_installcron -i
135 #       dh_installman -i
136         dh_installinfo -i
137 #       dh_undocumented -i
138         dh_installchangelogs ChangeLog -i
139         dh_link -i
140         dh_compress -i
141         dh_fixperms -i
142         dh_installdeb -i
143 #       dh_perl -i
144         dh_gencontrol -i
145         dh_md5sums -i
146         dh_builddeb -i
147
148 # Build architecture-dependent files here.
149 binary-arch: build install
150         dh_testdir -a
151         dh_testroot -a
152 #       dh_installdebconf -a
153         dh_installdocs -a
154         dh_installexamples -p $(pkg) tools/sample-ctsim.sh helical/sample-helical.sh
155 ifneq (,$(findstring i386,$(host_arch)))
156         dh_installexamples -p $(pkg-p3) tools/sample-ctsim.sh helical/sample-helical.sh
157         dh_installexamples -p $(pkg-p4) tools/sample-ctsim.sh helical/sample-helical.sh
158         dh_installexamples -p $(pkg-athlon) tools/sample-ctsim.sh helical/sample-helical.sh
159 endif
160 #       dh_installlogrotate -a
161 #       dh_installemacsen -a
162 #       dh_installpam -a
163 #       dh_installmime -a
164 #       dh_installinit -a
165 #       dh_installcron -a
166 #       dh_installman -a
167 #       dh_installinfo -a
168 #       dh_undocumented -a
169 #       dh_makeshlibs -a
170 #       dh_perl -a
171 ifeq (,$(findstring i386,$(host_arch)))
172         dh_installchangelogs -p $(pkg)ChangeLog 
173         dh_strip -p $(pkg)
174         dh_link -p $(pkg)
175         dh_compress -p $(pkg)
176         dh_fixperms -p $(pkg)
177         dh_installmenu -p $(pkg)
178         dh_installdeb -p $(pkg)
179         dh_gencontrol -p $(pkg)
180         dh_shlibdeps -p $(pkg)
181         dh_md5sums -p $(pkg)
182         dh_builddeb -p $(pkg)
183 else
184         dh_installchangelogs ChangeLog -a
185         dh_strip -a
186         dh_link -a
187         dh_compress -a
188         dh_fixperms -a
189         dh_installmenu -a
190         dh_installdeb -a
191         dh_gencontrol -a
192         dh_shlibdeps -a
193         dh_md5sums -a
194         dh_builddeb -a
195 endif
196
197 binary: binary-indep binary-arch
198
199 .PHONY: build clean binary-indep binary-arch binary install configure
200