rules 4.66 KB
Newer Older
Carsten Schoenert's avatar
Carsten Schoenert committed
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
#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export DEB_HOST_ARCH_OS   ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
export DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

include /usr/share/dpkg/pkg-info.mk
export REVDATE := $(shell TZ=UTC date -d@"$(SOURCE_DATE_EPOCH)" +%Y-%m-%d)

DEB_BUILD_DIR = debian/build
INSTDIR := $(CURDIR)/debian/tmp

DEB_CONFIGURE_OPTS = \
	--prefix=/usr \
	--mandir=\$${prefix}/share/man \
	--infodir=\$${prefix}/share/info \
	--htmldir=\$${prefix}/share/doc/libcoap \
	--libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
	--build=$(DEB_BUILD_GNU_TYPE) \
	--host=$(DEB_HOST_GNU_TYPE) \
	--enable-shared \
	--enable-static \
	--disable-documentation \
	--disable-doxygen \
	--disable-manpages \
	--enable-examples \
	$(NULL)

DEB_CONFIGURE_DTLS_NO_OPTS = \
	$(DEB_CONFIGURE_OPTS) \
	--disable-dtls \
	--enable-documentation \
	--enable-doxygen \
	--enable-manpages \
	$(NULL)

DEB_CONFIGURE_DTLS_OPENSSL_OPTS = \
	$(DEB_CONFIGURE_OPTS) \
	--enable-dtls \
	--with-openssl \
	$(NULL)

DEB_CONFIGURE_DTLS_GNUTLS_OPTS = \
	$(DEB_CONFIGURE_OPTS) \
	--enable-dtls \
	--with-gnutls \
	$(NULL)

PREPROCESS_FILES := $(wildcard debian/*.in)

$(PREPROCESS_FILES:.in=): %: %.in
	sed 's,/@DEB_HOST_MULTIARCH@,$(DEB_HOST_MULTIARCH:%=/%),g' $< > $@

%:
	dh $@

override_dh_auto_clean:
	dh_clean
	if [ -f Makefile ]; then \
		make clean ;\
	fi
	for i in `find $(CURDIR) -type f \
		\( -name "*Makefile" \
73
		-o -name "libcoap-2*.pc" \
Carsten Schoenert's avatar
Carsten Schoenert committed
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
		-o -name "$(PACKAGE_BASE).dirs" -o -name "$(PACKAGE_BASE)-dev.dirs" \
		-o -name "$(PACKAGE_BASE).install" -o -name "$(PACKAGE_BASE)-dev.install" \
		-o -name "coap_config.h" \
		-o -name ".dirstamp" \
		-o -name "tags" \
		-o -name "Doxyfile" \)` ;\
	do rm -f $$i; done
	rm -f config.log config.status  libtool stamp-h1
	for i in `find $(CURDIR) -type d \
		\( -name ".deps" \)` ;\
	do rm -rf $$i; done

override_dh_auto_configure:
	#sed -i 's/@REVDATE@/$(REVDATE)/' man/coap-*.txt.in
	mkdir -p $(DEB_BUILD_DIR)
	#
	########################################
	# configure build with no DTLS support #
	########################################
	dh_auto_configure --sourcedirectory=$(CURDIR) --builddirectory=$(DEB_BUILD_DIR)/nodtls -- $(DEB_CONFIGURE_DTLS_NO_OPTS) 
	#
	#############################################
	# configure build with OpenSSL DTLS support #
	#############################################
	dh_auto_configure --sourcedirectory=$(CURDIR) --builddirectory=$(DEB_BUILD_DIR)/openssl -- $(DEB_CONFIGURE_DTLS_OPENSSL_OPTS) 
	#
	############################################
	# configure build with GnuTLS DTLS support #
	############################################
103
	dh_auto_configure --sourcedirectory=$(CURDIR) --builddirectory=$(DEB_BUILD_DIR)/gnutls -- $(DEB_CONFIGURE_DTLS_GNUTLS_OPTS) 
Carsten Schoenert's avatar
Carsten Schoenert committed
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119

override_dh_auto_build:
	#
	#######################################
	# build libcoap2 with no DTLS support #
	#######################################
	dh_auto_build --sourcedirectory=$(CURDIR) --builddirectory=$(DEB_BUILD_DIR)/nodtls
	#
	############################################
	# build libcoap2 with OpenSSL DTLS support #
	############################################
	dh_auto_build --sourcedirectory=$(CURDIR) --builddirectory=$(DEB_BUILD_DIR)/openssl
	#
	###########################################
	# build libcoap2 with GnuTLS DTLS support #
	###########################################
120
	dh_auto_build --sourcedirectory=$(CURDIR) --builddirectory=$(DEB_BUILD_DIR)/gnutls
Carsten Schoenert's avatar
Carsten Schoenert committed
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136

override_dh_auto_install: $(PREPROCESS_FILES:.in=)
	#
	####################################################
	# installing libcoap2 library with no DTLS support #
	####################################################
	dh_auto_install --destdir=$(INSTDIR) --sourcedirectory=$(CURDIR) --builddirectory=$(DEB_BUILD_DIR)/nodtls
	#
	#######################################################
	# installing libcoap2 library with no OpenSSL support #
	#######################################################
	dh_auto_install --destdir=$(INSTDIR) --sourcedirectory=$(CURDIR) --builddirectory=$(DEB_BUILD_DIR)/openssl
	#
	####################################################
	# installing libcoap2 library with no DTLS support #
	####################################################
137
	dh_auto_install --destdir=$(INSTDIR) --sourcedirectory=$(CURDIR) --builddirectory=$(DEB_BUILD_DIR)/gnutls
138 139
	# Find useless .la file and remove them.
	find $(INSTDIR) -name '*.la' | xargs rm
Carsten Schoenert's avatar
Carsten Schoenert committed
140 141 142


#override_dh_auto_test: