1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
|
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.
#
# Modified to make a template file for a multi-binary package with separated
# build-arch and build-indep targets by Bill Allombert 2001
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# This has to be exported to make some magic below work.
export DH_OPTIONS
# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
# Get flags from dpkg-buildflags
CFLAGS = $(shell dpkg-buildflags --get CFLAGS)
LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS)
CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
# Additional flags
CFLAGS += -Wall
# Flags for udebs
CPPFLAGS_UDEB = $(CPPFLAGS)
CFLAGS_UDEB = $(CFLAGS) -Os
LDFLAGS_UDEB = $(LDFLAGS)
ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) \
else
CROSS= --build $(DEB_BUILD_GNU_TYPE)
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
INSTALL_PROGRAM += -s
endif
objdir = $(CURDIR)/obj-$(DEB_BUILD_GNU_TYPE)
objdir_udeb = $(objdir)-udeb
configure: configure-deb-stamp configure-udeb-stamp
configure-common: configure-common-stamp
configure-common-stamp:
dh_testdir
# make sure this file doesn't exist!
rm -f $(CURDIR)/usb.h
# update config.guess and config.sub
cp -f /usr/share/misc/config.sub $(CURDIR)/config.sub
cp -f /usr/share/misc/config.guess $(CURDIR)/config.guess
# make configure executable
chmod +x $(CURDIR)/configure
touch $@
configure-deb: configure-deb-stamp
configure-deb-stamp: configure-common-stamp
dh_testdir
# make build directory
mkdir $(objdir)
# run configure with build tree $(objdir)
cd $(objdir) && \
CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ../configure $(CROSS) \
--prefix=/usr \
--libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--enable-examples-build
touch $@
configure-udeb: configure-udeb-stamp
configure-udeb-stamp: configure-common-stamp
dh_testdir
# make build directory
mkdir $(objdir_udeb)
# run configure with build tree $(objdir_udeb)
cd $(objdir_udeb) && \
CPPFLAGS="$(CPPFLAGS_UDEB)" CFLAGS="$(CFLAGS_UDEB)" LDFLAGS="$(LDFLAGS_UDEB)" ../configure $(CROSS) \
--prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info
touch $@
build: build-arch build-indep
build-arch: build-arch-deb build-arch-udeb
build-arch-deb: build-arch-deb-stamp
build-arch-deb-stamp: configure-deb-stamp
dh_testdir
cd $(objdir) && \
$(MAKE)
cd $(objdir) && \
$(MAKE) -C doc docs
touch $@
build-arch-udeb: build-arch-udeb-stamp
build-arch-udeb-stamp: configure-udeb-stamp
dh_testdir
cd $(objdir_udeb) && \
$(MAKE)
touch $@
build-indep: build-indep-stamp
build-indep-stamp:
dh_testdir
touch $@
clean:
dh_testdir
dh_testroot
rm -f *-stamp
rm -f config.sub config.guess
# Remove build trees
rm -rf $(objdir) $(objdir_udeb)
# Remove install dirs
rm -rf $(CURDIR)/debian/tmp $(CURDIR)/debian/tmp-udeb
dh_clean
install: build
dh_testdir
dh_testroot
dh_clean -k -s
dh_installdirs -s
# Main install
cd $(objdir) && \
$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
# Move the library to /lib
mkdir -p $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/
mv $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libusb-1.0.so.* \
$(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/
ln -sf /lib/$(DEB_HOST_MULTIARCH)/libusb-1.0.so.0.1.0 \
$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libusb-1.0.so
# Move all files in their corresponding package
dh_install -s -Nlibusb-1.0-0-udeb --list-missing --sourcedir=debian/tmp
# udeb install
$(MAKE) -C $(objdir_udeb) install DESTDIR=$(CURDIR)/debian/tmp-udeb
dh_install -plibusb-1.0-0-udeb --sourcedir=debian/tmp-udeb
# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir
dh_testroot
# dh_installchangelogs ChangeLog
dh_installchangelogs NEWS
dh_installdocs
# dh_installexamples
# dh_installmenu
dh_installdebconf
# dh_installlogrotate
# dh_installemacsen
# dh_installpam
# dh_installmime
# dh_installinit
# dh_installcron
# dh_installinfo
dh_installman
dh_link -s
dh_strip -s
dh_compress -s
dh_fixperms -s
# dh_perl
# dh_python
dh_makeshlibs -plibusb-1.0-0 --add-udeb="libusb-1.0-0-udeb"
dh_installdeb -s
dh_shlibdeps -s
dh_gencontrol -s
dh_md5sums -s
dh_builddeb -s
binary: binary-arch binary-indep
.PHONY: build clean binary-indep binary-arch binary install configure
|