1#
2# Toplevel Makefile for the BCM947xx Linux Router release
3#
4# Copyright (C) 2013, Broadcom Corporation. All Rights Reserved.
5# 
6# Permission to use, copy, modify, and/or distribute this software for any
7# purpose with or without fee is hereby granted, provided that the above
8# copyright notice and this permission notice appear in all copies.
9# 
10# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
13# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
15# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17#
18# $Id: toplevel-release.mk 348308 2012-08-01 10:21:21Z $
19#
20
21SRCBASE := $(shell pwd)
22RELEASEDIR := $(shell (cd $(SRCBASE)/.. && pwd -P))
23ARCH ?= mips
24PLT ?= mipsel
25
26ifeq ($(PLT),arm)
27ARCH = arm
28endif
29
30install: all
31	install -d $(RELEASEDIR)/image
32	$(MAKE) -C router install PLT=$(PLT)
33	#-cp router/mipsel/linux.trx $(RELEASEDIR)/image/linux-glibc.trx
34	#-cp router/mipsel-uclibc/linux.trx $(RELEASEDIR)/image/linux.trx
35	-cp router/mipsel-uclibc/linux-lzma.trx $(RELEASEDIR)/image/linux-lzma.trx
36	-cp router/mipsel-uclibc/linux.bin $(RELEASEDIR)/image/linux.bin
37	#-cp dongle/rte/wl/builds/4322-bmac-usbap/roml-ag-nodis/rtecdc.exe $(RELEASEDIR)/image/rtecdc-4323.exe
38	#-cp dongle/rte/wl/builds/43236-bmac-usbap/roml-ag-nodis/rtecdc.exe $(RELEASEDIR)/image/rtecdc-43236.exe
39ifneq ($(wildcard cfe),)
40	cp cfe/build/broadcom/bcm947xx/cfe.bin $(RELEASEDIR)/image/
41	cp cfe/build/broadcom/bcm947xx/compressed/cfez.bin $(RELEASEDIR)/image/
42ifneq ($(PLT),arm)
43	# Clean and make one more time linked at 3MB
44	$(MAKE) -C cfe clean
45	$(MAKE) -C cfe CFG_TEXT_START=0x80300000
46	cp cfe/build/broadcom/bcm947xx/cfe.bin $(RELEASEDIR)/image/cfe4.bin
47	cp cfe/build/broadcom/bcm947xx/compressed/cfez.bin $(RELEASEDIR)/image/cfez4.bin
48	# Clean and make one more time with GigE
49	$(MAKE) -C cfe clean
50	$(MAKE) -C cfe CFG_PCI=1
51	cp cfe/build/broadcom/bcm947xx/cfe.bin $(RELEASEDIR)/image/cfe-gige.bin
52	cp cfe/build/broadcom/bcm947xx/compressed/cfez.bin $(RELEASEDIR)/image/cfez-gige.bin
53	# Clean and make one more time with GMAC
54	$(MAKE) -C cfe clean
55	$(MAKE) -C cfe CFG_GMAC=1
56	cp cfe/build/broadcom/bcm947xx/cfe.bin $(RELEASEDIR)/image/cfe-gmac.bin
57	cp cfe/build/broadcom/bcm947xx/compressed/cfez.bin $(RELEASEDIR)/image/cfez-gmac.bin
58	cp cfe/build/chipimages/bcm5357/cfe_script.cfesh $(RELEASEDIR)/image/
59endif
60	# Clean and make one more time with NFLASH
61	$(MAKE) -C cfe ARCH=$(ARCH) clean
62	$(MAKE) -C cfe ARCH=$(ARCH) CFG_GMAC=1 CFG_NFLASH=1
63	cp cfe/build/broadcom/bcm947xx/cfe.bin $(RELEASEDIR)/image/cfe-nflash.bin
64	cp cfe/build/broadcom/bcm947xx/compressed/cfez.bin $(RELEASEDIR)/image/cfez-nflash.bin
65endif
66	cp shared/nvram/*.txt $(RELEASEDIR)/image/
67
68all clean:
69	$(MAKE) -C router $@ PLT=$(PLT)
70ifneq ($(wildcard cfe),)
71	$(MAKE) -C cfe $@ ARCH=$(ARCH)
72endif
73
74.PHONY: all clean install
75