rules 2.52 KB
Newer Older
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
#!/usr/bin/make -f
# -*- makefile -*-

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

package=embedlite-components

# 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)


CFLAGS = -Wall -g
configopts =

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif

ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
endif

ifneq (,$(findstring parallel,$(DEB_BUILD_OPTIONS)))
    PARALLEL_JOBS := $(shell echo $(DEB_BUILD_OPTIONS) | \
    sed -e 's/.*parallel=\([0-9]\+\).*/\1/')
    ifeq ($(DEB_BUILD_OPTIONS),$(PARALLEL_JOBS))
	PARALLEL_JOBS := $(shell if [ -f /proc/cpuinfo ]; \
		then echo `cat /proc/cpuinfo | grep 'processor' | wc -l`; \
		else echo 1; fi)
    endif
    NJOBS := -j$(PARALLEL_JOBS)
endif

MAKEFLAGS += $(NJOBS)
40
DEST_OBJ_DIR=objdir-$(DEB_HOST_ARCH)
41

42 43
configure: configure-$(DEB_HOST_ARCH)-stamp
configure-$(DEB_HOST_ARCH)-stamp:
44 45
	dh_testdir
	NO_CONFIGURE=yes ./autogen.sh --prefix=/usr
46 47
	mkdir -p $(CURDIR)/$(DEST_OBJ_DIR)
	cd $(DEST_OBJ_DIR) && CFLAGS="$(CFLAGS)" ../configure --prefix=/usr --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info
48

49
	touch configure-$(DEB_HOST_ARCH)-stamp
50

51 52
build: build-$(DEB_HOST_ARCH)-stamp
build-$(DEB_HOST_ARCH)-stamp: configure-$(DEB_HOST_ARCH)-stamp
53
	dh_testdir
54
	export echo=echo
55 56
	cd $(DEST_OBJ_DIR) && $(MAKE)
	touch build-$(DEB_HOST_ARCH)-stamp
57 58 59 60

clean:
	dh_testdir
	dh_testroot
61 62 63
	-rm -f build-$(DEB_HOST_ARCH)-stamp
	-rm -f configure-$(DEB_HOST_ARCH)-stamp
	-rm -rf $(DEST_OBJ_DIR)
64 65 66 67 68 69 70 71 72 73
#	$(MAKE) distclean
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k 
	dh_installdirs -s

        # Add here commands to install the package into debian/tmp
74
	cd $(DEST_OBJ_DIR) && $(MAKE) install prefix=$(CURDIR)/debian/tmp/usr
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
	
	dh_install --sourcedir=debian/tmp
	
	                 

# 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_link
	dh_compress
	dh_fixperms
Tatiana Meshkova's avatar
Tatiana Meshkova committed
91
	dh_strip --dbg-package=$(package)-dbg
92 93 94 95 96 97 98 99 100
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install