(Debian) dpkg control files
[mirror-ossqm-expat.git] / debian / rules
blob1c79692adfb393892308e6a5984a10920882c835
1 #!/usr/bin/make -f
2 ## ----------------------------------------------------------------------
3 ## debian/rules : package script for expat
4 ## ----------------------------------------------------------------------
6 ## uncomment this to turn on verbose mode
7 #export DH_VERBOSE=1
9 include /usr/share/dpatch/dpatch.make
11 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
12 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
13 DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
15 BUILD64 = $(filter $(DEB_HOST_ARCH), i386 powerpc sparc s390)
17 ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
18 CONFFLAGS = --build=$(DEB_HOST_GNU_TYPE)
19 else
20 CONFFLAGS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
21 endif
23 ifeq ($(DEB_HOST_ARCH),i386)
24 HOST64FLAG = --host=x86_64-linux-gnu
25 endif
26 ifeq ($(DEB_HOST_ARCH),powerpc)
27 HOST64FLAG = --host=ppc64-linux-gnu
28 endif
29 ifeq ($(DEB_HOST_ARCH),sparc)
30 HOST64FLAG = --host=sparc64-linux-gnu
31 endif
32 ifeq ($(DEB_HOST_ARCH),s390)
33 HOST64FLAG = --host=s390x-linux-gnu
34 endif
36 CFLAGS = -Wall -g -pthread -D_REENTRANT
37 LDFLAGS = -Wl,-Bsymbolic-functions
38 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
39 CFLAGS += -O0
40 else
41 CFLAGS += -O2
42 endif
44 UPACKAGE = $(shell dh_listpackages | grep -- -udeb$$)
46 build/config.status: configure
47 dh_testdir
48 (mkdir -p $(@D); cd $(@D); CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
49 ../configure $(CONFFLAGS) --prefix=/usr --mandir=\$${prefix}/share/man)
51 buildw/config.status: configure
52 dh_testdir
53 (mkdir -p $(@D); cd $(@D); CFLAGS="$(CFLAGS) -DXML_UNICODE" LDFLAGS="$(LDFLAGS)" \
54 ../configure $(CONFFLAGS) --prefix=/usr --mandir=\$${prefix}/share/man)
56 build64/config.status: configure
57 dh_testdir
58 (mkdir -p $(@D); cd $(@D); CFLAGS="-m64 $(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
59 ../configure $(CONFFLAGS) $(HOST64FLAG) --prefix=/usr --mandir=\$${prefix}/share/man \
60 --libdir=\$${prefix}/lib64)
62 buildw64/config.status: configure
63 dh_testdir
64 (mkdir -p $(@D); cd $(@D); CFLAGS="-m64 $(CFLAGS) -DXML_UNICODE" LDFLAGS="$(LDFLAGS)" \
65 ../configure $(CONFFLAGS) $(HOST64FLAG) --prefix=/usr --mandir=\$${prefix}/share/man \
66 --libdir=\$${prefix}/lib64)
68 clean: unpatch
69 dh_testdir
70 dh_testroot
71 rm -rf build/ build64/ buildw/ buildw64/
72 rm -rf debian/tmp/
73 dh_clean build-stamp patch-stamp debian/xmlwf.1
75 build: build-stamp
76 build-stamp: patch-stamp build/config.status buildw/config.status $(if $(BUILD64), build64/config.status buildw64/config.status)
77 dh_testdir
78 $(MAKE) -C build/
79 $(MAKE) -C buildw/ buildlib LIBRARY=libexpatw.la
80 ifneq ($(BUILD64),)
81 $(MAKE) -C build64/ buildlib
82 $(MAKE) -C buildw64/ buildlib LIBRARY=libexpatw.la
83 endif
84 docbook-to-man doc/xmlwf.sgml > debian/xmlwf.1
85 touch $@
87 install: build
88 dh_testdir
89 dh_testroot
90 dh_clean -k
91 dh_installdirs
92 $(MAKE) -C build/ install DESTDIR=$(CURDIR)/debian/tmp
93 $(MAKE) -C buildw/ installlib LIBRARY=libexpatw.la DESTDIR=$(CURDIR)/debian/tmp APIHEADER=
94 ifneq ($(BUILD64),)
95 $(MAKE) -C build64/ installlib DESTDIR=$(CURDIR)/debian/tmp
96 $(MAKE) -C buildw64/ installlib LIBRARY=libexpatw.la DESTDIR=$(CURDIR)/debian/tmp APIHEADER=
97 endif
99 binary-indep: build install
100 binary-arch: build install
101 dh_testdir
102 dh_testroot
103 dh_install -s --sourcedir=debian/tmp
104 dh_installdocs -s
105 dh_installman -pexpat debian/xmlwf.1
106 dh_installexamples -s
107 dh_installchangelogs -s Changes
108 dh_link -s
109 dh_strip -s
110 dh_compress -s
111 dh_fixperms -s
112 chmod 644 $(CURDIR)/debian/libexpat1-dev/usr/share/doc/libexpat1-dev/examples/* \
113 $(CURDIR)/debian/libexpat1-dev/usr/share/aclocal/*
114 dh_makeshlibs -s -V --add-udeb=$(UPACKAGE)
115 dh_installdeb -s
116 dh_shlibdeps -s -l $(CURDIR)/debian/libexpat1/usr/lib:$(CURDIR)/debian/lib64expat1/usr/lib64
117 dh_gencontrol -s
118 dh_md5sums -s
119 dh_builddeb -s
121 binary: binary-indep binary-arch
123 .PHONY: clean build install binary-indep binary-arch binary