#
# COPYRIGHT NOTICE
# Copyright (c) Alteon Networks, Inc. 1996
# All rights reserved
#
# HISTORY
# $Log: Makefile $
# Revision api12_3_ted/2 1999/08/12 21:07:39 ted
# 	Add assembler routines
# 
# Revision snap_ted/4 1999/03/25 21:42:48 ted
# 	Use special ldscript for building firmware
# 
# Revision snap_ted/2 1999/03/24 00:09:21 ted
# 	Allow firmware build on x86 solaris
# 
# Revision 1.1.2.10  1998/05/01  02:01:07  tibor
# 	updated to use new genfw
# 	[1998/05/01  01:40:55  tibor]
#
# Revision 1.1.2.9  1998/04/24  00:00:28  hayes
# 	added -fno-buildin to eliminate warning from mem.c
# 	[1998/04/23  23:57:39  hayes]
# 
# Revision 1.1.2.8  1998/03/26  01:34:18  shuang
# 	Added -DSCRATCH_PAD_STACK_ADJUST=1
# 	[1998/03/26  01:22:11  shuang]
# 
# 	Added -iSCRATCH_PAD_STACK_ADJUST
# 	[1998/03/26  01:04:26  shuang]
# 
# Revision 1.1.2.7  1998/03/04  22:28:34  hayes
# 	enable scratchpad usage, uncluding stats refreesh
# 	[1998/03/04  22:19:45  hayes]
# 
# Revision 1.1.2.6  1998/02/24  23:55:43  shuang
# 	Create mcast.h mcast.c for multicast functions
# 	[1998/02/24  23:51:13  shuang]
# 
# Revision 1.1.2.5  1998/02/11  19:11:17  ted
# 	Remove scratchpad support because of broken stats reset
# 	[1998/02/11  18:37:29  ted]
# 
# Revision 1.1.2.4  1998/01/29  19:37:15  ted
# 	Use -N instead of -Tdata parm
# 	[1998/01/29  19:23:46  ted]
# 
# Revision 1.1.2.3  1998/01/20  17:12:59  ted
# 	Fix up bolluxes from previous submission
# 	[1998/01/20  17:12:17  ted]
# 
# Revision 1.1.2.2  1998/01/20  04:39:19  hayes
# 	add tigon Rev6 support
# 	[1998/01/20  04:37:52  hayes]
# 
# Revision 1.1.2.1  1998/01/14  23:25:27  ted
# 	rearrange directories
# 	[1998/01/14  23:18:07  ted]
# 
# Revision 1.1.2.6  1997/12/29  19:02:03  hayes
# 	remove event.[c|o], was obsolete
# 	[1997/12/29  18:57:52  hayes]
# 
# Revision 1.1.2.5  1997/12/12  05:34:36  hayes
# 	remove LED6 define from production build
# 	[1997/12/12  04:02:40  hayes]
# 
# Revision 1.1.2.4  1997/12/01  23:39:31  hayes
# 	update for new genfw
# 	[1997/12/01  23:38:48  hayes]
# 
# Revision 1.1.2.3  1997/11/26  01:08:48  hayes
# 	use new LEDs
# 	[1997/11/26  01:07:45  hayes]
# 
# Revision 1.1.2.2  1997/11/21  04:48:13  hayes
# 	release for NIC 2.1 pre-beta
# 	[1997/11/21  03:18:29  hayes]
# 
# Revision 1.1.2.1  1997/11/19  19:22:55  ted
# 	Support Tigon and Tigon2 in the same driver
# 	[1997/11/19  19:18:06  ted]
# 
# Revision 1.9.4.16  1997/11/15  18:38:41  hayes
# 	add support for 6 LEDs
# 	[1997/11/15  18:38:26  hayes]
# 
# Revision 1.9.4.15  1997/11/14  19:16:13  hayes
# 	first checkin after mongo merge...
# 	[1997/11/14  19:15:04  hayes]
# 
# Revision 1.9.4.14  1997/11/11  19:05:51  hayes
# 	restructuring for scratchpad use
# 	[1997/11/11  19:04:07  hayes]
# 
# Revision 1.9.4.13  1997/11/10  23:54:36  hayes
# 	update GENFW, -Tdata
# 	[1997/11/10  23:54:16  hayes]
# 
# Revision 1.9.4.12  1997/10/10  20:44:33  hayes
# 	increase -Tdata again to 0x14000
# 	[1997/10/10  20:44:04  hayes]
# 
# Revision 1.9.4.11  1997/10/10  20:38:38  hayes
# 	increased data address to 0x10000
# 	[1997/10/10  20:36:39  hayes]
# 
# Revision 1.9.4.10  1997/10/03  00:05:50  hayes
# 	general cleanup
# 	add .ss fix so you don't have to do a build clean every time
# 	update make depend feature.
# 	add preprocessing of .s files
# 	[1997/10/03  00:04:37  hayes]
# 
# 	added com_link_if.c
# 	[1997/08/29  22:08:34  hayes]
# 
# Revision 1.9.4.9  1997/08/29  22:12:01  hayes
# 	added com_link_if.c
# 
# Revision 1.9.4.8  1997/08/26  21:09:07  hayes
# 	Add com_mii.c and com_zconf.c
# 	[1997/08/26  21:02:38  hayes]
# 
# Revision 1.9.4.7  1997/08/12  03:58:11  hayes
# 	add com_np.c
# 	[1997/08/12  03:57:53  hayes]
# 
# Revision 1.9.4.6  1997/07/25  22:58:51  ted
# 	Merge fixes from ge_0_22 and add link negotiation support
# 	[1997/07/25  22:31:48  ted]
# 
# Revision 1.9.4.5  1997/07/17  23:24:44  tibor
# 	changed TG_REV to TIGON_REV
# 	[1997/07/17  23:19:44  tibor]
# 
# Revision 1.9.4.4  1997/04/11  23:36:06  ted
# 	Added SBUS flag and changed the Tdata address from 0xf800 to 0xfc00
# 	[1997/04/11  23:03:23  ted]
# 
# Revision 1.9.4.3  1997/03/24  08:34:14  ted
# 	New event ring handling, producer lives in host memory, misc. other more modest changes
# 	[1997/03/24  08:27:31  ted]
# 
# Revision 1.9.4.2  1997/03/01  01:59:16  ted
# 	Move data segment out
# 	[1997/03/01  01:59:01  ted]
# 
# Revision 1.9.4.1  1997/02/08  05:01:21  skapur
# 	Took out simulator flag; For real HW Fun
# 	[1997/02/08  05:01:03  skapur]
# 
# Revision 1.9.2.9  1996/12/05  20:07:01  hayes
# 	Move start.o to head of list so our entry point will not move.
# 	Remove mailbox.o
# 	[1996/12/05  20:06:28  hayes]
# 
# Revision 1.9.2.8  1996/11/29  17:43:17  hayes
# 	Move start to front of .o list so that our entry point will
# 	not change with each recompile.
# 	[1996/11/29  17:42:01  hayes]
# 
# Revision 1.9.2.7  1996/11/20  20:04:13  ted
# 	Add new files to the CLEANFILES list.
# 	Remove BIG_ENDIAN from CDEFS (now ALT_BIG_ENDIAN in alt_def.h).
# 	Redo makedepend.
# 	[1996/11/20  19:48:23  ted]
# 
# Revision 1.9.2.6  1996/11/15  04:23:58  hayes
# 	Fix up for new header structure and <alt.tg1.mk> include.
# 	Add .c.s rule so that intermediate .s files get deleted.
# 	[1996/11/15  04:21:16  hayes]
# 
# Revision 1.9.2.5  1996/11/06  21:03:23  hayes
# 	Remove -DRR from CDEFS.
# 	[1996/11/06  21:03:10  hayes]
# 
# Revision 1.9.2.4  1996/11/06  21:01:56  hayes
# 	Add proper text and data addresses to LD line.
# 	[1996/11/06  21:01:11  hayes]
# 
# Revision 1.9.2.3  1996/11/05  21:59:30  hayes
# 	re-run makedepend...
# 	[1996/11/05  21:59:17  hayes]
# 
# Revision 1.9.2.2  1996/11/05  21:54:12  hayes
# 	Final pre-ODE merge
# 	[1996/11/05  21:51:07  hayes]
# 
# 	Final merge/checkin from private development area to ODE based
# 	development environment.
# 	[1996/11/05  21:48:54  hayes]
# 
# Revision 1.9.2.1  1996/11/01  18:24:43  ted
# 	Buildify the Makefile
# 	[1996/10/30  00:46:43  ted]
# 
# $EndLog$
#

