From 2ad53e84e9929625f8eadf59e5b76f85f59df094 Mon Sep 17 00:00:00 2001 From: file Date: Mon, 12 Feb 2007 23:13:39 +0000 Subject: Add hotplug-uninstall target to main Makefile and make the firmware Makefile keep a record of the installed firmware in the hotplug directory. This means that as long as you have the latest version of firmware installed your checkout will never install it again, and all new checkouts will not either. This might also help those building packages for distros. git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@2158 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- firmware/Makefile | 74 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 63 insertions(+), 11 deletions(-) (limited to 'firmware') diff --git a/firmware/Makefile b/firmware/Makefile index 9d4efaf..d6821a7 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -58,11 +58,69 @@ have_download: exit 1; \ fi -# Download and extract firmware tarball -zaptel-fw-%.tar.gz: have_download - @if test ! -f $@; then $(DOWNLOAD) $(WGET_ARGS) $(FIRMWARE_URL)/$@; fi; +# Download and extract firmware tarballs +zaptel-fw-oct6114-064-%.tar.gz: have_download +ifeq ($(shell if ( [ "$(HOTPLUG_FIRMWARE)" == "no" ] ) || ( [ -d $(INSTALL_PREFIX)/usr/lib/hotplug/firmware ] && ! [ -f $(INSTALL_PREFIX)/usr/lib/hotplug/firmware/.zaptel-fw-oct6114-064-$(OCT6114_064_VERSION) ] ) || ( [ -d $(INSTALL_PREFIX)/lib/firmware ] && ! [ -f $(INSTALL_PREFIX)/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 -) +ifeq ($(HOTPLUG_FIRMWARE),yes) + @echo "Installing zaptel-fw-oct6114-064.bin to hotplug firmware directories" + if [ -d $(INSTALL_PREFIX)/usr/lib/hotplug/firmware ]; then \ + $(INSTALL) -m 644 zaptel-fw-oct6114-064.bin $(INSTALL_PREFIX)/usr/lib/hotplug/firmware; \ + touch $(INSTALL_PREFIX)/usr/lib/hotplug/firmware/.zaptel-fw-oct6114-064-$(OCT6114_064_VERSION); \ + fi + if [ -d $(INSTALL_PREFIX)/lib/firmware ]; then \ + $(INSTALL) -m 644 zaptel-fw-oct6114-064.bin $(INSTALL_PREFIX)/lib/firmware; \ + touch $(INSTALL_PREFIX)/lib/firmware/.zaptel-fw-oct6114-064-$(OCT6114_064_VERSION); \ + fi +endif +else + @echo "Firmware zaptel-fw-oct6114-064.bin is already installed with latest version $(OCT6114_064_VERSION)" +endif + +zaptel-fw-oct6114-128-%.tar.gz: have_download +ifeq ($(shell if ( [ "$(HOTPLUG_FIRMWARE)" == "no" ] ) || ( [ -d $(INSTALL_PREFIX)/usr/lib/hotplug/firmware ] && ! [ -f $(INSTALL_PREFIX)/usr/lib/hotplug/firmware/.zaptel-fw-oct6114-128-$(OCT6114_128_VERSION) ] ) || ( [ -d $(INSTALL_PREFIX)/lib/firmware ] && ! [ -f $(INSTALL_PREFIX)/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 -) +ifeq ($(HOTPLUG_FIRMWARE),yes) + @echo "Installing zaptel-fw-oct6114-128.bin to hotplug firmware directories" + if [ -d $(INSTALL_PREFIX)/usr/lib/hotplug/firmware ]; then \ + $(INSTALL) -m 644 zaptel-fw-oct6114-128.bin $(INSTALL_PREFIX)/usr/lib/hotplug/firmware; \ + touch $(INSTALL_PREFIX)/usr/lib/hotplug/firmware/.zaptel-fw-oct6114-128-$(OCT6114_128_VERSION); \ + fi + if [ -d $(INSTALL_PREFIX)/lib/firmware ]; then \ + $(INSTALL) -m 644 zaptel-fw-oct6114-128.bin $(INSTALL_PREFIX)/lib/firmware; \ + touch $(INSTALL_PREFIX)/lib/firmware/.zaptel-fw-oct6114-128-$(OCT6114_128_VERSION); \ + fi +endif +else + @echo "Firmware zaptel-fw-oct6114-128.bin is already installed with latest version $(OCT6114_128_VERSION)" +endif + +zaptel-fw-tc400m-%.tar.gz: have_download +ifeq ($(shell if ( [ "$(HOTPLUG_FIRMWARE)" == "no" ] ) || ( [ -d $(INSTALL_PREFIX)/usr/lib/hotplug/firmware ] && ! [ -f $(INSTALL_PREFIX)/usr/lib/hotplug/firmware/.zaptel-fw-tc400m-$(TC400M_VERSION) ] ) || ( [ -d $(INSTALL_PREFIX)/lib/firmware ] && ! [ -f $(INSTALL_PREFIX)/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 -) +ifeq ($(HOTPLUG_FIRMWARE),yes) + @echo "Installing zaptel-fw-tc400m.bin to hotplug firmware directories" + if [ -d $(INSTALL_PREFIX)/usr/lib/hotplug/firmware ]; then \ + $(INSTALL) -m 644 zaptel-fw-tc400m.bin $(INSTALL_PREFIX)/usr/lib/hotplug/firmware; \ + touch $(INSTALL_PREFIX)/usr/lib/hotplug/firmware/.zaptel-fw-tc400m-$(TC400M_VERSION); \ + fi + if [ -d $(INSTALL_PREFIX)/lib/firmware ]; then \ + $(INSTALL) -m 644 zaptel-fw-tc400m.bin $(INSTALL_PREFIX)/lib/firmware; \ + touch $(INSTALL_PREFIX)/lib/firmware/.zaptel-fw-tc400m-$(TC400M_VERSION); \ + fi +endif +else + @echo "Firmware zaptel-fw-tc400m.bin is already installed with latest version $(TC400M_VERSION)" +endif # Clean up any downloaded/extracted firmware packages dist-clean: clean @@ -78,22 +136,16 @@ object-build: $(FIRMWARE) $(OBJECT_FILES) # Install all downloaded firmware images for hotplug usage and build headers for inclusion hotplug-install: $(FIRMWARE) -ifneq (,$(FIRMWARE)) - if [ -d $(INSTALL_PREFIX)/usr/lib/hotplug/firmware ]; then \ - $(INSTALL) -m 644 zaptel-fw-*.bin $(INSTALL_PREFIX)/usr/lib/hotplug/firmware; \ - fi - if [ -d $(INSTALL_PREFIX)/lib/firmware ]; then \ - $(INSTALL) -m 644 zaptel-fw-*.bin $(INSTALL_PREFIX)/lib/firmware; \ - fi -endif # Uninstall any installed zaptel firmware images from hotplug firmware directories hotplug-uninstall: if [ -d $(INSTALL_PREFIX)/usr/lib/hotplug/firmware ]; then \ rm -f $(INSTALL_PREFIX)/usr/lib/hotplug/firmware/zaptel-fw-*.bin; \ + rm -f $(INSTALL_PREFIX)/usr/lib/hotplug/firmware/.zaptel-fw*; \ fi if [ -d $(INSTALL_PREFIX)/lib/firmware ]; then \ rm -f $(INSTALL_PREFIX)/lib/firmware/zaptel-fw-*.bin; \ + rm -f $(INSTALL_PREFIX)/lib/firmware/.zaptel-fw*; \ fi # Build object file of an oct6114 064 firmware image for linking -- cgit v1.2.3