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