###
### Simulation of generic queueing network fed by TCP/IP stations
###
### (C) Sam Manthorpe, EPFL, Laboratoire de Reseaux de Communications
### tel: +41 21 693 6749,  email: manthorpe@di.epfl.ch
###
### The development of this work has been funded by Swiss Telecom
### This software may be freely-distributed providing that this message
### remains intact and under the understanding that it is distributed
### with absolutly NO WARRANTY.  Please see README for details.
###
### Version: 2.4.0
### Date: 29th April 1996
###
### makefile
###

CC = pgcc

#SIMTRACE      =  -D_DEBUG_TESTS -D_STCP_DEBUG -D_SIM_TRACE -D_SIM_TRACE_L2
#SIMTRACE      =  -D_DEBUG_TESTS -g
SIMTRACE      = 

SSIM	      = $(STCPDIR)/ssim

STCP	      =	.

# _LINUX	for Linux
# _SPARC	for Sparc platforms
# _PENTIUM	for Pentium platforms
# KERNEL	should be set

# To avoid different results from simulation on different architectures,
# using the -ffloat-store option here.  See gcc man pages for details.

# FLOATS	      =	-ffloat-store

# COMPLAGS must contain:	ansi
#				__STDC__
#				inline
#				KERNEL
# and may optionally contain:	_PENTIUM
#				_SPARC
#				_LINUX

# -gstabs+

OPTIM =		-mpentium \
		-O \
#		-mstack-align-double \
#		-funroll-all-loops \
#		-fomit-frame-pointer \
#		-malign-double

COMPFLAGS     = -ansi -Wall -Wshadow -Wpointer-arith \
		-Wstrict-prototypes -Wmissing-prototypes \
		-D__STDC__ $(SIMTRACE) -Dinline= -DKERNEL -D_PENTIUM \
		-D_LINUX -I$(SSIM) $(FLOATS) $(OPTIM)

CFLAGS	      = -Isys -Ilibkern $(BLINCLINK) $(COMPFLAGS)
PFLAGS	      = -Isys -Ilibkern $(BLINCLINK) $(COMPFLAGS)
FFLAGS	      = -Isys -Ilibkern $(BLINCLINK) $(COMPFLAGS)
CCFLAGS       = $(COMPFLAGS)
CXXFLAGS      = -Isys -Ilibkern $(BLINCLINK) $(COMPFLAGS)

DEST	      = .

# Uncomment this if you want system header files to be expanded
#
# SYSHDRS       =

EXTHDRS	      = libkern/sam_libkern.h \
		sys/sam_cdefs.h \
		sys/sam_cdefs.h \
		sys/sam_cpufunc.h \
		sys/sam_errno.h \
		sys/sam_errno.h \
		sys/sam_fcntl.h \
		sys/sam_file.h \
		sys/sam_filedesc.h \
		sys/sam_machine_params.h \
		sys/sam_machine_params.h \
		sys/sam_malloc.h \
		sys/sam_malloc.h \
		sys/sam_mbuf.h \
		sys/sam_param.h \
		sys/sam_protosw.h \
		sys/sam_protosw.h \
		sys/sam_select.h \
		sys/sam_socket.h \
		sys/sam_socket.h \
		sys/sam_socketvar.h \
		sys/sam_socketvar.h \
		sys/sam_stat.h \
		sys/sam_syslimits.h \
		sys/sam_systm.h \
		sys/sam_systm.h \
		sys/sam_time.h \
		sys/sam_types.h \
		sys/sam_unistd.h

HDRS	      = abr.h \
		abt.h \
		compatibility.h \
		def.h \
		distr.h \
		ip_emulation.h \
		ip_emulation.i \
		main.i \
		measurements.h \
		model.h \
		read.h \
		sam_functions.h \
		sam_in.h \
		sam_in_pcb.h \
		sam_in_systm.h \
		sam_ip.h \
		sam_ip_var.h \
		sam_limits.h \
		sam_strings.h \
		sam_tcp.h \
		sam_tcp_fsm.h \
		sam_tcp_seq.h \
		sam_tcp_timer.h \
		sam_tcp_var.h \
		sam_tcpip.h \
		show.h \
		var.h

