##############################################################################
# (C) Copyright Metanoia All rights reserved.
# File:         $Workfile$
# Revision:     $Revision: 1.24 $
# Date:         $Date: 2012-05-23 12:44:13 $
#
# Overview:     
# Functions:
#
# Author:       Ian
# -- Metanoia Copyright Notice --
#
# (C) Copyright 2005 Metanoia, Inc. All rights reserved.
# 
# Metanoia reserves the right to change specifications without notice. 
# Copyright 2005 Metanoia, Inc. All rights reserved. Preliminary Data-Sheet 
# indicates this product is in design and the specification may change. 
# Electrical parametrics have not been analyzed and are not specified. Do not 
# use this data sheet as a design reference document. Please contact Metanoia 
# for a current data sheet that may be used as a design reference. All 
# contents of this document are protected by copyright law and may not be 
# reproduced without the express written consent of Metanoia, Inc. Metanoia, 
# the Metanoia logo, and combinations thereof are trademarks of Metanoia, Inc. 
# Other product names used in this publication are for identification purposes 
# only and may be trademarks or registered trademarks of their respective 
# companies. The contents of this document are provided in connection with 
# Metanoia, Inc. products. Metanoia, Inc. has made best efforts to ensure that 
# the information contained herein is accurate and reliable. However, Metanoia, 
# Inc. makes no warranties, express or implied, as to the accuracy or 
# completeness of the contents of this publication and is providing this 
# publication 'as is'. Metanoia, Inc. reserves the right to make changes to 
# specifications and product descriptions at any time without notice, and to 
# discontinue or make changes to its products at any time without notice. 
# Metanoia, Inc. does not assume any liability arising out of the application 
# or use of any product or circuit, and specifically disclaims any and all 
# liability, including without limitation special, consequential, or 
# incidental damages.
#
##############################################################################
#CROSS = arm-linux-
#CC = $(CROSS)gcc
#LD = $(CROSS)ld

all: star
#	make -f Makefile.tool clean;
#	make -f Makefile.tool;

pre:
	echo "#define xDSL_VERSION \"1.3\"" > driver/maketime.h
	echo "#define MAKETIME \"`date +%Y%m%d%H%M`\"" >> driver/maketime.h

.PHONY: clean x-clean star-clean

atheros: pre
	make clean; \
	echo "include $(PWD)/driver/Makefile.merlin_2_6_atheros" > driver/Makefile
	cd cli; \
	make -f Makefile.merlinuser_atheros clean; \
	make -f Makefile.merlinuser_atheros; \
	cd ../driver; \
	make clean; \
	make KBUILD_VERBOSE=1;

openwrt: pre
	make clean; \
	echo "include $(PWD)/driver/Makefile.merlin_2_6_openwrt" > driver/Makefile
	cd cli; \
	make -f Makefile.merlinuser_openwrt clean; \
	make -f Makefile.merlinuser_openwrt; \
	cd ../driver; \
	make clean; \
	make KBUILD_VERBOSE=1;

icplus: pre
	make clean; \
	echo "include $(PWD)/driver/Makefile.merlin_2_6_icplus" > driver/Makefile
	cd cli; \
	make -f Makefile.merlinuser_icplus clean; \
	make -f Makefile.merlinuser_icplus; \
	cd ../driver; \
	make clean; \
	make KBUILD_VERBOSE=1;

rt3052: pre
	make clean; \
	echo "include $(PWD)/driver/Makefile.merlin_2_6_rt3052" > driver/Makefile
	cd cli; \
	make -f Makefile.merlinuser_rt3052 clean; \
	make -f Makefile.merlinuser_rt3052; \
	cd ../driver; \
	make clean; \
	make KBUILD_VERBOSE=1;

rt3352: pre
	make clean; \
	echo "include $(PWD)/driver/Makefile.merlin_2_6_rt3352" > driver/Makefile
	cd cli; \
	make -f Makefile.merlinuser_rt3352 clean; \
	make -f Makefile.merlinuser_rt3352; \
	cd ../driver; \
	make clean; \
	make KBUILD_VERBOSE=1;

realtek: pre
	make clean; \
	echo "include $(PWD)/driver/Makefile.merlin_2_6_realtek" > driver/Makefile
	cd cli; \
	make -f Makefile.merlinuser_realtek clean; \
	make -f Makefile.merlinuser_realtek; \
	cd ../driver; \
	make clean; \
	make KBUILD_VERBOSE=1;

star: pre
	make clean; \
	cd cli; \
	make -f Makefile.merlinuser_star; \
	cd ../driver; \
	make -f Makefile.merlin_2_4_star clean; \
	make -f Makefile.merlin_2_4_star; \
	make -f Makefile.merlinboard clean; \
	make -f Makefile.merlinboard;

vitess: pre
	make clean; \
	echo "include $(PWD)/driver/Makefile.merlin_2_6_vitess" > driver/Makefile
	cd cli; \
	make -f Makefile.merlinuser_vitess clean; \
	make -f Makefile.merlinuser_vitess ARCH=arm; \
	cd ../driver; \
	make clean; \
	make KBUILD_VERBOSE=1 ARCH=arm CC=arm-linux-uclibc-gcc LD=arm-linux-uclibc-ld;

via8: pre
	make clean; \
	cd cli; \
	make -f Makefile.via8user; \
	cd ../driver; \
	make -f Makefile.via8 clean; \
	make -f Makefile.via8; \
	make -f Makefile.viaboard clean; \
	make -f Makefile.viaboard;

via24: pre
	make clean; \
	cd cli; \
	make -f Makefile.via24user; \
	cd ../driver; \
	make -f Makefile.via24 clean; \
	make -f Makefile.via24; \
	make -f Makefile.viaboard clean; \
	make -f Makefile.viaboard;

hope: pre
	make clean; \
	cd cli; \
	make -f Makefile.hopeuser; \
	cd ../driver; \
	make -f Makefile.hope clean; \
	make -f Makefile.hope; \
	make -f Makefile.hopeboard clean; \
	make -f Makefile.hopeboard;

x: pre 
	make clean; \
	cd cli; \
	make -f Makefile.xuser; \
	cd ../driver; \
	make -f Makefile.x clean; \
	make -f Makefile.x; \
	make -f Makefile.hopeboard clean; \
	make -f Makefile.hopeboard;

romfs:
	$(ROMFSINST) /bin/bset
	$(ROMFSINST) /bin/dslcli
	$(ROMFSINST) /bin/vdsl.ko
	$(ROMFSINST) /bin/board.ko

clean:
	-rm -f dslcli *.ko *.so *.gdb bset pg
	-rm -f cli/*.elf cli/*.gdb cli/*.o driver/*.elf driver/*.gdb driver/*.o driver/*.ko driver/*.mod.c driver/.*.cmd driver/*.symvers
	-rm -rf driver/.tmp_versions driver/modules.order
	-rm -rf html latex
