#
# COPYRIGHT NOTICE
# Copyright (c) Alteon Networks, Inc. 1996
# All rights reserved
#
# HISTORY
# $Log: Makefile $
# 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:22 ted
# 	Allow firmware build on x86 solaris
# 
# Revision 1.1.2.11  1998/07/22  17:28:34  ted
# 	Ensure NDEBUG is off in trace version of firmware
# 	[1998/07/22  17:28:07  ted]
#
# Revision 1.1.2.10  1998/05/01  02:01:08  tibor
# 	updated to use new genfw
# 	[1998/05/01  01:41:01  tibor]
# 
# Revision 1.1.2.9  1998/04/25  01:42:28  shuang
# 	added -fno-builtin to shut off compiler warning from mem.c
# 	[1998/04/25  01:40:30  shuang]
# 
# Revision 1.1.2.8  1998/04/01  22:21:32  hayes
# 	enable scratchpad usage
# 	[1998/04/01  00:58:46  hayes]
# 
# Revision 1.1.2.7  1998/02/25  03:48:38  shuang
# 	Include new file mcast.c
# 	[1998/02/25  03:46:47  shuang]
# 
# Revision 1.1.2.6  1998/02/11  19:11:27  ted
# 	Remove scratchpad support because of broken stats reset
# 	[1998/02/11  18:37:34  ted]
# 
# Revision 1.1.2.5  1998/01/29  19:37:21  ted
# 	Use -N instead of -Tdata parm
# 	[1998/01/29  19:23:53  ted]
# 
# Revision 1.1.2.4  1998/01/29  02:35:09  skapur
# 	Merged with changes from 1.1.2.3
# 	[1998/01/29  02:35:04  skapur]
# 
# 	Changed the size of Tdata
# 	[1998/01/29  02:34:15  skapur]
# 
# Revision 1.1.2.3  1998/01/28  21:27:56  hayes
# 	add STACK_REDZONE define
# 	[1998/01/28  21:26:41  hayes]
# 
# Revision 1.1.2.2  1998/01/20  17:13:01  ted
# 	Add SCRATCH_PAD into CDEFS to match common's Makefile
# 	[1998/01/20  17:12:42  ted]
# 
# Revision 1.1.2.1  1998/01/14  23:26:09  ted
# 	rearrange directories
# 	[1998/01/14  23:22:56  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_trace.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_trace

OPT_LEVEL	= -O3 -g

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

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 -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

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

GENNED_HDRS	= compile.h

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

.PATH: ../common

.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_trace.h: alt_fw2_trace
	${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>

