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