164c1ebdec88e9d71df06f3c3be776b9dd5db6a8
[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-help        := ctsim-help
14 pkg-doc         := ctsim-doc
15
16 ctsim-shared    := usr/share/ctsim
17
18 prefix          := debian/$(pkg)
19 prefix-help     := debian/$(pkg-help)
20 prefix-doc      := debian/$(pkg-doc)
21
22 DESTDIR         := `pwd`/$(prefix)
23 HELPDIR         := `pwd`/$(prefix-help)/$(ctsim-shared)
24 doc-dir         := usr/share/doc/$(pkg-doc)
25 pixmap-dir      := usr/share/pixmaps
26 desktop-dir     := usr/share/applications
27
28 configure: configure-stamp
29 configure-stamp:
30         dh_testdir
31         touch configure.in && touch aclocal.m4 && touch configure
32
33         ./configure --prefix=$(DESTDIR)/usr --mandir=$(DESTDIR)/usr/share/man --datadir=$(HELPDIR) --with-ctn -with-x --without-lam
34         touch configure-stamp
35
36
37 build-arch: configure-stamp build-arch-stamp
38 build-arch-stamp:
39         dh_testdir
40         # Add here commands to compile the package.
41         $(MAKE) all
42         touch build-arch-stamp
43
44 build-indep: configure-stamp  build-indep-stamp
45 build-indep-stamp:
46         dh_testdir
47         # Add here command to compile/build the arch indep package.
48         # It's ok not to do anything here, if you don't need to build
49         #  anything for this package.
50         #/usr/bin/docbook-to-man debian/#PACKAGE#.sgml > #PACKAGE#.1
51         (cd docs; tar xzf html.tar.gz)
52         touch build-indep-stamp
53
54 build: build-arch build-indep
55
56 clean:
57         dh_testdir
58         dh_testroot
59         rm -f build-arch-stamp build-indep-stamp configure-stamp
60         if [ -f Makefile ]; then $(MAKE) clean; fi
61         find . -type f -and -name \*~ -or -name .\*~ -exec rm -f {} \;
62         rm -f debian/ctsim.postinst.* debian/ctsim.prerm.*
63         # Ensure up-to-date versions of config.sub and config.guess
64         -test -r /usr/share/misc/config.sub && cp -f /usr/share/misc/config.sub config.sub
65         -test -r /usr/share/misc/config.guess && cp -f /usr/share/misc/config.guess config.guess
66         dh_clean
67
68 install: DH_OPTIONS=
69 install: build
70         dh_testdir
71         dh_testroot
72         dh_clean -k
73         dh_installdirs
74         #
75         dh_installdirs -p $(pkg-help) $(ctsim-shared)
76         ${MAKE} install
77         dh_installdirs -p $(pkg) $(pixmap-dir)
78         dh_installdirs -p $(pkg) $(desktop-dir)
79         dh_install -p $(pkg) debian/ctsim.xpm $(pixmap-dir)
80         dh_install -p $(pkg) debian/ctsim.desktop $(desktop-dir)
81         dh_install -p $(pkg-help) docs/ctsim.htb $(ctsim-shared)
82         dh_install -p $(pkg-doc) docs/html $(doc-dir)
83         dh_link -p $(pkg-doc) $(doc-dir)/html/$(pkg)_contents.html $(doc-dir)/html/index.html
84         gzip -9 docs/ctsim.pdf
85         dh_install -p $(pkg-doc) docs/ctsim.pdf.gz $(doc-dir)
86         gunzip docs/ctsim.pdf.gz
87         chmod +x helical/*.sh tools/*.sh
88
89 # Pass -i to all debhelper commands in this target to reduce clutter.
90 binary-indep: build install
91         dh_testdir -i
92         dh_testroot -i
93         dh_installdocs -i
94         dh_installexamples -i
95         dh_installmenu -i
96         dh_installcron -i
97         dh_installinfo -i
98         dh_installchangelogs ChangeLog -i
99         dh_link -i
100         dh_compress -i
101         dh_fixperms -i
102         dh_installdeb -i
103         dh_gencontrol -i
104         dh_md5sums -i
105         dh_builddeb -i
106
107 # Build architecture-dependent files here.
108 binary-arch: build install
109         dh_testdir -a
110         dh_testroot -a
111         dh_installdocs -a
112         dh_installexamples -p $(pkg) tools/sample-ctsim.sh helical/sample-helical.sh
113         dh_installchangelogs ChangeLog -a
114         dh_strip -a
115         dh_link -a
116         dh_compress -a
117         dh_fixperms -a
118         dh_installmenu -a
119         dh_installdeb -a
120         dh_gencontrol -a
121         dh_shlibdeps -a
122         dh_md5sums -a
123         dh_builddeb -a
124
125 binary: binary-indep binary-arch
126
127 .PHONY: build clean binary-indep binary-arch binary install configure