Tizen 2.0 Release
[external/expat.git] / debian / rules
1 #!/usr/bin/make -f
2 ## ----------------------------------------------------------------------
3 ## debian/rules : package script for expat
4 ## ----------------------------------------------------------------------
5
6 ## uncomment this to turn on verbose mode
7 #export DH_VERBOSE=1
8
9 include /usr/share/dpatch/dpatch.make
10
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)
14
15 BUILD64 = $(filter $(DEB_HOST_ARCH), powerpc sparc s390)
16
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
22
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
35
36 # -pthread -D_REENTRANT #551079
37 CFLAGS  = -Wall -g
38 LDFLAGS = -Wl,-Bsymbolic-functions
39 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
40         CFLAGS += -O0
41 else
42         CFLAGS += -O2
43 endif
44
45 UPACKAGE = $(shell dh_listpackages | grep -- -udeb$$)
46
47 build/config.status: configure
48         dh_testdir
49         (mkdir -p $(@D); cd $(@D); CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
50          ../configure $(CONFFLAGS) --prefix=/usr --mandir=\$${prefix}/share/man)
51
52 buildw/config.status: configure
53         dh_testdir
54         (mkdir -p $(@D); cd $(@D); CFLAGS="$(CFLAGS) -DXML_UNICODE" LDFLAGS="$(LDFLAGS)" \
55          ../configure $(CONFFLAGS) --prefix=/usr --mandir=\$${prefix}/share/man)
56
57 build64/config.status: configure
58         dh_testdir
59         (mkdir -p $(@D); cd $(@D); CFLAGS="-m64 $(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
60          ../configure $(CONFFLAGS) $(HOST64FLAG) --prefix=/usr --mandir=\$${prefix}/share/man \
61          --libdir=\$${prefix}/lib64)
62
63 buildw64/config.status: configure
64         dh_testdir
65         (mkdir -p $(@D); cd $(@D); CFLAGS="-m64 $(CFLAGS) -DXML_UNICODE" LDFLAGS="$(LDFLAGS)" \
66          ../configure $(CONFFLAGS) $(HOST64FLAG) --prefix=/usr --mandir=\$${prefix}/share/man \
67          --libdir=\$${prefix}/lib64)
68
69 clean: unpatch
70         dh_testdir
71         dh_testroot
72         rm -rf build/ build64/ buildw/ buildw64/
73         rm -rf debian/tmp/
74         dh_clean build-stamp patch-stamp debian/xmlwf.1
75
76 build: build-stamp
77 build-stamp: patch-stamp build/config.status buildw/config.status $(if $(BUILD64), build64/config.status buildw64/config.status)
78         dh_testdir
79         $(MAKE) -C build/
80         $(MAKE) -C buildw/ buildlib LIBRARY=libexpatw.la
81 ifneq ($(BUILD64),)
82         $(MAKE) -C build64/ buildlib
83         $(MAKE) -C buildw64/ buildlib LIBRARY=libexpatw.la
84 endif
85         docbook-to-man doc/xmlwf.sgml > debian/xmlwf.1
86         touch $@
87
88 install: build
89         dh_testdir
90         dh_testroot
91         dh_clean -k
92         dh_installdirs
93         $(MAKE) -C build/ install DESTDIR=$(CURDIR)/debian/tmp
94         $(MAKE) -C buildw/ installlib LIBRARY=libexpatw.la DESTDIR=$(CURDIR)/debian/tmp APIHEADER=
95 ifneq ($(BUILD64),)
96         $(MAKE) -C build64/ installlib DESTDIR=$(CURDIR)/debian/tmp
97         $(MAKE) -C buildw64/ installlib LIBRARY=libexpatw.la DESTDIR=$(CURDIR)/debian/tmp APIHEADER=
98 endif
99
100 binary-indep: build install
101 binary-arch: build install
102         dh_testdir
103         dh_testroot
104         dh_install -s --sourcedir=debian/tmp
105         dh_installdocs -s
106         dh_installman -pexpat debian/xmlwf.1
107         dh_installexamples -s
108         dh_installchangelogs -s Changes
109         dh_link -s
110         dh_strip -s
111         dh_compress -s
112         dh_fixperms -s
113         chmod 644 $(CURDIR)/debian/libexpat1-dev/usr/share/doc/libexpat1-dev/examples/* \
114                   $(CURDIR)/debian/libexpat1-dev/usr/share/aclocal/*
115         dh_makeshlibs -s -V --add-udeb=$(UPACKAGE)
116         dh_installdeb -s
117         dh_shlibdeps -s -l $(CURDIR)/debian/libexpat1/usr/lib:$(CURDIR)/debian/lib64expat1/usr/lib64
118         dh_gencontrol -s
119         dh_md5sums -s
120         dh_builddeb -s
121
122 binary: binary-indep binary-arch
123
124 .PHONY: clean build install binary-indep binary-arch binary