# Generated automatically from Makefile.in by configure.
srcdir = .

# Common prefix for machine-independent installed files.
prefix = /gg
# Common prefix for machine-dependent installed files.
exec_prefix = $(prefix)

# Directory to install executables in.
bindir = $(exec_prefix)/bin
# Directory to install libraries in.
libdir = $(exec_prefix)/lib
# Directory to install the Info files in.
infodir = $(prefix)/info
# Directory to install the man page in.
mandir = $(prefix)/man/man$(manext)

# Program to install executables.
INSTALL_PROGRAM = ${INSTALL}
# Program to install data like man pages.
INSTALL_DATA = ${INSTALL} -m 644
# Generic install program.
INSTALL = /bin/install -c

CC = gcc
CFLAGS = -g -O2
LDFLAGS =  
LIBS = 


MAKE = make
CC= gcc -noixemul
LD= ld
AS= gas

RM= rm -f


OPTIMIZATION-OPTION = -m68030 -O2 -fomit-frame-pointer -fstrength-reduce -msmall-code
BASEREL-OPTION = -fbaserel
DEBUG-OPTION = # -DDEBUG
VERBOSITY = 
#Want to link it all up on this level
OBJECT-ONLY =

CFLAGS= $(OPTIMIZATION-OPTION) $(BASEREL-OPTION) $(DEBUG-OPTION)\
	 $(VERBOSITY) $(OBJECT-ONLY) 



#export IDIRS=   -I /netinclude/ -I /netinclude/conf -I /netinclude/protos 
IDIRS=   -I include/ -I include/conf -I include/protos -I include

DEFS= -DRCS_ID_C=// -DGGTCP -DKERNEL \
	-DNO_DEBUG -DNDEBUG -DNO_ARP_DEBUG -DNO_TCPDEBUG \
	-DNO_ICMPPRINTFS -DNO_SOCKBUF_DEBUG \
	-DUSE_ALIGNED_COPIES -DDIRECTED_BROADCAST

CFLAGS+=$(IDIRS) $(DEFS)
#
# System headers
#
SYS_H= \
   sys/synch.h sys/uio.h \
   sys/kernel.h sys/malloc.h sys/mbuf.h sys/queue.h \
   sys/socketvar.h sys/domain.h sys/protosw.h \
   sys/systm.h 

PROTOS_H= \
   protos/kern/amiga_api_protos.h   protos/kern/amiga_main_protos.h \
   protos/kern/amiga_select_protos.h protos/kern/amiga_time_protos.h \
   protos/kern/amiga_userlib_protos.h protos/kern/kern_malloc_protos.h \
   protos/kern/kern_synch_protos.h protos/kern/subr_prf_protos.h \
   protos/kern/uipc_domain_protos.h \
   protos/kern/uipc_socket2_protos.h protos/kern/uipc_socket_protos.h \
   protos/net/if_loop_protos.h protos/net/if_protos.h \
   protos/net/radix_protos.h protos/net/raw_cb_protos.h \
   protos/net/raw_usrreq_protos.h protos/net/rtsock_protos.h \
   protos/netinet/in_cksum_protos.h protos/netinet/in_pcb_protos.h \
   protos/netinet/in_proto_protos.h protos/netinet/in_protos.h \
   protos/netinet/ip_icmp_protos.h protos/netinet/ip_input_protos.h \
   protos/netinet/ip_output_protos.h protos/netinet/raw_ip_protos.h \
   protos/netinet/tcp_debug_protos.h protos/netinet/tcp_input_protos.h \
   protos/netinet/tcp_output_protos.h protos/netinet/tcp_subr_protos.h \
   protos/netinet/tcp_timer_protos.h protos/netinet/tcp_usrreq_protos.h \
   protos/netinet/udp_usrreq_protos.h

# Protocol inspecific network routines:
# network interfaces, input queue scheduling, 
# raw sockets, routing
NET_C=  net/sana2perror.c \
   net/if.c net/if_loop.c \
   net/raw_cb.c net/raw_usrreq.c \
   net/route.c net/rtsock.c net/radix.c \
   net/if_sana.c net/netisr.c net/sana2config.c \
   net/sana2copybuff.c net/sana2arp.c

