###############################################################################
# This file is part of the IPCop Firewall.                                    #
#                                                                             #
# IPCop is free software; you can redistribute it and/or modify               #
# it under the terms of the GNU General Public License as published by        #
# the Free Software Foundation; either version 2 of the License, or           #
# (at your option) any later version.                                         #
#                                                                             #
# IPCop is distributed in the hope that it will be useful,                    #
# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
# GNU General Public License for more details.                                #
#                                                                             #
# You should have received a copy of the GNU General Public License           #
# along with IPCop; if not, write to the Free Software                        #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA    #
#                                                                             #
# Makefiles are based on LFSMake, which is                                    #
# Copyright (C) 2002 Rod Roard <rod@sunsetsystems.com>                        #
#                                                                             #
# Modifications by:                                                           #
# ??-12-2003 Mark Wormgoor < mark@wormgoor.com>                               #
#          - Modified Makefile for IPCop build                                #
#                                                                             #
# $Id: binary-firmware-all 3271 2009-07-19 11:35:07Z owes $
#                                                                             #
###############################################################################

###############################################################################
# Definitions
###############################################################################

include Config

PKG_NAME   = binary-firmware-all
HOST_ARCH  = all
OTHER_SRC  = yes

THISAPP    = binary-firmware-all
DIR_APP    = $(DIR_SRC)/$(THISAPP)
TARGET     = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)

###############################################################################
# Top-level Rules
###############################################################################

objects =	ql2100_fw.bin \
		ql2200_fw.bin \
		ql2300_fw.bin \
		ql2322_fw.bin \
		ql2400_fw.bin \
		ql2500_fw.bin \
		LICENSE.qlogic

ql2100_fw.bin		= ftp://ftp.qlogic.com/outgoing/linux/firmware/ql2100_fw.bin
ql2200_fw.bin		= ftp://ftp.qlogic.com/outgoing/linux/firmware/ql2200_fw.bin
ql2300_fw.bin		= ftp://ftp.qlogic.com/outgoing/linux/firmware/ql2300_fw.bin
ql2322_fw.bin		= ftp://ftp.qlogic.com/outgoing/linux/firmware/ql2322_fw.bin
ql2400_fw.bin		= ftp://ftp.qlogic.com/outgoing/linux/firmware/ql2400_fw.bin
ql2500_fw.bin		= ftp://ftp.qlogic.com/outgoing/linux/firmware/ql2500_fw.bin
LICENSE.qlogic		= ftp://ftp.qlogic.com/outgoing/linux/firmware/LICENSE

ql2100_fw.bin_MD5	= 12c35a92429131323f9ed2764fc457df
ql2200_fw.bin_MD5	= 44567f365ce6f668c69c6c40279cd878
ql2300_fw.bin_MD5	= abf204379bae8763b0a2b4a3c56f04ea
ql2322_fw.bin_MD5	= aa544c7712fe24c78f26e02d4f57893b
ql2400_fw.bin_MD5	= 067a92cabbf4d22761c5f4be3e98d5eb
ql2500_fw.bin_MD5	= d015e2a7e9f171e6158f9dc8b54499a0
LICENSE.qlogic_MD5	= 4005328a134054f0fa077bdc37aa64f2

install : $(TARGET)

check : $(patsubst %,$(DIR_CHK)/%,$(objects))

download :$(patsubst %,$(DIR_DL)/%,$(objects))

md5 : $(subst %,%_MD5,$(objects))

###############################################################################
# Downloading, checking, md5sum
###############################################################################

$(patsubst %,$(DIR_CHK)/%,$(objects)) :
	@$(CHECK)

$(patsubst %,$(DIR_DL)/%,$(objects)) :
	@$(LOAD)

$(subst %,%_MD5,$(objects)) :
	@$(MD5)

###############################################################################
# Installation Details
###############################################################################

$(TARGET) : $(firstword $(MAKEFILE_LIST)) $(patsubst %,$(DIR_DL)/%,$(objects))
	@$(PREBUILD)

	install -m 0644 --owner=root --group=root $(DIR_DL)/ql2100_fw.bin /lib/firmware/
	install -m 0644 --owner=root --group=root $(DIR_DL)/ql2200_fw.bin /lib/firmware/
	install -m 0644 --owner=root --group=root $(DIR_DL)/ql2300_fw.bin /lib/firmware/
	install -m 0644 --owner=root --group=root $(DIR_DL)/ql2322_fw.bin /lib/firmware/
	install -m 0644 --owner=root --group=root $(DIR_DL)/ql2400_fw.bin /lib/firmware/
	install -m 0644 --owner=root --group=root $(DIR_DL)/ql2500_fw.bin /lib/firmware/
	install -m 0644 --owner=root --group=root $(DIR_DL)/LICENSE.qlogic /lib/firmware/

	@$(POSTBUILD)
