makefile.dj 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. #
  2. # GNU Makefile for DOS-libpcap. djgpp version.
  3. #
  4. # Use this makefile from the libpcap root directory.
  5. # E.g. like this:
  6. #
  7. # c:\net\pcap> make -f msdos/makefile.dj
  8. #
  9. # Note: you should do a "set LFN=y" before running this makefile.
  10. #
  11. VPATH = missing msdos bpf/net
  12. PREREQUISITES = scanner.c grammar.c tokdefs.h version.h msdos/pkt_stub.inc
  13. include ./msdos/common.dj
  14. DRIVER_DIR = ./msdos/pm_drvr
  15. CFLAGS += -DDEBUG -DNDIS_DEBUG -DHAVE_LIMITS_H -DHAVE_STRERROR -DHAVE_SNPRINTF -DHAVE_VSNPRINTF\
  16. -D_U_='__attribute__((unused))'
  17. CFLAGS += -Dyylval=pcap_lval # -DBDEBUG -DNDEBUG
  18. SOURCES = grammar.c scanner.c bpf/net/bpf_filter.c bpf_image.c bpf_dump.c \
  19. etherent.c gencode.c nametoaddr.c pcap-common.c pcap-dos.c optimize.c \
  20. savefile.c pcap.c sf-pcap.c sf-pcapng.c \
  21. msdos/pktdrvr.c msdos/ndis2.c # missing/snprintf.c
  22. OBJECTS = $(addprefix $(OBJ_DIR)/, $(notdir $(SOURCES:.c=.o)))
  23. TEMPBIN = tmp.bin
  24. ifeq ($(USE_32BIT_DRIVERS),1)
  25. PM_OBJECTS = $(addprefix $(OBJ_DIR)/, \
  26. printk.o pci.o pci-scan.o bios32.o dma.o irq.o intwrap.o \
  27. lock.o kmalloc.o quirks.o timer.o net_init.o)
  28. #
  29. # Static link of drivers
  30. #
  31. ifeq ($(USE_32BIT_MODULES),0)
  32. PM_OBJECTS += $(addprefix $(OBJ_DIR)/, \
  33. accton.o 8390.o 3c503.o 3c509.o 3c59x.o 3c515.o \
  34. 3c575_cb.o 3c90x.o ne.o wd.o cs89x0.o rtl8139.o)
  35. endif
  36. endif
  37. TARGETS = msdos/bin2c.exe libpcap.a filtertest.exe findalldevstest.exe \
  38. nonblocktest.exe opentest.exe
  39. all: $(TARGETS)
  40. @echo 'Welcome to libpcap/djgpp with samples.'
  41. ifeq ($(USE_32BIT_DRIVERS),1)
  42. $(PM_OBJECTS):
  43. $(MAKE) -f Makefile.dj -C $(DRIVER_DIR) $(notdir $@)
  44. endif
  45. libpcap.a: version.h $(OBJECTS) $(PM_OBJECTS)
  46. rm -f $@
  47. ar rs $@ $^
  48. filtertest.exe: tests/filtertest.c libpcap.a
  49. $(CC) $(CFLAGS) -Din_addr_t=u_long -o $@ $^ $(WATT32_ROOT)/lib/libwatt.a
  50. @echo
  51. findalldevstest.exe: tests/findalldevstest.c libpcap.a
  52. $(CC) $(CFLAGS) -o $@ $^ $(WATT32_ROOT)/lib/libwatt.a
  53. @echo
  54. nonblocktest.exe: tests/nonblocktest.c libpcap.a
  55. $(CC) $(CFLAGS) -o $@ $^ $(WATT32_ROOT)/lib/libwatt.a
  56. @echo
  57. opentest.exe: tests/opentest.c libpcap.a
  58. $(CC) $(CFLAGS) -o $@ $^ $(WATT32_ROOT)/lib/libwatt.a
  59. @echo
  60. msdos/pkt_stub.inc: msdos/bin2c.exe msdos/pkt_rx1.S
  61. $(ASM) -o $(TEMPBIN) -lmsdos/pkt_rx1.lst msdos/pkt_rx1.S
  62. ./msdos/bin2c $(TEMPBIN) > $@
  63. rm -f $(TEMPBIN)
  64. grammar.c tokdefs.h: grammar.y
  65. rm -f grammar.c tokdefs.h
  66. $(YACC) --name-prefix=pcap_ --yacc --defines grammar.y
  67. mv -f y.tab.c grammar.c
  68. mv -f y.tab.h tokdefs.h
  69. version.h: ./VERSION
  70. @echo '/* Generated from VERSION. Do not edit */' > $@
  71. sed -e 's/.*/static char pcap_version_string[] = "libpcap (&)";/' ./VERSION >> $@
  72. scanner.c: scanner.l
  73. $(LEX) -Ppcap_ -7 -t $^ > $@
  74. @echo
  75. msdos/bin2c.exe: msdos/bin2c.c
  76. $(CC) $*.c -o $*.exe
  77. clean:
  78. rm -f $(OBJECTS) msdos/pkt_rx1.lst Makefile.bak .depend.dj $(PREREQUISITES)
  79. # $(MAKE) -f Makefile.dj -C $(DRIVER_DIR) clean
  80. vclean: clean
  81. rm -f $(TARGETS)
  82. -rmdir $(OBJ_DIR)
  83. #
  84. # Manually generated dependencies
  85. #
  86. msdos/pktdrvr.c: msdos/pkt_stub.inc
  87. scanner.c: scanner.l
  88. grammar.c tokdefs.h: grammar.y
  89. grammar.h: grammar.y
  90. scanner.l: pcap-int.h pcap-namedb.h gencode.h grammar.h
  91. grammar.y: pcap-int.h gencode.h pcap-namedb.h
  92. #
  93. # Generate dependencies.
  94. #
  95. REPLACE = sed -e 's/\(.*\)\.o: /\n$$(OBJ_DIR)\/\1.o: /'
  96. depend: $(PREREQUISITES)
  97. $(CC) -MM $(CFLAGS) $(SOURCES) | $(REPLACE) > .depend.dj
  98. -include .depend.dj