aboutsummaryrefslogtreecommitdiffstats
path: root/linux/Makefile
blob: f374097d09b41ba36ab09ad5e9a03b42c7468e3c (plain)
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
#
# Files that need to be bundled with the building system
#

-include ../v4l/.version

MAINDIRS += drivers firmware include sound

# Media drivers
TARDIR += drivers/media/
TARDIR += drivers/staging/cx25821/
TARDIR += drivers/staging/go7007/
TARDIR += drivers/staging/tm6000/
TARDIR += drivers/staging/lirc/
TARDIR += drivers/staging/cxd2099/
TARDIR += drivers/staging/altera-stapl/
TARFILES += sound/pci/bt87x.c
TARFILES += sound/i2c/other/tea575x-tuner.c

# Includes
TARDIR += include/media/
TARDIR += include/linux/dvb/
TARFILES += include/linux/usb/video.h
TARFILES += include/linux/i2c-id.h
TARFILES += include/linux/ivtv.h
TARFILES += include/linux/mmc/sdio_ids.h
TARFILES += include/linux/ivtvfb.h
TARFILES += include/linux/videodev2.h
TARFILES += include/linux/meye.h
TARFILES += include/sound/tea575x-tuner.h
TARFILES += include/sound/aci.h
TARFILES += include/staging/altera.h
TARFILES += include/linux/via-core.h
TARFILES += include/linux/ti_wilink_st.h
TARFILES += include/linux/media.h
TARFILES += include/linux/v4l2-subdev.h
TARFILES += include/linux/v4l2-mediabus.h

# Firmware
TARFILES += firmware/av7110/bootcode.bin.ihex
TARFILES += firmware/av7110/Boot.S
TARFILES += firmware/cpia2/stv0672_vp4.bin.ihex
TARFILES += firmware/ihex2fw.c
TARFILES += firmware/vicam/firmware.H16
TARFILES += firmware/dabusb/bitstream.bin.ihex
TARFILES += firmware/dabusb/firmware.HEX
TARFILES += firmware/ttusb-budget/dspbootcode.bin.ihex

TODAY_TAR := linux-media-`date "+%Y-%m-%d"`.tar
TODAY_TAR_MD5 := linux-media-`date "+%Y-%m-%d"`.tar.bz2.md5
LATEST_TAR := http://linuxtv.org/downloads/drivers/linux-media-LATEST.tar.bz2
LATEST_TAR_MD5 := http://linuxtv.org/downloads/drivers/linux-media-LATEST.tar.bz2.md5

default:
	make -C ..

help:
	@echo "Use: make tar DIR=<directory>"
	@echo "          untar|clean|distclean"

todaytar:
	@if [ "$(DIR)" = "" ]; then echo "make $@ DIR=<version>"; exit -1; fi
	-rm -f $(PWD)/$(TODAY_TAR).bz2
	tar cf $(PWD)/$(TODAY_TAR) -C $(DIR) $(TARFILES)
	git --git-dir $(DIR)/.git log --pretty=oneline HEAD^1^1^1..HEAD >git_log
	tar rvf $(PWD)/$(TODAY_TAR) git_log
	for i in $(TARDIR); do \
		if [ "`echo $$i|grep Documentation`" = "" ]; then \
			dir="`(cd $(DIR); find $$i -type f -name '*.[ch]')`"; \
			dir="$$dir `(cd $(DIR); find $$i -type f -name Makefile)`"; \
			dir="$$dir `(cd $(DIR); find $$i -type f -name Kconfig)`"; \
			tar rvf $(PWD)/$(TODAY_TAR) -C $(DIR) $$dir; \
		else \
			tar rvf $(PWD)/$(TODAY_TAR) -C $(DIR) $$i; \
		fi; done; bzip2 $(PWD)/$(TODAY_TAR)
	md5sum $(PWD)/$(TODAY_TAR).bz2 > $(PWD)/$(TODAY_TAR_MD5)

