File: rules

package info (click to toggle)
ivtv 0.8.2-2
  • links: PTS
  • area: contrib
  • in suites: etch, etch-m68k
  • size: 2,128 kB
  • ctags: 5,173
  • sloc: ansic: 28,746; perl: 2,593; cpp: 1,946; sh: 1,521; makefile: 263
file content (183 lines) | stat: -rwxr-xr-x 4,953 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
178
179
180
181
182
183
#!/usr/bin/make -f
# -*- makefile -*-

# 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

include /usr/share/dpatch/dpatch.make

PKG := ivtv

# prefix of the target package name
PACKAGE=$(PKG)-modules
# modifieable for experiments or debugging m-a
MA_DIR ?= /usr/share/modass
# load generic variable handling
-include $(MA_DIR)/include/generic.make
# load default rules
-include $(MA_DIR)/include/common-rules.make

CFLAGS = -Wall -g

CURDIR := $(shell pwd)

DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)

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

DEBVERSION:=$(shell head -n 1 debian/changelog \
                    | sed -e 's/^[^(]*(\([^)]*\)).*/\1/')
UPVERSION:=$(shell echo $(DEBVERSION) | sed -e 's/^.*://' -e 's/-[0-9.]*\(~unreleased\)\?$$//' -e 's/.dfsg$$//')

FILENAME := ivtv_$(UPVERSION).dfsg.orig.tar.gz
UPFILENAME := ivtv_$(UPVERSION).orig.tar.gz
URL := http://dl.ivtvdriver.org/ivtv/archive/0.8.x/ivtv-$(UPVERSION).tar.gz

configure: patch configure-stamp
configure-stamp:
	dh_testdir
	touch configure-stamp


#Architecture 
build: build-arch build-indep

build-arch: build-arch-stamp
build-arch-stamp: configure
	$(MAKE) -C utils
	touch build-arch-stamp

build-indep: build-indep-stamp
build-indep-stamp: configure
	touch build-indep-stamp

clean: clean-patched unpatch
clean-patched:
	dh_testdir
	dh_testroot
	rm -f build-arch-stamp build-indep-stamp configure-stamp

	-$(MAKE) -C utils clean

	dh_clean 

install: install-indep install-arch
install-indep:
	dh_testdir
	dh_testroot
	dh_clean -k -i 
	dh_installdirs -i usr/src/modules/$(PKG)

	mkdir -p debian/$(PKG)-source$(MA_DIR)/packages/
	cd debian/$(PKG)-source$(MA_DIR)/packages/ && ln -sf default.sh $(PKG)-source
	mkdir -p debian/$(PKG)-source/usr/src/modules/$(PKG)/driver
	mkdir -p debian/$(PKG)-source/usr/src/modules/$(PKG)/i2c-drivers
	cp -a driver/* debian/$(PKG)-source/usr/src/modules/$(PKG)/driver
	cp -a i2c-drivers/* debian/$(PKG)-source/usr/src/modules/$(PKG)/i2c-drivers
	mkdir debian/$(PKG)-source/usr/src/modules/$(PKG)/debian
	cd debian ; cp changelog control compat *.modules.in rules copyright \
		$(PKG)-source/usr/src/modules/$(PKG)/debian
	cd debian/$(PKG)-source/usr/src/ ; \
		tar -cf - modules | bzip2 -9 > $(PKG).tar.bz2 && \
		rm -rf modules
	dh_install -i

install-arch:
	dh_testdir
	dh_testroot
	dh_clean -k -s 
	dh_installdirs -s

	$(MAKE) -C utils install DESTDIR=$(CURDIR)/debian/$(PKG)-utils PREFIX=/usr
	cp utils/ivtvfwextract.pl debian/$(PKG)-utils/usr/bin/ivtvfwextract
	cp utils/perl/ptune.pl  debian/$(PKG)-utils/usr/bin/ptune
	cp utils/perl/ptune-ui.pl  debian/$(PKG)-utils/usr/bin/ptune-ui
	cp v4l-cx2341x-init.mpg debian/$(PKG)-utils/lib/firmware/v4l-cx2341x-init.mpg
	cd debian/$(PKG)-utils/lib/firmware/ && ln -sf v4l-cx2341x-init.mpg v4l-cx2341x-init-mpeg.bin
	sed -e 's/@VERSION@/$(VERSION)/g'	\
	    -e 's/@PKG@/$(PKG)/g'		\
		< debian/ivtv-make-fwpkg.in	\
		> debian/$(PKG)-utils/usr/bin/ivtv-make-fwpkg
	chmod +x debian/$(PKG)-utils/usr/bin/ivtv-make-fwpkg

# Must not depend on anything. This is to be called by
# binary-arch/binary-indep
# in another 'make' thread.
binary-common:
	dh_testdir
	dh_testroot
	dh_installchangelogs ChangeLog
	dh_installdocs
	dh_installexamples
	dh_installman 
	dh_link
	dh_strip
	dh_perl
	dh_compress 
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Build architecture independant packages using the common target.
binary-indep: build-indep install-indep
	$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common

# Build architecture dependant packages using the common target.
binary-arch: build-arch install-arch
	$(MAKE) -f debian/rules DH_OPTIONS=-a binary-common

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

KMAKE := $(MAKE) KVER=$(KVERS) KDIR=$(KSRC) HP_FWLOAD=1 DEBIAN_MAKE_KPKG=1

kdist_clean:
	dh_clean
	$(KMAKE) -C driver clean
	$(KMAKE) -C i2c-drivers clean

kdist_config: prep-deb-files

kdist_configure: kdist_config

binary-modules: prep-deb-files
	dh_testdir
	dh_testroot
	dh_clean -k
	$(KMAKE) -C driver
	$(KMAKE) -C i2c-drivers
	$(KMAKE) -C driver install DESTDIR=$(CURDIR)/debian/$(PKGNAME)
	$(KMAKE) -C i2c-drivers install DESTDIR=$(CURDIR)/debian/$(PKGNAME)
	rm -f debian/$(PKGNAME)/lib/modules/*/modules.*
	dh_installmodules 
	dh_installdocs
	dh_installchangelogs
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol -- -v$(VERSION)
	dh_md5sums
	dh_builddeb --destdir=$(DEB_DESTDIR)

print-version:
	@@echo "Debian version:          $(DEBVERSION)"
	@@echo "Upstream version:        $(UPVERSION)"

get-orig-source:
	@@dh_testdir
	@@[ -d ../tarballs/. ]||mkdir -p ../tarballs
	@@echo Downloading $(UPFILENAME) from $(URL) ...
	@@wget -N -nv -T10 -t3 -O ../tarballs/$(UPFILENAME) $(URL)