home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / ip / trace / tcpdump-2.2.1 / Makefile < prev    next >
Encoding:
Makefile  |  1992-06-02  |  8.3 KB  |  254 lines

  1. #  Copyright (c) 1988-1990 The Regents of the University of California.
  2. #  All rights reserved.
  3. #
  4. #  Redistribution and use in source and binary forms, with or without
  5. #  modification, are permitted provided that: (1) source code distributions
  6. #  retain the above copyright notice and this paragraph in its entirety, (2)
  7. #  distributions including binary code include the above copyright notice and
  8. #  this paragraph in its entirety in the documentation or other materials
  9. #  provided with the distribution, and (3) all advertising materials mentioning
  10. #  features or use of this software display the following acknowledgement:
  11. #  ``This product includes software developed by the University of California,
  12. #  Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
  13. #  the University nor the names of its contributors may be used to endorse
  14. #  or promote products derived from this software without specific prior
  15. #  written permission.
  16. #  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  17. #  WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  18. #  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  19. #
  20. # @(#) $Header: Makefile,v 1.106 92/06/02 12:39:46 mccanne Exp $ (LBL)
  21.  
  22. # Possible Options:
  23. #  -DCSLIP    include support for kernel slip interface
  24. #  -DPPP    include support for point to point protocol
  25. #  -DIBMRTPC    enable the MERIT additions to the Stanford Enetfilter
  26. #  -DNOVFPRINTF    simulate vfprintf() on systems that don't have it
  27. #
  28. # CSLIP and PPP work only under BPF.
  29. #
  30. DEFINES = -DCSLIP -DPPP -DFDDI
  31. CCOPT = -O
  32. INCLUDES = -I..
  33.  
  34. # The installed binary is owned by this group.
  35. GROUP = bpf
  36.  
  37. # Full pathname of where to install the binaries
  38. BINDEST = /usr/etc/tcpdump
  39. TCPSLICE_BINDEST = /usr/local/tcpslice
  40. # Full pathname of where to install the manual entries
  41. MANDEST = /usr/man/manl/tcpdump.l
  42. TCPSLICE_MANDEST = /usr/man/manl/tcpslice.l
  43.  
  44. # Standard CFLAGS
  45. STANDARD_CFLAGS = $(CCOPT) $(DEFINES) $(INCLUDES)
  46.  
  47. # CFLAGS definitions per machine vs. os
  48. #hp300-bsd#CFLAGS = $(STANDARD_CFLAGS)
  49. #mips-ultrix#CFLAGS = $(STANDARD_CFLAGS)
  50. #rt-bsd#CFLAGS = $(STANDARD_CFLAGS) -U__STDC__
  51. #sun3-sunos3#CFLAGS = $(STANDARD_CFLAGS) 
  52. #sun3-sunos4#CFLAGS = $(STANDARD_CFLAGS)
  53. #sun4-sunos4#CFLAGS = $(STANDARD_CFLAGS)
  54. #sun4-bsd#CFLAGS = $(STANDARD_CFLAGS)
  55. #tahoe-bsd#CFLAGS = $(STANDARD_CFLAGS)
  56. #vax-bsd#CFLAGS = $(STANDARD_CFLAGS)
  57. #vax-ultrix#CFLAGS = $(STANDARD_CFLAGS)
  58. #mips-irix#CFLAGS = $(STANDARD_CFLAGS) -D_BSD_COMPAT
  59.  
  60. SUBDIRS = hp300-bsd mips-ultrix sun?-sunos? sun4-bsd tahoe-bsd vax-bsd \
  61.     vax-ultrix rt-bsd mips-irix
  62.  
  63. # Change these to cc/lex/yacc if you don't have gcc, flex and/or bison.
  64. CC = gcc -g
  65. LEX = flex
  66. YACC = bison -y
  67. MAKE = make
  68.  
  69. # Script (or program) that returns the machine and os types,
  70. # or jsut edit in the name yourself.
  71. MD=`./mdtype`
  72. OS=`./ostype`
  73.  
  74. # Explicitly define compiliation rule since SunOS 4's make doesn't like gcc.
  75. # Also, gcc does not remove the .o before forking 'as', which can be a
  76. # problem if you don't own the file but can write to the directory.
  77. .c.o:
  78.     rm -f $@; $(CC) $(CFLAGS) -c $*.c
  79.  
  80. CSRC =    tcpdump.c addrtoname.c \
  81.     print-ether.c print-ip.c print-arp.c print-tcp.c print-udp.c \
  82.     print-atalk.c print-domain.c print-tftp.c print-bootp.c print-nfs.c \
  83.     print-icmp.c nametoaddr.c print-sl.c print-ppp.c print-rip.c \
  84.     print-snmp.c print-ntp.c print-null.c print-egp.c print-ospf.c \
  85.     print-fddi.c print-sunrpc.c savefile.c util.c etherent.c inet.c \
  86.     gencode.c optimize.c bpf_dump.c bpf_filter.c bpf_image.c
  87.  
  88. TCPSLICE_CSRC = \
  89.     tcpslice.c gwtm2secs.c search.c
  90.  
  91. TCPSLICE_LINT_SRC = \
  92.     $(TCPSLICE_CSRC) savefile.c bpf_filter.c md.c util.c
  93.  
  94. SRC =    $(CSRC) tcpgram.y tcplex.l \
  95.     $(TCPSLICE_CSRC)
  96.  
  97. MSRC =    md-hp300.c md-mips.c md-sun3.c md-sun4.c md-vax.c md-rt.c
  98.  
  99. PSRC =    pcap-nit.c pcap-pf.c pcap-snit.c pcap-bpf.c pcap-enet.c
  100.  
  101. OSRC =    os-sunos3.c os-sunos4.c os-bsd.c os-ultrix.c
  102.  
  103. OBJ =    tcpdump.o tcpgram.o tcplex.o addrtoname.o \
  104.     print-ether.o print-ip.o print-arp.o print-tcp.o print-udp.o \
  105.     print-atalk.o print-domain.o print-tftp.o print-bootp.o print-nfs.o \
  106.     print-icmp.o nametoaddr.o print-sl.o print-ppp.o print-rip.o \
  107.     print-snmp.o print-ntp.o print-null.o print-egp.o print-ospf.o \
  108.     print-fddi.o print-sunrpc.o pcap.o md.o os.o \
  109.     savefile.o util.o etherent.o inet.o gencode.o optimize.o \
  110.     bpf_dump.o bpf_filter.o bpf_image.o version.o
  111.  
  112. TCPSLICE_OBJ = \
  113.     tcpslice.o gwtm2secs.o search.o savefile.o bpf_filter.o md.o util.o
  114.  
  115. HDR =    interface.h appletalk.h addrtoname.h \
  116.     bootp.h mib.h savefile.h etherproto.h nametoaddr.h \
  117.     etherent.h ntp.h gencode.h extract.h ospf.h
  118.  
  119. MHDR =    md-hp300.h md-sun3.h md-sun4.h md-mips.h md-vax.h md-rt.h
  120.  
  121. OHDR =    os-bsd.h os-sunos3.h os-sunos4.h os-ultrix.h
  122.  
  123. TAGHDR=    /usr/include/netinet/in.h \
  124.     /usr/include/netinet/udp.h \
  125.     /usr/include/netinet/tcp.h \
  126.     /usr/include/arpa/tftp.h \
  127.     /usr/include/netinet/if_ether.h
  128.  
  129. # These files are automatically generated.
  130. #
  131. GEN =    tokdefs.h tcpgram.c tcplex.c version.h version.c
  132.  
  133. AWKS =    atime.awk packetdat.awk send-ack.awk stime.awk
  134.  
  135. # "all" must come before tcpdump so we can delete it with sed
  136. all: submake
  137.  
  138. tcpdump: $(OBJ)
  139.     $(CC) $(CFLAGS) -o $@ $(OBJ) $(LIB)
  140.  
  141. tcpslice: $(TCPSLICE_OBJ)
  142.     $(CC) $(CFLAGS) -o $@ $(TCPSLICE_OBJ)
  143.  
  144. submake: force
  145.     -@dir=$(MD)-$(OS); \
  146.     if [ ! -d $$dir ]; then ${MAKE} ${MFLAGS} config; fi; \
  147.     set -x; \
  148.     cd $$dir; ${MAKE} ${MFLAGS}
  149.  
  150. # N.B.- symbolic links are used in the subdirectory rather than VPATH
  151. # because at least one Sun cc compiler puts the .o in the wrong place
  152. # when using VPATH and it's almost impossible to get "make depend" to
  153. # do the right thing.
  154.  
  155. config:
  156.     -@md=$(MD); os=$(OS); dir=$$md-$$os; list=; \
  157.     if [ -f /dev/bpf0 ] ; then pcap="bpf"; \
  158.     elif [ $$os = "sunos3" ] ; then pcap="nit"; \
  159.     elif [ $$os = "sunos4" ] ; then pcap="snit"; \
  160.     elif [ $$os = "ultrix" ] ; then pcap="pf"; \
  161.     elif [ -f /usr/include/net/enet.h ] ; then pcap="enet"; \
  162.     else pcap="bpf"; fi; \
  163.     for i in $(SRC) $(HDR); do list="../$$i $$list"; done; \
  164.     set -x; mkdir $$dir; chmod ug+w $$dir; ln -s $$list $$dir; \
  165.     ln -s ../md-$$md.c $$dir/md.c; ln -s ../md-$$md.h $$dir/md.h; \
  166.     ln -s ../os-$$os.c $$dir/os.c; ln -s ../os-$$os.h $$dir/os.h; \
  167.     ln -s ../pcap-$$pcap.c $$dir/pcap.c; \
  168.     ln -s ../VERSION $$dir/VERSION; \
  169.     sed -e "/^all:/d" -e "s/^#$$dir#//" Makefile >$$dir/Makefile; \
  170.     chmod ug+w $$dir/Makefile; \
  171.     cd $$dir ; ${MAKE} ${MFLAGS} depend
  172.  
  173. tcplex.c: tcplex.l
  174.     rm -f $@
  175.     $(LEX) $<
  176.     mv -f lex.yy.c tcplex.c
  177.  
  178. tokdefs.h: tcpgram.c
  179. tcpgram.c: tcpgram.y
  180.     rm -f tcpgram.c tokdefs.h
  181.     $(YACC) -d $<
  182.     mv y.tab.c tcpgram.c
  183.     mv y.tab.h tokdefs.h
  184.  
  185. version.o: version.c
  186. version.c version.h: VERSION
  187.     rm -f version.c ; sed 's/.*/char version[] = "&";/' VERSION > version.c
  188.     set `sed 's/\([0-9]*\)\.\([0-9]*\).*/\1 \2/' VERSION` ; \
  189.         { echo '#define VERSION_MAJOR' $$1 ; \
  190.           echo '#define VERSION_MINOR' $$2 ; } > version.h
  191.  
  192. # in case mkdep doesn't work
  193. savefile.o: version.h
  194. tcpslice.o: version.h
  195.  
  196. install: force
  197.     @dir=$(MD)-$(OS); set -x; \
  198.         install -m 750 -g $(GROUP) $$dir/tcpdump $(DESTDIR)$(BINDEST); \
  199.         install -m 755 $$dir/tcpslice $(DESTDIR)$(TCPSLICE_BINDEST)
  200.     install -c tcpdump.1 $(DESTDIR)$(MANDEST)
  201.     install -c tcpslice.1 $(DESTDIR)$(TCPSLICE_MANDEST)
  202.  
  203. lint:    force
  204.     lint -hbxn $(CSRC) | \
  205.         grep -v 'struct/union .* never defined' | \
  206.         grep -v 'possible pointer alignment problem'
  207.     lint -hbxn $(TCPSLICE_LINT_SRC) | \
  208.         grep -v 'struct/union .* never defined' | \
  209.         grep -v 'possible pointer alignment problem'
  210.  
  211. # This might be futile
  212. lint.ultrix: force
  213.     lint $(CFLAGS_ULTRIX) $(CSRC) tcplex.c tcpgram.c
  214.  
  215. clean:
  216.     rm -f *.o tcpdump tcpslice tcpdump.shar $(GEN) ; \
  217.     rm -rf $(SUBDIRS)
  218.  
  219. TAGFILES = $(SRC) md.c os.c pcap.c $(HDR) md.h os.h $(TAGHDR) 
  220.  
  221. tags:    $(TAGFILES)
  222.     ctags -wtd $(TAGFILES)
  223.  
  224. TARFILES =     README INSTALL VERSION Makefile tcpdump.1 tcpslice.1 \
  225.         mdtype ostype ostype.awk makemib mkdep \
  226.         $(SRC) $(MSRC) $(OSRC) $(PSRC) \
  227.         $(HDR) $(MHDR) $(OHDR) \
  228.         $(AWKS) SUNOS4 net
  229.  
  230. tar:    force
  231.     @v=`cat VERSION`; dirname=tcpdump-$$v; tarname=/tmp/$$dirname.tar; \
  232.     cd .. ; \
  233.     if [ ! -d $$dirname ] ; then \
  234.         ln -s tcpdump $$dirname ; \
  235.     fi ; \
  236.     list="" ; \
  237.     for i in $(TARFILES) ; do list="$$list $$dirname/$$i" ; done; \
  238.     set -x; \
  239.     tar cf $$tarname $$list; \
  240.     tar ufhFF $$tarname $$dirname/bpf; \
  241.     rm -f $$tarname.Z; \
  242.     compress $$tarname
  243.  
  244. force:    /tmp
  245. depend:    force
  246.     @set -x ; \
  247.     rm -f $(GEN) ; \
  248.     grep '^#include' tcpgram.y > tcpgram.c ; \
  249.     grep '^#include' tcplex.l > tcplex.c ; \
  250.     touch version.h tokdefs.h
  251.     -../mkdep $(DEFINES) $(INCLUDES) $(CSRC) $(TCPSLICE_CSRC) \
  252.         tcpgram.c tcplex.c
  253.     rm -f $(GEN)
  254.