#
#   $Id: Makefile.in,v 1.1.1.1 2000/05/25 00:28:49 route Exp $
#
#   Libnet 1.0 makefile
#   (c) 1998 - 2001  Mike D. Schiffman <mike@infonexus.com>
#                                
#   @configure_input@

#   Enabled:    Dumps debugging info and verbose error information.
#   Disabled:   Doesn't.
#   default:    disabled.
DEFINES     +=  #-D__DEBUG 
prefix      =   @prefix@
exec_prefix =   @exec_prefix@
srcdir      =   @srcdir@
BIN_PREFIX  =   @bindir@/
INC_PREFIX  =   @includedir@/
LIB_PREFIX  =   @libdir@/
MAN_PREFIX  =   @MAN_PREFIX@

LIBNET      =   libnet
LIBPWRITE   =   libpwrite
LIB         =   lib/$(LIBNET).a
MAN         =   doc/$(LIBNET).3
INCLUDE     =   include/$(LIBNET).h
INCLUDE-H   =   include/$(LIBNET)/$(LIBNET)-headers.h
INCLUDE-F   =   include/$(LIBNET)/$(LIBNET)-functions.h
INCLUDE-S   =   include/$(LIBNET)/$(LIBNET)-structures.h
INCLUDE-M   =   include/$(LIBNET)/$(LIBNET)-macros.h
INCLUDE-A   =   include/$(LIBNET)/$(LIBNET)-asn1.h
INCLUDE-O   =   include/$(LIBNET)/$(LIBNET)-ospf.h
CONFIG      =   $(LIBNET)-config
DEFINES     +=  @DEFS@
RANLIB      =   @RANLIB@
AR          =   @AR@
LN          =   @LN@
CC          =   @CC@
ENSUREDIR   =   $(srcdir)/ensure-dir.sh
INSTALL_DATA=   $(srcdir)/install-sh
CFLAGS      =   @CFLAGS@
CPPFLAGS    =   @CPPFLAGS@
OBJECTS     =   src/libnet_resolve.o\
		src/libnet_socket.o\
		src/libnet_checksum.o\
		src/libnet_prand.o\
		src/libnet_version.o\
		src/libnet_write_ip.o\
		src/libnet_insert_ipo.o\
		src/libnet_insert_tcpo.o\
		src/libnet_error.o\
		src/libnet_link_@LL_INT_TYPE@.o\
		src/libnet_packet_mem.o\
		src/libnet_build_ip.o\
		src/libnet_build_tcp.o\
		src/libnet_build_udp.o\
		src/libnet_build_arp.o\
		src/libnet_build_ethernet.o\
		src/libnet_build_icmp.o\
		src/libnet_build_igmp.o\
		src/libnet_build_dns.o\
		src/libnet_build_snmp.o\
		src/libnet_build_rip.o\
		src/libnet_build_ospf.o\
		src/libnet_build_vrrp.o\
		src/libnet_asn1.o\
		src/libnet_hex_dump.o\
		src/libnet_if_addr.o\
		src/libnet_port_list.o 

.c.o:
	$(CC) $(CFLAGS) $(CPPFLAGS) $(DEFINES) -c $< -o $@

all: libnet
supp: test example

libnet: version.h $(OBJECTS)
	$(AR) -cr $(LIB) $(OBJECTS)
	$(RANLIB) $(LIB)

version.o: version.h
version.h: ./VERSION
	@rm -f $@
	sed -e 's/.*/#define VERSION "&"/' ./VERSION > $@

test:    libnet
	cd test; make

util:    libnet install
	cd util; make

example: libnet install
	cd example; make

install: libnet
	$(ENSUREDIR) $(DESTDIR)$(prefix) 755
	$(ENSUREDIR) $(DESTDIR)$(LIB_PREFIX) 755
	$(ENSUREDIR) $(DESTDIR)$(INC_PREFIX)$(LIBNET) 755
	$(ENSUREDIR) $(DESTDIR)$(INC_PREFIX) 755
	$(ENSUREDIR) $(DESTDIR)$(MAN_PREFIX) 755
	$(ENSUREDIR) $(DESTDIR)$(BIN_PREFIX) 755
	$(INSTALL_DATA) $(LIB) $(DESTDIR)$(LIB_PREFIX)
	rm -f $(DESTDIR)$(LIB_PREFIX)$(LIBPWRITE).a
	cd $(DESTDIR)$(LIB_PREFIX); $(LN) -f -s $(LIBNET).a $(LIBPWRITE).a
	$(INSTALL_DATA) $(INCLUDE) $(DESTDIR)$(INC_PREFIX)
	$(INSTALL_DATA) $(INCLUDE-H) $(DESTDIR)$(INC_PREFIX)$(LIBNET)
	$(INSTALL_DATA) $(INCLUDE-F) $(DESTDIR)$(INC_PREFIX)$(LIBNET)
	$(INSTALL_DATA) $(INCLUDE-S) $(DESTDIR)$(INC_PREFIX)$(LIBNET)
	$(INSTALL_DATA) $(INCLUDE-M) $(DESTDIR)$(INC_PREFIX)$(LIBNET)
	$(INSTALL_DATA) $(INCLUDE-A) $(DESTDIR)$(INC_PREFIX)$(LIBNET)
	$(INSTALL_DATA) $(INCLUDE-O) $(DESTDIR)$(INC_PREFIX)$(LIBNET)
	$(INSTALL_DATA) $(MAN) $(DESTDIR)$(MAN_PREFIX)
	$(INSTALL_DATA) $(CONFIG) $(DESTDIR)$(BIN_PREFIX)



clean:
	if test -f test/Makefile; then \
	    cd test && make clean; \
	fi
	if test -f example/Makefile; then \
	    cd example && make clean; \
	fi
	if test -f util/Makefile; then \
	    cd util && make clean; \
	fi
	if test -f support/bpf-lkm/etherspoof; then \
	    cd support/bpf-lkm/etherspoof && make clean; \
	fi
	rm -f *.core src/*.o $(LIB)

distclean: clean
	if test -f test/Makefile; then \
	    cd test && make distclean; \
	fi
	if test -f example/Makefile; then \
	    cd example && make distclean; \
	fi
	if test -f util/Makefile; then \
	    cd util && make distclean; \
	fi
	if test -f support/bpf-lkm/etherspoof; then \
	    cd support/bpf-lkm/etherspoof && rm -rf Makefile; \
	fi
	rm -f config.log config.cache config.status Makefile include/config.h \
	version.h support/bpf-lkm/etherspoof conftest* libnet-config

# EOF