.include <alt.tg1.mk>

INCLUDES	= alt_fw2.h
EXPDIR		= /usr/include/

EXPBIN_DIR	= ${EXPORTBASE}/usr/bin

GENFW		= ${EXPBIN_DIR}/genfw
GENFWFLAGS	= -ptigon2 -h ${SOURCEBASE}/nic/host/common/altreg.h

.if ($(context) == "sparc_solaris")
PICAS		= /projects/public_src/tigon_binutils-2.6/gas/as.pic
.endif

PROGRAMS	= alt_fw2

OPT_LEVEL	= -O3 -g

CDEFS		= -DSBUS=0 -DTRACE=0 -DTRACE_ALL=0 -DUSE_ASM \
		-DFW_PROFILE=0 -DSCRATCH_PAD -DSCRATCH_PAD_STACK_ADJUST=1

CFLAGS		= ${CDEFS} -ansi -Wall -Wshadow -Wstrict-prototypes \
		-Wmissing-prototypes -Wmissing-declarations \
		-Wredundant-decls -fverbose-asm -Winline -mcpu=r4000 \
		-mips2 -mno-abicalls -S -DTIGON_REV=2 -fno-builtin \
		-G 0

AFLAGS		= -mips2 -G 0

INCFLAGS	= -I../../../common -I../../common