tar:
	@if [ "$(DIR)" = "" ]; then echo "make $@ DIR=<version>"; exit -1; fi
	-rm -f $(PWD)/linux-media.tar.bz2
	tar cf $(PWD)/linux-media.tar -C $(DIR) $(TARFILES)
	git --git-dir $(DIR)/.git log --pretty=oneline HEAD^1^1^1..HEAD >git_log
	tar rvf $(PWD)/linux-media.tar git_log
	for i in $(TARDIR); do \
		if [ "`echo $$i|grep Documentation`" = "" ]; then \
			dir="`(cd $(DIR); find $$i -type f -name '*.[ch]')`"; \
			dir="$$dir `(cd $(DIR); find $$i -type f -name Makefile)`"; \
			dir="$$dir `(cd $(DIR); find $$i -type f -name Kconfig)`"; \
			tar rvf $(PWD)/linux-media.tar -C $(DIR) $$dir; \
		else \
			tar rvf $(PWD)/linux-media.tar -C $(DIR) $$i; \
		fi; done; bzip2 $(PWD)/linux-media.tar

untar: linux-media.tar.bz2
	tar xfj linux-media.tar.bz2
	-rm -f .patches_applied .linked_dir .git_log.md5

clean:
	-rm -rf $(MAINDIRS) .patches_applied .linked_dir .git_log.md5

dir: clean
	@lsdiff --version >/dev/null # Make 'make dir' fail if lsdiff is not installed
	@if [ "$(DIR)" = "" ]; then echo "make $@ DIR=<version>"; exit -1; fi
	@if [ ! -f "$(DIR)/include/linux/videodev2.h" ]; then echo "$(DIR) does not contain kernel sources"; exit -1; fi
	@echo "Searching in $(DIR)/Makefile for kernel version."
	./use_dir.pl $(DIR)

distclean: clean
	-rm -f linux-media.tar.bz2 linux-media.tar.bz2.md5

apply_patches apply-patches:
	@if [ -e .linked_dir ]; then ./use_dir.pl --recheck --silent; fi
	@if [ "$(KERNELRELEASE)" != "" ]; then \
		if [ -e ../backports/v$(KERNELRELEASE)_series ]; then \
			dir="v$(KERNELRELEASE)"; \
		else \
			dir="v$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)"; \
		fi; \
	fi; \
	if [ "$(VER)" != "" ]; then dir="v$(VER)"; fi; \
	if [ "$$dir" = "" ]; then echo "make $@ VER=<version>"; exit -1; fi; \
	if [ -e .patches_applied ]; then \
		if [ "`cat .patches_applied|grep ^#`" = "#$$dir" ]; then \
			echo "Patches for $$dir already applied."; exit; \
		else \
			$(MAKE) unapply_patches; \
		fi; \
	fi; \
	if [ ! -e ../backports/$$dir_series ]; then echo "Version $$dir not supported."; exit 1; fi; \
	echo "Applying patches for kernel $$dir"; \
	touch .patches_applied; \
	for i in `cat ../backports/$${dir}_series`; do \
		echo patch -s -f -N -p1 -i ../backports/$$i; \
		patch -s -f -N -p1 -i ../backports/$$i --dry-run || exit 1; \
		patch -s -f -N -p1 -i ../backports/$$i; \
		mv .patches_applied .patches_applied.old; \
		echo $$i > .patches_applied; \
		cat .patches_applied.old >> .patches_applied; \
	done; \
	mv .patches_applied .patches_applied.old; \
	echo "#$$dir" > .patches_applied; \
	cat .patches_applied.old >> .patches_applied; \
	rm -f .patches_applied.old; \
	./version_patch.pl; \
	if [ -e .linked_dir ]; then ./use_dir.pl --get_patched; fi

unapply_patches unapply-patches:
	@if [ -e .patches_applied ]; then \
	echo "Unapplying patches"; \
	for i in `cat .patches_applied|grep -v ^#`; do \
		echo patch -s -f -R -p1 -i ../backports/$$i; \
		patch -s -f -R -p1 -i ../backports/$$i || break; \
	done; \
	rm -f .patches_applied; fi

download:
	wget $(LATEST_TAR_MD5) -O linux-media.tar.bz2.md5.tmp

	@if [ "`cat linux-media.tar.bz2.md5.tmp`" != "`cat linux-media.tar.bz2.md5`" ]; then \
		wget $(LATEST_TAR) -O linux-media.tar.bz2; \
		mv linux-media.tar.bz2.md5.tmp linux-media.tar.bz2.md5; \
	fi

Privacy Policy