r3894: 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       := $(dpkg-architecture -qDEB_HOST_ARCH)
13
14 pkg             := ctsim
15 pkg-p4          := ctsim-pentium4
16 pkg-athlon      := ctsim-athlon
17 pkg-help        := ctsim-help
18 pkg-doc         := ctsim-doc
19
20 ctsim-shared    := usr/share/ctsim
21
22 prefix          := debian/$(pkg)
23 prefix-p4       := debian/$(pkg-p4)
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-ATHLON  := `pwd`/$(prefix-athlon)
31 HELPDIR         := `pwd`/$(prefix-help)/$(ctsim-shared)
32 doc-dir         := usr/share/doc/$(pkg-doc)
33 pixmap-dir      := usr/X11R6/include/X11/pixmaps
34
35
36 configure: configure-stamp
37 configure-stamp:
38         dh_testdir
39         # Add here commands to configure the package.
40         touch configure-stamp
41
42
43 build-arch: configure-stamp build-arch-stamp
44 build-arch-stamp:
45         dh_testdir
46         # Add here commands to compile the package.
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         ./configure --prefix=$(DESTDIR)/usr --mandir=$(DESTDIR)/usr/share/man --datadir=$(HELPDIR) --with-ctn
80         $(MAKE) all
81         ${MAKE} install
82 ifeq ($(host_arch),i386)
83         # Pentium 4
84         ${MAKE} clean
85         ./configure --prefix=$(DESTDIR-P4)/usr --mandir=$(DESTDIR-P4)/usr/share/man --datadir=$(HELPDIR) --with-ctn --with-mcpu=pentium4
86         $(MAKE) all
87         ${MAKE} install
88         # Athlon
89         ${MAKE} clean
90         ./configure --prefix=$(DESTDIR-ATHLON)/usr --mandir=$(DESTDIR-ATHLON)/usr/share/man --datadir=$(HELPDIR) --with-ctn --with-mcpu=athlon
91         $(MAKE) all
92         ${MAKE} install
93 endif
94         # Add here commands to install the package into debian/ctsim.
95         dh_installdirs -p $(pkg) $(pixmap-dir)
96         dh_installdirs -p $(pkg-p4) $(pixmap-dir)
97         dh_installdirs -p $(pkg-athlon) $(pixmap-dir)
98         dh_install -p $(pkg) debian/ctsim.xpm $(pixmap-dir)
99         dh_install -p $(pkg-p4) debian/ctsim.xpm $(pixmap-dir)
100         dh_install -p $(pkg-athlon) debian/ctsim.xpm $(pixmap-dir)
101         dh_install -p $(pkg-help) docs/ctsim.htb $(ctsim-shared)
102         dh_install -p $(pkg-doc) docs/html $(doc-dir)
103         dh_link -p $(pkg-doc) $(doc-dir)/html/$(pkg)_contents.html $(doc-dir)/html/index.html
104         gzip -9 docs/ctsim.pdf
105         dh_install -p $(pkg-doc) docs/ctsim.pdf.gz $(doc-dir)
106         gunzip docs/ctsim.pdf.gz
107         chmod +x helical/*.sh tools/*.sh
108
109 # Build architecture-independent files here.
110 # Pass -i to all debhelper commands in this target to reduce clutter.
111 binary-indep: build install
112         dh_testdir -i
113         dh_testroot -i
114 #       dh_installdebconf -i
115         dh_installdocs -i
116         dh_installexamples -i
117         dh_installmenu -i
118 #       dh_installlogrotate -i
119 #       dh_installemacsen -i
120 #       dh_installpam -i
121 #       dh_installmime -i
122 #       dh_installinit -i
123         dh_installcron -i
124 #       dh_installman -i
125         dh_installinfo -i
126 #       dh_undocumented -i
127         dh_installchangelogs ChangeLog -i
128         dh_link -i
129         dh_compress -i
130         dh_fixperms -i
131         dh_installdeb -i
132 #       dh_perl -i
133         dh_gencontrol -i
134         dh_md5sums -i
135         dh_builddeb -i
136
137 # Build architecture-dependent files here.
138 binary-arch: build install
139         dh_testdir -a
140         dh_testroot -a
141 #       dh_installdebconf -a
142         dh_installdocs -a
143         dh_installexamples -a tools/sample-ctsim.sh helical/sample-helical.sh
144         dh_installmenu -a
145 #       dh_installlogrotate -a
146 #       dh_installemacsen -a
147 #       dh_installpam -a
148 #       dh_installmime -a
149 #       dh_installinit -a
150         dh_installcron -a
151 #       dh_installman -a
152         dh_installinfo -a
153 #       dh_undocumented -a
154         dh_installchangelogs ChangeLog -a
155         dh_strip -a
156         dh_link -a
157         dh_compress -a
158         dh_fixperms -a
159 #       dh_makeshlibs -a
160         dh_installdeb -a
161 #       dh_perl -a
162         dh_shlibdeps -a
163         dh_gencontrol -a
164         dh_md5sums -a
165         dh_builddeb -a
166
167 binary: binary-indep binary-arch
168
169 .PHONY: build clean binary-indep binary-arch binary install configure
170