From 9f7b0fba0a05b4a23f069bb48740296aa139fd63 Mon Sep 17 00:00:00 2001 From: kpfleming Date: Tue, 19 Aug 2008 20:45:18 +0000 Subject: even more improvements in firmware Makefile git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@4493 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- firmware/Makefile | 112 +++++++++++++++++++++--------------------------------- 1 file changed, 44 insertions(+), 68 deletions(-) diff --git a/firmware/Makefile b/firmware/Makefile index f91afcd..710572d 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -49,6 +49,15 @@ endif all: $(FIRMWARE) +# Clean up any downloaded/extracted firmware packages +dist-clean: clean + rm -f zaptel-fw-*.bin + rm -f zaptel-fw-*.tar.gz + +# Clean up anything we built +clean: + rm -f zaptel-fw-*.o + have_download: @if test "$(DOWNLOAD)" = ":" ; then \ echo "**************************************************"; \ @@ -62,46 +71,13 @@ have_download: fi # Download and extract firmware tarballs -zaptel-fw-oct6114-064-$(OCT6114_064_VERSION).tar.gz: have_download -ifeq ($(shell if ( [ "$(HOTPLUG_FIRMWARE)" = "no" ] ) || ( [ -d $(DESTDIR)/usr/lib/hotplug/firmware ] && ! [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-oct6114-064-$(OCT6114_064_VERSION) ] ) || ( [ -d $(DESTDIR)/lib/firmware ] && ! [ -f $(DESTDIR)/lib/firmware/.zaptel-fw-oct6114-064-$(OCT6114_064_VERSION) ] ); then echo "yes"; else echo "no"; fi),yes) - @echo "Attempting to download $@" - @if test ! -f $@; then $(DOWNLOAD) $(WGET_ARGS) $(FIRMWARE_URL)/$@; fi; - @if test ! -f $@; then exit 1; fi; \ - (cat $@ | gzip -d | tar -xf -) -endif - -zaptel-fw-oct6114-128-$(OCT6114_128_VERSION).tar.gz: have_download -ifeq ($(shell if ( [ "$(HOTPLUG_FIRMWARE)" = "no" ] ) || ( [ -d $(DESTDIR)/usr/lib/hotplug/firmware ] && ! [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-oct6114-128-$(OCT6114_128_VERSION) ] ) || ( [ -d $(DESTDIR)/lib/firmware ] && ! [ -f $(DESTDIR)/lib/firmware/.zaptel-fw-oct6114-128-$(OCT6114_128_VERSION) ] ); then echo "yes"; else echo "no"; fi),yes) - @echo "Attempting to download $@" - @if test ! -f $@; then $(DOWNLOAD) $(WGET_ARGS) $(FIRMWARE_URL)/$@; fi; - @if test ! -f $@; then exit 1; fi; \ - (cat $@ | gzip -d | tar -xf -) -endif - -zaptel-fw-tc400m-$(TC400M_VERSION).tar.gz: have_download -ifeq ($(shell if ( [ "$(HOTPLUG_FIRMWARE)" = "no" ] ) || ( [ -d $(DESTDIR)/usr/lib/hotplug/firmware ] && ! [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-tc400m-$(TC400M_VERSION) ] ) || ( [ -d $(DESTDIR)/lib/firmware ] && ! [ -f $(DESTDIR)/lib/firmware/.zaptel-fw-tc400m-$(TC400M_VERSION) ] ); then echo "yes"; else echo "no"; fi),yes) - @echo "Attempting to download $@" - @if test ! -f $@; then $(DOWNLOAD) $(WGET_ARGS) $(FIRMWARE_URL)/$@; fi; - @if test ! -f $@; then exit 1; fi; \ - (cat $@ | gzip -d | tar -xf -) -endif - -zaptel-fw-vpmadt032-$(VPMADT032_VERSION).tar.gz: have_download -ifeq ($(shell if ( [ "$(HOTPLUG_FIRMWARE)" = "no" ] ) || ( [ -d $(DESTDIR)/usr/lib/hotplug/firmware ] && ! [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-vpmadt032-$(VPMADT032_VERSION) ] ) || ( [ -d $(DESTDIR)/lib/firmware ] && ! [ -f $(DESTDIR)/lib/firmware/.zaptel-fw-vpmadt032-$(VPMADT032_VERSION) ] ); then echo "yes"; else echo "no"; fi),yes) - @echo "Attempting to download $@" - @if test ! -f $@; then $(DOWNLOAD) $(WGET_ARGS) $(FIRMWARE_URL)/$@; fi; - @if test ! -f $@; then exit 1; fi; \ - (cat $@ | gzip -d | tar -xf -) -endif - -# Clean up any downloaded/extracted firmware packages -dist-clean: clean - rm -f zaptel-fw-*.bin - rm -f zaptel-fw-*.tar.gz - -# Clean up anything we built -clean: - rm -f zaptel-fw-*.o +zaptel-fw-%.tar.gz: + @if ( [ "$(HOTPLUG_FIRMWARE)" = "no" ] ) || ( [ -d $(DESTDIR)/usr/lib/hotplug/firmware ] && ! [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.$(subst .tar.gz,,$*) ] ) || ( [ -d $(DESTDIR)/lib/firmware ] && ! [ -f $(DESTDIR)/lib/firmware/.$(subst .tar.gz,,$*) ] ); then \ + echo "Attempting to download $@"; \ + if test ! -f $@; then $(DOWNLOAD) $(WGET_ARGS) $(FIRMWARE_URL)/$@; fi; \ + if test ! -f $@; then exit 1; fi; \ + (cat $@ | gzip -d | tar -xof -) \ + fi # Create object files suitable for linking against object-build: $(FIRMWARE) $(OBJECT_FILES) @@ -111,47 +87,47 @@ $(DESTDIR)/usr/lib/hotplug/firmware $(DESTDIR)/lib/firmware: # Install all downloaded firmware images for hotplug usage hotplug-install: $(DESTDIR)/usr/lib/hotplug/firmware $(DESTDIR)/lib/firmware $(FIRMWARE) -ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-oct6114-064-$(OCT6114_064_VERSION) ] ) || ( [ -f $(DESTDIR)/lib/firmware/.zaptel-fw-oct6114-064-$(OCT6114_064_VERSION) ] ); then echo "yes"; else echo "no"; fi),yes) +ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-oct6114-064-$(OCT6114_064_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.zaptel-fw-oct6114-064-$(OCT6114_064_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes) @echo "Installing zaptel-fw-oct6114-064.bin to hotplug firmware directories" - $(INSTALL) -m 644 zaptel-fw-oct6114-064.bin $(DESTDIR)/usr/lib/hotplug/firmware - rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-oct6114-064-* - touch $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-oct6114-064-$(OCT6114_064_VERSION) - $(INSTALL) -m 644 zaptel-fw-oct6114-064.bin $(DESTDIR)/lib/firmware - rm -rf $(DESTDIR)/lib/firmware/.zaptel-fw-oct6114-064-* - touch $(DESTDIR)/lib/firmware/.zaptel-fw-oct6114-064-$(OCT6114_064_VERSION) + @$(INSTALL) -m 644 zaptel-fw-oct6114-064.bin $(DESTDIR)/usr/lib/hotplug/firmware + @rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-oct6114-064-* + @touch $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-oct6114-064-$(OCT6114_064_VERSION) + @$(INSTALL) -m 644 zaptel-fw-oct6114-064.bin $(DESTDIR)/lib/firmware + @rm -rf $(DESTDIR)/lib/firmware/.zaptel-fw-oct6114-064-* + @touch $(DESTDIR)/lib/firmware/.zaptel-fw-oct6114-064-$(OCT6114_064_VERSION) else @echo "Firmware zaptel-fw-oct6114-064.bin is already installed with required version $(OCT6114_064_VERSION)" endif -ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-oct6114-128-$(OCT6114_128_VERSION) ] ) || ( [ -f $(DESTDIR)/lib/firmware/.zaptel-fw-oct6114-128-$(OCT6114_128_VERSION) ] ); then echo "yes"; else echo "no"; fi),yes) +ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-oct6114-128-$(OCT6114_128_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.zaptel-fw-oct6114-128-$(OCT6114_128_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes) @echo "Installing zaptel-fw-oct6114-128.bin to hotplug firmware directories" - $(INSTALL) -m 644 zaptel-fw-oct6114-128.bin $(DESTDIR)/usr/lib/hotplug/firmware - rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-oct6114-128-* - touch $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-oct6114-128-$(OCT6114_128_VERSION) - $(INSTALL) -m 644 zaptel-fw-oct6114-128.bin $(DESTDIR)/lib/firmware - rm -rf $(DESTDIR)/lib/firmware/.zaptel-fw-oct6114-128-* - touch $(DESTDIR)/lib/firmware/.zaptel-fw-oct6114-128-$(OCT6114_128_VERSION) + @$(INSTALL) -m 644 zaptel-fw-oct6114-128.bin $(DESTDIR)/usr/lib/hotplug/firmware + @rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-oct6114-128-* + @touch $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-oct6114-128-$(OCT6114_128_VERSION) + @$(INSTALL) -m 644 zaptel-fw-oct6114-128.bin $(DESTDIR)/lib/firmware + @rm -rf $(DESTDIR)/lib/firmware/.zaptel-fw-oct6114-128-* + @touch $(DESTDIR)/lib/firmware/.zaptel-fw-oct6114-128-$(OCT6114_128_VERSION) else @echo "Firmware zaptel-fw-oct6114-128.bin is already installed with required version $(OCT6114_128_VERSION)" endif -ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-tc400m-$(TC400M_VERSION) ] ) || ( [ -f $(DESTDIR)/lib/firmware/.zaptel-fw-tc400m-$(TC400M_VERSION) ] ); then echo "yes"; else echo "no"; fi),yes) +ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-tc400m-$(TC400M_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.zaptel-fw-tc400m-$(TC400M_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes) @echo "Installing zaptel-fw-tc400m.bin to hotplug firmware directories" - $(INSTALL) -m 644 zaptel-fw-tc400m.bin $(DESTDIR)/usr/lib/hotplug/firmware - rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-tc400m-* - touch $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-tc400m-$(TC400M_VERSION) - $(INSTALL) -m 644 zaptel-fw-tc400m.bin $(DESTDIR)/lib/firmware - rm -rf $(DESTDIR)/lib/firmware/.zaptel-fw-tc400m-* - touch $(DESTDIR)/lib/firmware/.zaptel-fw-tc400m-$(TC400M_VERSION) + @$(INSTALL) -m 644 zaptel-fw-tc400m.bin $(DESTDIR)/usr/lib/hotplug/firmware + @rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-tc400m-* + @touch $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-tc400m-$(TC400M_VERSION) + @$(INSTALL) -m 644 zaptel-fw-tc400m.bin $(DESTDIR)/lib/firmware + @rm -rf $(DESTDIR)/lib/firmware/.zaptel-fw-tc400m-* + @touch $(DESTDIR)/lib/firmware/.zaptel-fw-tc400m-$(TC400M_VERSION) else @echo "Firmware zaptel-fw-tc400m.bin is already installed with required version $(TC400M_VERSION)" endif -ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-vpmadt032-$(VPMADT032_VERSION) ] ) || ( [ -f $(DESTDIR)/lib/firmware/.zaptel-fw-vpmadt032-$(VPMADT032_VERSION) ] ); then echo "yes"; else echo "no"; fi),yes) +ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-vpmadt032-$(VPMADT032_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.zaptel-fw-vpmadt032-$(VPMADT032_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes) @echo "Installing zaptel-fw-vpmadt032.bin to hotplug firmware directories" - $(INSTALL) -m 644 zaptel-fw-vpmadt032.bin $(DESTDIR)/usr/lib/hotplug/firmware - rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-vpmadt032-* - touch $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-vpmadt032-$(VPMADT032_VERSION) - $(INSTALL) -m 644 zaptel-fw-vpmadt032.bin $(DESTDIR)/lib/firmware - rm -rf $(DESTDIR)/lib/firmware/.zaptel-fw-vpmadt032-* - touch $(DESTDIR)/lib/firmware/.zaptel-fw-vpmadt032-$(VPMADT032_VERSION) + @$(INSTALL) -m 644 zaptel-fw-vpmadt032.bin $(DESTDIR)/usr/lib/hotplug/firmware + @rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-vpmadt032-* + @touch $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-vpmadt032-$(VPMADT032_VERSION) + @$(INSTALL) -m 644 zaptel-fw-vpmadt032.bin $(DESTDIR)/lib/firmware + @rm -rf $(DESTDIR)/lib/firmware/.zaptel-fw-vpmadt032-* + @touch $(DESTDIR)/lib/firmware/.zaptel-fw-vpmadt032-$(VPMADT032_VERSION) else @echo "Firmware zaptel-fw-vpmadt032.bin is already installed with required version $(VPMADT032_VERSION)" endif -- cgit v1.2.3