INSTALL	      = install

LD	      = gcc

LDFLAGS	      = $(COMPFLAGS)

LIBS	      = -lm -lSSIM

LIBPATH	      = $(SSIM)

LINTLIBS      =

LINTFLAGS     = -u $(CFLAGS)

MAKEFILE      = Makefile

OBJS	      = abr.o \
		abt.o \
		cell_routeing.o \
		debug.o \
		distr.o \
		event_functions.o \
		ip_emulation.o \
		main.o \
		measurements.o \
		model.o \
		read.o \
		sam_cpufunc.o \
		sam_files.o \
		sam_functions.o \
		sam_in_pcb.o \
		sam_ip_input.o \
		sam_mbuf.o \
		sam_strings.o \
		sam_tcp_input.o \
		sam_tcp_output.o \
		sam_tcp_subr.o \
		sam_tcp_timer.o \
		sam_tcp_usrreq.o \
		sam_uipc_mbuf.o \
		sam_uipc_socket.o \
		sam_uipc_socket2.o \
		show.o \
		signals.o \
		sock_functions.o \
		traffic_gen.o

PRINT	      = pr

PRINTFLAGS    =

LP	      = lp

LPFLAGS       = 

PROGRAM       = stcp

SHELL	      = /bin/sh

SRCS	      = abr.c \
		abt.c \
		cell_routeing.c \
		event_functions.c \
		ip_emulation.c \
		main.c \
		measurements.c \
		model.c \
		read.c \
		sam_cpufunc.c \
		sam_files.c \
		sam_functions.c \
		sam_in_pcb.c \
		sam_ip_input.c \
		sam_mbuf.c \
		sam_strings.c \
		sam_tcp_input.c \
		sam_tcp_output.c \
		sam_tcp_subr.c \
		sam_tcp_timer.c \
		sam_tcp_usrreq.c \
		sam_uipc_mbuf.c \
		sam_uipc_socket.c \
		sam_uipc_socket2.c \
		show.c \
		signals.c \
		sock_functions.c \
		traffic_gen.c

all:		$(PROGRAM)

$(PROGRAM):     $(OBJS) $(MAKEFILE) $(SSIM)/libSSIM.a
		@echo "Linking $(PROGRAM) ..."
		@$(LD) -o $(PROGRAM) $(OBJS) -L $(LIBPATH) $(LIBS) 
		@echo "done"

$(SSIM)/libSSIM.a:
		(cd $(SSIM) ; make )

clean:;		@rm -f $(OBJS) core *~

clobber:;	@rm -f $(OBJS) $(PROGRAM) core tags

depend:
		$(CC) $(CFLAGS) -M *.c > .tmpdepend
		mv .tmpdepend .depend

echo:;		@echo $(HDRS) $(SRCS)

-1:;		@ctags -wx $(HDRS) $(SRCS)

install:	$(PROGRAM)
		@echo Installing $(PROGRAM) in $(DEST)
		@-strip $(PROGRAM)
		@if [ $(DEST) != . ]; then \
		(rm -f $(DEST)/$(PROGRAM); $(INSTALL) -f $(DEST) $(PROGRAM)); fi

lint:		$(LINTLIBS) $(SRCS) $(HDRS) $(EXTHDRS)
		lint $(LINTFLAGS) $(LINTLIBS) $(SRCS)

print:;		@$(PRINT) $(PRINTFLAGS) $(HDRS) $(SRCS) | $(LP) $(LPFLAGS)

tags:           $(HDRS) $(SRCS); @ctags $(HDRS) $(SRCS)

update:		$(DEST)/$(PROGRAM)

touch:;		@touch $(SRCS) $(HDRS)

# $(DEST)/$(PROGRAM): $(SRCS) $(LIBS) $(HDRS) $(EXTHDRS)
#		@$(MAKE) -f $(MAKEFILE) ROOT=$(ROOT) DEST=$(DEST) install
###

include .depend
