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