NET_O=  net/sana2perror.o \
   net/if.o net/if_loop.o \
   net/raw_cb.o net/raw_usrreq.o \
   net/route.o net/rtsock.o net/radix.o \
   net/if_sana.o net/netisr.o net/sana2config.o \
   net/sana2copybuff.o net/sana2arp.o

NET_H= \
   net/if_types.h net/if_sana.h \
   net/sana2request.h net/sana2arp.h net/sana2config.h \
   net/netisr.h net/raw_cb.h net/radix.h 

# netinet -- internet protocols (ip, icmp, tcp, udp, arp)
NETINET_C= \
   netinet/in.c netinet/in_cksum.c netinet/in_pcb.c netinet/in_proto.c \
   netinet/ip_icmp.c \
   netinet/ip_input.c netinet/ip_output.c netinet/raw_ip.c \
   netinet/tcp_debug.c netinet/tcp_input.c netinet/tcp_output.c \
   netinet/tcp_subr.c netinet/tcp_timer.c netinet/tcp_usrreq.c \
   netinet/udp_usrreq.c

NETINET_O= \
   netinet/in.o netinet/in_cksum.o netinet/in_pcb.o netinet/in_proto.o \
   netinet/ip_icmp.o \
   netinet/ip_input.o netinet/ip_output.o netinet/raw_ip.o \
   netinet/tcp_debug.o netinet/tcp_input.o netinet/tcp_output.o \
   netinet/tcp_subr.o netinet/tcp_timer.o netinet/tcp_usrreq.o \
   netinet/udp_usrreq.o 

NETINET_H= \
   netinet/in_pcb.h netinet/in_var.h netinet/icmp_var.h  \
   netinet/tcpip.h netinet/tcp_debug.h netinet/tcp_fsm.h \
   netinet/tcp_seq.h netinet/tcp_timer.h netinet/tcp_var.h \
   netinet/udp_var.h 

# "Kernel" sources
# main, timeouts, syncronization, memory management,
# BSD socket ("Unix interprocess communication") routines,
# logging and netstat rexx interface 
KERN_C= \
   kern/amiga_main.c kern/amiga_time.c \
   kern/amiga_config.c kern/amiga_netdb.c \
   kern/kern_synch.c kern/kern_malloc.c kern/uipc_mbuf.c \
   kern/uipc_domain.c kern/uipc_socket.c kern/uipc_socket2.c \
   kern/amiga_log.c kern/amiga_cstat.c kern/amiga_rexx.c \
   kern/subr_prf.c kern/accesscontrol.c

KERN_O= \
   kern/config_var.o \
   kern/amiga_main.o kern/amiga_time.o \
   kern/amiga_config.o kern/amiga_netdb.o \
   kern/kern_synch.o kern/kern_malloc.o kern/uipc_mbuf.o \
   kern/uipc_domain.o kern/uipc_socket.o kern/uipc_socket2.o \
   kern/amiga_log.o kern/amiga_cstat.o kern/amiga_rexx.o \
   kern/subr_prf.o kern/accesscontrol.o

KERN_H= \
   kern/amiga_includes.h kern/amiga_time.h kern/amiga_config.h \
   kern/amiga_netdb.h kern/amiga_log.h kern/amiga_rexx.h \
   kern/amiga_subr.h kern/accesscontrol.h

# Application interface sources
# Amiga "struct Library" interface, API functions,
API_C=\
   api/amiga_api.c api/amiga_libtables.c api/amiga_syscalls.c \
   api/amiga_sendrecv.c api/amiga_generic.capi/amiga_generic2.c \
   api/amiga_libcalls.c api/amiga_errlists.c \
   api/getxbyy.c api/gethostnamadr.c api/allocdatabuffer.c \
   api/res_comp.c api/res_debug.c api/res_init.c \
   api/res_mkquery.c api/res_query.c api/res_send.c #api/gethna_nores.c

