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