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# @(#) $Header: /tcpdump/master/libpcap/msdos/makefile.dj,v 1.2 2004-12-19 19:41:06 guy Exp $ (LBL)
10
11VPATH = missing msdos
12
13PREREQUISITES = scanner.c grammar.c tokdefs.h version.h msdos/pkt_stub.inc
14
15include msdos/common.dj
16
17DRIVER_DIR = ./msdos/pm_drvr
18
19CFLAGS += -DDEBUG -DNDIS_DEBUG -DHAVE_LIMITS_H -DHAVE_STRERROR \
20          -D_U_='__attribute__((unused))' -DHAVE_VERSION_H
21
22# CFLAGS += -Dyylval=pcap_lval -DBDEBUG -DNDEBUG
23
24SOURCES = grammar.c scanner.c bpf_filt.c bpf_imag.c bpf_dump.c   \
25          etherent.c gencode.c nametoad.c pcap-dos.c optimize.c  \
26          savefile.c pcap.c inet.c msdos\pktdrvr.c msdos/ndis2.c \
27          missing/snprintf.c
28
29OBJECTS = $(notdir $(SOURCES:.c=.o))
30TEMPBIN = tmp.bin
31
32ifeq ($(USE_32BIT_DRIVERS),1)
33  PM_OBJECTS = $(addprefix $(DRIVER_DIR)/, \
34                 printk.o pci.o pci-scan.o bios32.o dma.o irq.o intwrap.o \
35                 lock.o kmalloc.o quirks.o timer.o net_init.o)
36  #
37  # Static link of drivers
38  #
39  ifeq ($(USE_32BIT_MODULES),0)
40    PM_OBJECTS += $(addprefix $(DRIVER_DIR)/, \
41                    accton.o 8390.o 3c503.o 3c509.o 3c59x.o 3c515.o \
42                    3c575_cb.o 3c90x.o ne.o wd.o cs89x0.o rtl8139.o)
43  endif
44endif
45
46all: libpcap.a
47
48ifeq ($(USE_32BIT_DRIVERS),1)
49$(PM_OBJECTS):
50	$(MAKE) -f Makefile.dj -C $(DRIVER_DIR) $(notdir $@)
51endif
52
53libpcap.a: version.h $(OBJECTS) $(PM_OBJECTS)
54	rm -f $@
55	ar rs $@ $^
56
57msdos/pkt_stub.inc: msdos/bin2c.exe msdos/pkt_rx1.S
58	$(ASM) -o $(TEMPBIN) -lmsdos/pkt_rx1.lst msdos/pkt_rx1.S
59	./msdos/bin2c $(TEMPBIN) > $@
60	rm -f $(TEMPBIN)
61
62grammar.c tokdefs.h: grammar.y
63	rm -f grammar.c tokdefs.h
64	$(YACC) --name-prefix=pcap_ --yacc --defines grammar.y
65	mv -f y_tab.c grammar.c
66	mv -f y_tab.h tokdefs.h
67
68version.h: ./VERSION
69	@echo '/* Generated from VERSION. Do not edit */' > $@
70	sed -e 's/.*/static char pcap_version_string[] = "libpcap (&)";/' ./VERSION >> $@
71
72scanner.c: scanner.l
73	$(LEX) -Ppcap_ -7 -t $^ > $@
74	@echo
75
76msdos/bin2c.exe: msdos/bin2c.c
77	$(CC) $*.c -o $*.exe
78
79clean:
80	$(MAKE) -f Makefile.dj -C $(DRIVER_DIR) clean
81	$(MAKE) -f Makefile.dj -C libcpcap clean
82	rm -f $(OBJECTS) msdos/pkt_rx1.lst Makefile.bak $(PREREQUISITES)
83
84vclean: clean
85	rm -f libpcap.a msdos/bin2c.exe
86
87#
88# Generated dependencies; Due to some hacks in gcc 2.95 and djgpp 2.03
89# we must prevent "$(DJDIR)/bin/../include/sys/version.h" from beeing
90# included in dependency output (or else this makefile cannot be used on
91# another machine). We therefore use a special 'specs' file during
92# pre-processing.
93#
94MM_SPECS = specs.tmp
95MAKEFILE = msdos/Makefile.dj
96
97depend: $(PREREQUISITES)
98	@echo Generating dependencies..
99	@cp $(MAKEFILE) Makefile.bak
100	@echo "*cpp: %(cpp_cpu) %{posix:-D_POSIX_SOURCE} -remap" > $(MM_SPECS)
101	sed -e "/^# DO NOT DELETE THIS LINE/,$$d" < Makefile.bak > $(MAKEFILE)
102	echo "# DO NOT DELETE THIS LINE"                        >> $(MAKEFILE)
103	$(CC) -MM -specs=$(MM_SPECS) $(CFLAGS) $(SOURCES)       >> $(MAKEFILE)
104	rm -f $(MM_SPECS)
105
106#
107# Manually generated dependencies
108#             
109msdos/pktdrvr.c: msdos/pkt_stub.inc
110scanner.c: scanner.l
111grammar.c tokdefs.h: grammar.y
112grammar.h: grammar.y
113scanner.l: pcap-int.h pcap-namedb.h gencode.h grammar.h gnuc.h
114grammar.y: pcap-int.h gencode.h pcap-namedb.h gnuc.h
115
116#
117# Automatically generated dependencies
118#
119# DO NOT DELETE THIS LINE
120grammar.o: grammar.c pcap-int.h pcap.h pcap-bpf.h gencode.h pf.h \
121  pcap-namedb.h
122scanner.o: scanner.c pcap-int.h pcap.h pcap-bpf.h gencode.h pcap-namedb.h \
123  tokdefs.h
124bpf_filt.o: bpf_filt.c pcap-int.h pcap.h pcap-bpf.h gnuc.h
125bpf_imag.o: bpf_imag.c pcap-int.h pcap.h pcap-bpf.h
126bpf_dump.o: bpf_dump.c pcap.h pcap-bpf.h
127etherent.o: etherent.c pcap-int.h pcap.h pcap-bpf.h pcap-namedb.h
128gencode.o: gencode.c pcap-dos.h msdos/pm_drvr/lock.h pcap-int.h pcap.h \
129  pcap-bpf.h ethertype.h nlpid.h llc.h gencode.h atmuni31.h sunatmpos.h \
130  ppp.h sll.h arcnet.h pf.h pcap-namedb.h
131nametoad.o: nametoad.c pcap-int.h pcap.h pcap-bpf.h gencode.h \
132  pcap-namedb.h ethertype.h
133pcap-dos.o: pcap-dos.c msdos/pm_drvr/pmdrvr.h msdos/pm_drvr/iface.h \
134  msdos/pm_drvr/lock.h msdos/pm_drvr/ioport.h pcap-dos.h pcap-int.h \
135  pcap.h pcap-bpf.h msdos/pm_drvr/kmalloc.h msdos/pm_drvr/bitops.h \
136  msdos/pm_drvr/timer.h msdos/pm_drvr/dma.h msdos/pm_drvr/irq.h \
137  msdos/pm_drvr/printk.h msdos/pm_drvr/pci.h msdos/pm_drvr/bios32.h \
138  msdos/pm_drvr/module.h msdos/pm_drvr/3c501.h msdos/pm_drvr/3c503.h \
139  msdos/pm_drvr/3c509.h msdos/pm_drvr/3c59x.h msdos/pm_drvr/3c515.h \
140  msdos/pm_drvr/3c90x.h msdos/pm_drvr/3c575_cb.h msdos/pm_drvr/ne.h \
141  msdos/pm_drvr/wd.h msdos/pm_drvr/accton.h msdos/pm_drvr/cs89x0.h \
142  msdos/pm_drvr/rtl8139.h msdos/pm_drvr/ne2k-pci.h msdos/pktdrvr.h
143optimize.o: optimize.c pcap-int.h pcap.h pcap-bpf.h gencode.h
144savefile.o: savefile.c pcap-int.h pcap.h pcap-bpf.h
145pcap.o: pcap.c pcap-dos.h msdos/pm_drvr/lock.h pcap-int.h pcap.h \
146  pcap-bpf.h
147inet.o: inet.c pcap-int.h pcap.h pcap-bpf.h
148pktdrvr.o: msdos/pktdrvr.c gnuc.h pcap-dos.h msdos/pm_drvr/lock.h \
149  pcap-int.h pcap.h pcap-bpf.h msdos/pktdrvr.h msdos/pkt_stub.inc
150ndis2.o: msdos/ndis2.c pcap-dos.h msdos/pm_drvr/lock.h pcap-int.h pcap.h \
151  pcap-bpf.h msdos/ndis2.h
152snprintf.o: missing/snprintf.c pcap-int.h pcap.h pcap-bpf.h
153