API_O=\
   api/amiga_api.o api/amiga_libtables.o api/amiga_syscalls.o \
   api/amiga_sendrecv.o api/amiga_generic.o api/amiga_generic2.o \
   api/amiga_libcalls.o api/amiga_errlists.o \
   api/getxbyy.o api/gethostnamadr.o api/allocdatabuffer.o \
   api/res_comp.o api/res_debug.o api/res_init.o \
   api/res_mkquery.o api/res_query.o api/res_send.o #api/gethna_nores.o

API_H=\
   api/amiga_raf.h api/amiga_api.h api/amiga_libcallentry.h \
   api/allocdatabuffer.h api/gethtbynamadr.h \
   api/arpa_nameser.h api/resolv.h api/sockargs.h \
   api/apicalls.h api/apicalls_sasc.h api/apicalls_gnuc.h

#
# Misc headers
#
MISC_H=\
   all_includes.h \
   conf/conf.h conf/rcs.h

#
# Misc sources
#
#MISC= \
#  all_includes.c GNUmakefile Smakefile GCCOPTS \
#  kern/variables.src kern/config_var.awk \
#  netinet/in_cksum.asm sys/mbuf.i

#
# Sources containing autodoc entries
#
#AUTODOCSRC= \
#  api/auto_extras.c api/auto_inetaddr.c api/auto_netdb.c \
#  api/auto_nonsocket.c api/auto_protocols.c api/auto_socket.c \
#  api/amiga_generic2.c api/gethostnamadr.c 

CSRCS=   $(KERN_C) $(NETINET_C) $(NET_C) $(API_C)
OBJS=   $(API_O) $(KERN_O) $(NETINET_O) $(NET_O)
SRCS= $(CSRCS) $(SYS_H) $(API_H) $(KERN_H) $(NET_H) $(NETINET_H)\
   $(PROTOS_H)
LIBSRC= -L lib -L netlib
LIBS= -lnet -lsana2

all: ggtcp utils support-libs

support-libs:
	@printf "Generating supportlibs..."
	@cd netlib;$(MAKE) 'CFLAGS=$(CFLAGS)'
	@printf "ok\n"

ggtcp: $(OBJS)
	$(CC) /gg/lib/libnix/detach.o $(CFLAGS) $(OBJS) $(LIBSRC) $(LIBS) -o $@

utils:
	cd utils;$(MAKE)

#bsdsocket.doc: $(AUTODOCSRC)
#  $(AUTODOC) $(AUTODOCSRC) > $@

net:  #$(NET_O)
	cd net; $(MAKE)
netinet:  #$(NETINET_O)
	cd netinet; $(MAKE)
kern: #$(KERN_O)
	cd kern; $(MAKE)
api:  #$(API_O)
	cd api; $(MAKE)
#echo:
#   list quick files nohead $(OBJS) lformat="%p%n"



#netinet/in_cksum.o: netinet/in_cksum.asm
	$(AS) $(AFLAGS) netinet/in_cksum.asm -o$@

# Special rule for variables
#kern/config_var.o: kern/config_var.c

#kern/config_var.c: kern/variables.src kern/config_var.awk
	gawk -f kern/config_var.awk -v TARGETTI=C $< > $@

# Special rule for TeX
#kern/config_var.tex: kern/variables.src kern/config_var.awk
#  gawk -f kern/config_var.awk -v TARGETTI=TEX $< > $@ 


#$(DEST)doc:
#  -$(MKDIR) $@

clean:
	-$(RM) net/*.o netinet/*.o kern/*.o api/*.o *.o

veryclean: clean
	-$(RM) ggtcp
   
date:
	date

TAGS:
	etags $(CSRCS) 

.c.o:
	@printf "Compiling $<..."
	@$(CC) -c $(CFLAGS) $(IDIRS) $(DEFS) $< -o $@
	@printf "ok\n"

#.c.s:
#  $(CC) $(CFLAGS) $*.c DISASM=$@

# DO NOT DELETE THIS LINE -- make depend depends on it.