OFILES		= start.o disp.o fwmain.o timer.o command.o mcast.o \
		dma.o trace.o data.o mem.o send.o recv.o mac.o cksum.o \
		com_link.o com_np.o com_mii.o com_zconf.o com_link_if.o \
		com_led.o recvasm.o dmaasm.o

CFILES		= fwmain.c timer.c command.c mcast.c \
		dma.c trace.c data.c mem.c send.c recv.c mac.c cksum.c \
		com_link.c com_np.c com_mii.c com_zconf.c com_link_if.c \
		com_led.c

GENNED_HDRS	= compile.h

#
# override the defauls for clean and clobber
#
CLEANFILES	= *.list *.ss alt_fw2.map ${DFILES} \
		${.CURDIR}/compile.h ${OFILES}

.if defined(PROGRAMS)

${PROGRAMS}: $${_OFILES_}
	${_LD_} ${_LDFLAGS_} -o ${.TARGET}.X ${_OFILES_} ${_LIBS_} \
		-T ${SOURCEBASE}/nic/fw2/common/alteon.x
	${MV} ${.TARGET}.X ${.TARGET}
	${SIZE} ${.TARGET} > ${.TARGET}.map
	${NM} ${.TARGET} | sort >> ${.TARGET}.map

.endif

.include <${RULES_MK}>

alt_fw2.h: alt_fw2
	${GENFW} ${GENFWFLAGS} ${.PREFIX} ${.TARGET}

.if ($(context) == "sparc_solaris")
.c.o:
	${_CC_} -o `basename ${.TARGET} .o`.ss ${_CCFLAGS_} ${.IMPSRC}
	${PICAS} ${AFLAGS} -o ${.TARGET} -L -a=`basename ${.TARGET} \
		.o`.list `basename ${.TARGET} .o`.ss 
	${RM} `basename ${.TARGET} .o`.ss
.elif ($(context) == "i386_solaris")
.c.o:
	${_CC_} -o `basename ${.TARGET} .o`.ss ${_CCFLAGS_} ${.IMPSRC}
	${AS} ${AFLAGS} -APIC -o ${.TARGET} -L -a=`basename ${.TARGET} \
		.o`.list `basename ${.TARGET} .o`.ss 
	${RM} `basename ${.TARGET} .o`.ss
.endif

.s.o:
	${_CC_} -x assembler-with-cpp -E -o `basename ${.TARGET} .o`.ss \
		${_CCFLAGS_} ${.IMPSRC}
	${AS} ${AFLAGS} -o ${.TARGET} -L -a=`basename ${.TARGET} .o`.list \
		`basename ${.TARGET} .o`.ss
	${RM} `basename ${.TARGET} .o`.ss

.include <alt.compile.mk>

data.o: ${GENNED_HDRS}

.include <alt.depend.mk>

