summaryrefslogtreecommitdiff
path: root/v4l/firmware/Makefile
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-04-23 15:23:30 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-04-23 15:23:30 -0300
commit2da45c822154d03cd7db86ac11b52385f1fac384 (patch)
tree3c468c31a4211fffc6089f30f71b37196be00ed5 /v4l/firmware/Makefile
parenteea5e74da6f8c1ca2b0670f75c16c690808ce023 (diff)
downloadmediapointer-dvb-s2-2da45c822154d03cd7db86ac11b52385f1fac384.tar.gz
mediapointer-dvb-s2-2da45c822154d03cd7db86ac11b52385f1fac384.tar.bz2
building system: improve firmware creation
From: Mauro Carvalho Chehab <mchehab@redhat.com> This is a major rewrite at v4l/firmware/Makefile: It will now create firmwares only if they don't exist yet, or if the firmware "source" file were touched. Also, use implicit rules instead of explicit, in order to simplify the file. Now, just one line should be modified if a new firmware is added. Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'v4l/firmware/Makefile')
-rw-r--r--v4l/firmware/Makefile43
1 files changed, 26 insertions, 17 deletions
diff --git a/v4l/firmware/Makefile b/v4l/firmware/Makefile
index 6c6e88ed2..c8b0e0578 100644
--- a/v4l/firmware/Makefile
+++ b/v4l/firmware/Makefile
@@ -1,11 +1,16 @@
-DIRS = vicam dabusb ttusb-budget cpia2 av7110
TARGETS = vicam/firmware.fw dabusb/firmware.fw dabusb/bitstream.bin ttusb-budget/dspbootcode.bin cpia2/stv0672_vp4.bin av7110/bootcode.bin
FW_DIR = /lib/firmware
####
+DIRS = $(sort $(dir $(TARGETS)))
+
+.PHONY = default clean distclean install rminstall prep
+
default: $(TARGETS)
+$(TARGETS):: ihex2fw
+
clean:
-rm -f ihex2fw
-rm -f $(TARGETS)
@@ -13,6 +18,7 @@ clean:
distclean: clean
-for i in $(DIRS); do if [ -d $$i ]; then rm -rf $$i; fi; done
+
install: default
@echo -n "Installing firmwares at $(FW_DIR): "
-@for i in $(DIRS); do if [ ! -d $(FW_DIR)/$$i ]; then mkdir -p $(FW_DIR)/$$i; fi; done
@@ -25,33 +31,36 @@ rminstall:
######
-mkdir::
- -@for i in $(DIRS); do if [ ! -d $$i ]; then mkdir -p $$i; fi; done
-
ihex2fw: ../../linux/firmware/ihex2fw.c
@echo " CC $@"
@gcc -Wall -o $@ $<
-vicam/firmware.fw: ../../linux/firmware/vicam/firmware.H16 mkdir ihex2fw
+prep:
+ @for i in $(DIRS); do \
+ if [ ! -d $$i ]; then mkdir -p $$i; fi; \
+ for j in ../../linux/firmware/$$i/*; do \
+ n=`echo $$j | sed s,../../linux/firmware/,,`; \
+ if [ ! -e $$n ]; then \
+ ln -f $$j $$n; \
+ fi; \
+ done; done
+
+%.fw: %.H16
@echo Generating $@
@./ihex2fw -w $< $@
-dabusb/firmware.fw: ../../linux/firmware/dabusb/firmware.HEX mkdir ihex2fw
+%.fw: %.HEX
@echo Generating $@
@./ihex2fw $< $@
-ttusb-budget/dspbootcode.bin: ../../linux/firmware/ttusb-budget/dspbootcode.bin.ihex mkdir
+%.bin: %.bin.ihex
@echo Generating $@
@objcopy -Iihex -Obinary $< $@
-dabusb/bitstream.bin: ../../linux/firmware/dabusb/bitstream.bin.ihex mkdir
- @echo Generating $@
- @objcopy -Iihex -Obinary $< $@
-
-cpia2/stv0672_vp4.bin: ../../linux/firmware/cpia2/stv0672_vp4.bin.ihex mkdir
- @echo Generating $@
- @objcopy -Iihex -Obinary $< $@
+# TODO: Use the Firmware Kconfig dependencies
+#fw-$(CONFIG_USB_VICAM) += vicam/firmware.fw
+#fw-$(CONFIG_USB_DABUSB) += dabusb/firmware.fw dabusb/bitstream.bin
+#fw-$(CONFIG_DVB_TTUSB_BUDGET) += ttusb-budget/dspbootcode.bin
+#fw-$(CONFIG_VIDEO_CPIA2) += cpia2/stv0672_vp4.bin
+#fw-$(CONFIG_DVB_AV7110) += av7110/bootcode.bin
-av7110/bootcode.bin: ../../linux/firmware/av7110/bootcode.bin.ihex mkdir
- @echo Generating $@
- @objcopy -Iihex -Obinary $< $@