chiark / gitweb /
Makefiles: Refer to $(BASE_DIR) rather than ../base/
[chiark-tcl.git] / debian / rules
1 #!/usr/bin/make -f
2
3 # chiark-tcl - various Tcl bindings and extensions
4 # Copyright 2006-2012 Ian Jackson
5 #
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License as
8 # published by the Free Software Foundation; either version 2 of the
9 # License, or (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 # General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this library; if not, see <http://www.gnu.org/licenses/>.
18
19
20 majversion=1
21 srcpackage=chiark-tcl
22 libpackage=libtcl-chiark-$(majversion)
23 docpackage=libtcl-chiark-$(majversion)
24 docdir=usr/share/doc/$(docpackage)
25
26 tclh:=$(firstword $(wildcard /usr/include/tcl8.*/tcl.h))
27 tclversion:=$(patsubst /usr/include/tcl%/tcl.h,%,$(tclh))
28
29 march := $(shell dpkg-architecture -q DEB_HOST_MULTIARCH)
30 libsubdir = /$(march)
31
32 garch := $(shell dpkg-architecture -q DEB_HOST_GNU_TYPE)
33 ifneq ($(garch),)
34
35 ifeq ($(origin CC),default)
36 export CC=$(garch)-gcc
37 endif
38
39 endif # $garch
40
41 define checkdir
42         test -f hbytes/hbytes.tct
43 endef
44
45 build: build-arch build-indep
46 build-arch:
47         $(checkdir)
48         $(MAKE) prefix=/usr VERSION=$(majversion) TCL_VERSION=$(tclversion)
49
50 build-indep:
51
52 clean:
53         $(checkdir)
54         $(MAKE) clean
55         rm -rf *~ debian/tmp debian/*~ debian/files* debian/substvars*
56         dh_clean
57
58 binary-indep:
59
60 binary-arch:    checkroot build
61         $(checkdir)
62         -rm -rf debian/$(docpackage) debian/$(libpackage)
63         install -d debian/$(libpackage)/usr/lib$(libsubdir)
64         install -d debian/$(docpackage)/usr/share/doc/$(docpackage)
65
66         set -e; for f in lintian; do                                         \
67                 install -d debian/$(libpackage)/usr/share/$$f/overrides;     \
68                 cp debian/$$f-overrides                                      \
69                  debian/$(libpackage)/usr/share/$$f/overrides/$(libpackage); \
70                 done
71
72         cp */*.so debian/$(libpackage)/usr/lib$(libsubdir)/.
73
74         set -e; for f in */*.[ch]; do                                   \
75                 perl debian/extractdoc <$$f                             \
76                         debian/$(docpackage)/$(docdir)/ $$f .txt;       \
77                 done
78         cp */*.tct debian/README debian/copyright \
79                 debian/$(docpackage)/$(docdir)
80
81         dh_installchangelogs
82         dh_strip
83
84         dh_makeshlibs
85         dh_shlibdeps -Xchiark_tcl_adns -Xchiark_tcl_crypto
86
87         # be consistent about what we compress:
88         dh_compress -X.c.txt -X.h.txt
89
90         dh_fixperms
91         dh_installdeb
92         dh_gencontrol
93         dh_md5sums
94         dh_builddeb
95
96 # Below here is fairly generic really
97
98 binary:         binary-indep binary-arch
99
100 source diff:
101         @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
102
103 checkroot:
104         $(checkdir)
105         dh_testroot
106
107 .PHONY: binary binary-arch binary-indep clean checkroot