File: rules

package info (click to toggle)
alsa-driver 0.9%2B0beta12-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,524 kB
  • ctags: 29
  • sloc: sh: 982; makefile: 283
file content (177 lines) | stat: -rw-r--r-- 4,619 bytes parent folder | download
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


############################### variable definitions ######################
ifndef KSRC
KSRC=/usr/src/linux
endif

ifndef MODDIR
MODDIR=..
endif

ifndef BUILD_DIR
BUILD_DIR=.
endif

# This has to be exported to make some magic below work.
export DH_OPTIONS

package=$(shell head -n 1 debian/changelog | cut -d' ' -f 1)
version=$(shell head -n 1 debian/changelog | sed 's/.*(\(.*\)).*/\1/')
ifndef srcpkg
srcpkg=$(package)-source
endif

ifndef KVERS
export KVERS=$(shell awk '{ if (NR==1) v=$$3; else if (NR==2) p=$$3; else if \
       (NR==3) s=$$3; else if (NR==4) { e=$$3; exit; } } \
       END { printf("%s.%s.%s%s\n",v,p,s,e); }' $(KSRC)/Makefile 2> /dev/null)

ifeq ($(KVERS),)
KVERS=unknown
endif

endif

ifeq ($(DH_COMPAT),)
export DH_COMPAT=1
endif

ifeq ($(DH_COMPAT),1)
 srcdir=tmp
else
 srcdir=$(srcpkg)
endif

modulepkg=tmp
topdir=$(shell pwd)

DEBIAN_FILES=$(shell find debian -name "*.in")

GEN_DEBIAN_FILES=$(shell find debian -name "*.in" | \
                sed -e 's/_VERSION_/$(VERSION)/g' \
                -e 's/_KVERSION_/$(KVERS)/g' \
                -e 's/\.in//g')

$(GEN_DEBIAN_FILES): $(DEBIAN_FILES)
	for f in $(DEBIAN_FILES); \
	do \
		fi=`echo $$f | sed -e 's/_VERSION_/$(VERSION)/g' \
			-e 's/_KVERSION_/$(KVERS)/g'`; \
		file=`dirname $$fi`/`basename $$fi .in`; \
		echo -n "Generating $$file..."; \
		sed -e 's/_VERSION_/$(VERSION)/g' \
			-e 's/_MAJORVERSION_/$(ALSA_MAJOR_VERSION)/g' \
			-e 's/_PRIORITY_/$(ALSA_MODULE_PRIORITY)/g' \
			-e 's/_KERNELVERSION_/$(KVERS)/g' \
			$$f > $$file; \
		echo $$file >> stamp-debian; \
		echo "done"; \
	done

debian: stamp-debian
stamp-debian: $(GEN_DEBIAN_FILES)
	install debian/modules.d/control$(VERSION).source debian/control
	cat debian/modules.d/control$(VERSION).normal >> debian/control

install-source-config:

install-source-misc:

install-source: debian $(BUILD_DIR)
	dh_testdir
	dh_testroot
	rm -rf debian/$(srcpkg)
# Install directories
	install -d debian/$(srcdir)/usr/src/modules/$(package)
# Install files
	cd $(BUILD_DIR) && find . | grep -v CVS \
		| cpio -admp $(topdir)/debian/$(srcdir)/usr/src/modules/$(package)
	( cd debian/$(srcdir)/usr/src/modules/$(package); \
		$(MAKE) -f debian/rules clean; \
		$(MAKE) -f debian/rules install-source-config )
	chown -R root.root debian/$(srcdir)
	find debian/$(srcdir) -type d | xargs chmod 755
	find debian/$(srcdir) -type f -perm -100 | xargs chmod 755
	find debian/$(srcdir) -type f -not -perm -100 | xargs chmod 644
	$(MAKE) -f debian/rules install-source-misc
	cd debian/$(srcdir)/usr/src && \
	  tar cf $(package).tar modules && \
	  $(RM) -r modules/$(package)
	gzip -9 debian/$(srcdir)/usr/src/$(package).tar
	chmod 644 debian/$(srcdir)/usr/src/$(package).tar.gz

control-modules:
	cat debian/modules.d/control$(VERSION).source > debian/control
ifeq ($(KERNEL_DEPENDS),y)
	cat debian/modules.d/control$(VERSION).module >> debian/control
else
	cat debian/modules.d/control$(VERSION).module-image >> debian/control
endif

binary-modules: DH_OPTIONS=-Pdebian/$(modulepkg)
binary-modules: debian control-modules install-modules
	dh_testdir
	dh_testroot

	sh debian/modules-tools.d/setvers.sh

# Install control files

#       dh_installdocs
#        dh_installexamples
#        dh_installmenu
#       dh_installemacsen
#       dh_installpam
#       dh_installinit
#        dh_installcron
#        dh_installmanpages
#        dh_installinfo
#       dh_undocumented
#        dh_installchangelogs #CHANGELOGS#
#        dh_link
#        dh_strip
#        dh_compress
#        dh_fixperms
        # You may want to make some executables suid here.
#        dh_suidregister
#       dh_makeshlibs
#        dh_installdeb
#       dh_perl
#        dh_shlibdeps
#        dh_gencontrol
#        dh_md5sums

	dh_installdirs
	dh_installdebconf
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol -- -v`cat debian/MODVERS`
	dh_md5sums 
	dh_builddeb --destdir=$(MODDIR)


modules_clean:
	-rm -f `cat stamp-debian`
	-rm -f stamp-debian

######################## make-kpkg interface ###########################
kdist_image:
	$(MAKE) $(MFLAGS) -f debian/rules MODDIR=$(KSRC)/.. binary-modules
	$(MAKE) $(MFLAGS) -f debian/rules MODDIR=$(KSRC)/.. clean

kdist:
	$(MAKE) $(MFLAGS) -f debian/rules MODDIR=$(KSRC)/.. KERNEL_DEPENDS=y binary-modules
	KSRC="$(KSRC)" KMAINT="$(KMAINT)" KEMAIL="$(KEMAIL)" \
		sh -v debian/modules-tools.d/genchanges.sh
	$(MAKE) $(MFLAGS) -f debian/rules MODDIR=$(KSRC)/.. clean

kdist_configure:
	$(MAKE) $(MFLAGS) -f debian/rules KSRC=$(KSRC) config; \

kdist_clean:
	$(MAKE) $(MFLAGS) -f debian/rules MODDIR=$(KSRC)/.. clean