rules 3.77 KB
Newer Older
Philippe Gerum's avatar
Philippe Gerum committed
1 2 3 4 5 6 7 8
#!/usr/bin/make -f

# Author: Paul Corner <paul_c@gna.org>
# Created on: Sat Mar 3 12:00 GMT 2007
# License: GPL Ver. 2

#export DH_VERBOSE=1

9 10
export DEB_BUILD_HARDENING=1

11 12
DEB_HOST_GNU_CPU ?= $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
13 14
DEB_HOST_GNU_TYPE=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE=$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
Philippe Gerum's avatar
Philippe Gerum committed
15

16 17 18
CONFIG_OPTS = --prefix=/usr \
            --includedir=/usr/include/xenomai \
            --mandir=/usr/share/man \
19
            --with-testdir=/usr/lib/xenomai/testsuite \
20
            --enable-smp \
21
            --enable-lazy-setsched \
22 23
            --enable-debug=symbols \
            --enable-dlopen-libs
24 25 26 27 28 29

ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
	CONFIG_OPTS += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
else
	CONFIG_OPTS += --build $(DEB_BUILD_GNU_TYPE)
endif
Philippe Gerum's avatar
Philippe Gerum committed
30

Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
31 32
build: build-arch build-indep

33
build-arch: build-arch-stamp
34
build-arch-stamp: config.status
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
35
	dh_testdir
Philippe Gerum's avatar
Philippe Gerum committed
36
	$(MAKE)
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
37 38
	touch build-arch-stamp

39 40
build-indep: build-indep-stamp
build-indep-stamp: config.status
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
41 42
	dh_testdir
	touch build-indep-stamp
Philippe Gerum's avatar
Philippe Gerum committed
43

44 45 46 47 48 49
config.status: bootstrap configure-stamp

bootstrap:
	dh_testdir
	./scripts/bootstrap

Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
50
configure-stamp:
Philippe Gerum's avatar
Philippe Gerum committed
51
	dh_testdir
Philippe Gerum's avatar
Philippe Gerum committed
52
	./configure $(CONFIG_OPTS)
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
53
	touch configure-stamp
Philippe Gerum's avatar
Philippe Gerum committed
54 55 56 57

clean:
	dh_testdir
	dh_testroot
58 59
	rm -f configure-stamp build-indep-stamp build-arch-stamp
	-if test -f Makefile ; then \
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
60
	    $(MAKE) distclean ; \
Philippe Gerum's avatar
Philippe Gerum committed
61
	fi
62
	dh_clean
Philippe Gerum's avatar
Philippe Gerum committed
63 64 65 66 67 68
	rm -fR $(CURDIR)/tmp
	rm -f $(CURDIR)/*.patch

install: build
	dh_testdir
	dh_testroot
69
	dh_prep
Philippe Gerum's avatar
Philippe Gerum committed
70 71
	dh_installdirs
	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp/
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
72
	dh_install --sourcedir=$(CURDIR)/debian/tmp
73
	for f in $(CURDIR)/kernel/cobalt/udev/*.rules ; do \
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
74
	    cat $$f >> $(CURDIR)/debian/libxenomai1/etc/udev/xenomai.rules ; \
Philippe Gerum's avatar
Philippe Gerum committed
75
	done
76 77 78
	# xeno-config should be only in xenomai-runtime
	rm -f $(CURDIR)/debian/libxenomai-dev/usr/bin/xeno-config
	rm -f $(CURDIR)/debian/libxenomai-dev/usr/share/man/man1/xeno-config.1
79
	install -m 644 debian/libxenomai1.modprobe $(CURDIR)/debian/libxenomai1/etc/modprobe.d/xenomai.conf
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
80 81 82
	# remove empty directory
	rm -rf $(CURDIR)/debian/xenomai-doc/usr/share/doc/xenomai-doc/ps
	cp debian/libxenomai1.lintian $(CURDIR)/debian/libxenomai1/usr/share/lintian/overrides/libxenomai1
83
	cp debian/libxenomai-dev.lintian $(CURDIR)/debian/libxenomai-dev/usr/share/lintian/overrides/libxenomai-dev
84
	mkdir -p $(CURDIR)/debian/xenomai-kernel-source/usr/src/xenomai-kernel-source $(CURDIR)/debian/xenomai-kernel-source/usr/share/doc/xenomai-kernel-source
85
	cp -a config kernel include scripts $(CURDIR)/debian/xenomai-kernel-source/usr/src/xenomai-kernel-source
Philippe Gerum's avatar
Philippe Gerum committed
86 87

# Build architecture-independent files here.
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
88 89 90
binary-indep: build install
	dh_testdir -i
	dh_testroot -i
Philippe Gerum's avatar
Philippe Gerum committed
91
	dh_installdocs -i -A README
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
92
	dh_link -i
93
	dh_installchangelogs -i
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
94 95 96 97 98 99 100 101 102 103 104 105 106 107
	dh_strip -i
	dh_compress -i -X.pdf
	dh_fixperms -i
	dh_makeshlibs -i
	dh_installdeb -i
	dh_shlibdeps -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir -s
	dh_testroot -s
108
	dh_installinit -s --name=xenomai
109
	dh_installman -s
Philippe Gerum's avatar
Philippe Gerum committed
110
	dh_installdocs -s -A README
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
111
	dh_link -s
112
	dh_installchangelogs -s
113
	dh_strip -s --exclude=smokey
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
114 115 116 117 118 119
	dh_compress -s
	dh_fixperms -s
	dh_makeshlibs -s
	dh_installdeb -s
	dh_shlibdeps -s
	dh_gencontrol -s
120
#	 Echo config options to control.
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
121
	echo " ." >> $(CURDIR)/debian/libxenomai1/DEBIAN/control
122
	echo " Compiled with the following options." >> \
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
123
	        $(CURDIR)/debian/libxenomai1/DEBIAN/control
124
	echo "$(CONFIG_OPTS)" | awk '{ for ( i=1 ; i<=NF ; i++ ) print "   "$$i }' >> \
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
125
	        $(CURDIR)/debian/libxenomai1/DEBIAN/control
Philippe Gerum's avatar
Philippe Gerum committed
126
#	 End of hackery.
Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
127 128
	dh_md5sums -s
	dh_builddeb -s
Philippe Gerum's avatar
Philippe Gerum committed
129 130 131

# We have nothing to do by default.

Gilles Chanteperdrix's avatar
Gilles Chanteperdrix committed
132
binary: binary-indep binary-arch
Philippe Gerum's avatar
Philippe Gerum committed
133
.PHONY: build clean binary-indep binary-arch binary install