1#
2#  Watcom Makefile for dos-libpcap.
3#
4# Specify MODEL = `3r' or `3s'
5# Specify TARGET = `pharlap' or `dos4g'
6#
7# Use this makefile from the libpcap root directory.
8# E.g. like this:
9#
10#  c:\net\pcap> wmake -f msdos\makefile.wc
11#
12
13MODEL  = 3s
14TARGET = dos4g
15
16OBJDIR = msdos\$(TARGET).w$(MODEL)
17LIB    = $(OBJDIR)\pcap.lib
18
19.EXTENSIONS: .l .y
20
21DEFS = -dDEBUG -dNDIS_DEBUG -d_U_= -dHAVE_LIMITS_H -dHAVE_STRERROR &
22       -dHAVE_SNPRINTF -dHAVE_VSNPRINTF
23
24CC  = wcc386.exe
25ASM = wasm.exe -$(MODEL) $(DEFS) -dDOSX -dDOS4GW -zq -bt=dos -fr=nul -d3 -s
26
27OBJS = $(OBJDIR)\grammar.obj  $(OBJDIR)\scanner.obj  $(OBJDIR)\pcap.obj     &
28       $(OBJDIR)\bpf_filt.obj $(OBJDIR)\bpf_imag.obj $(OBJDIR)\bpf_dump.obj &
29       $(OBJDIR)\etherent.obj $(OBJDIR)\gencode.obj  $(OBJDIR)\nametoad.obj &
30       $(OBJDIR)\pcap-dos.obj $(OBJDIR)\pktdrvr.obj  $(OBJDIR)\optimize.obj &
31       $(OBJDIR)\savefile.obj $(OBJDIR)\inet.obj     $(OBJDIR)\ndis2.obj
32
33CFLAGS = $(DEFS) $(YYDEFS) -I. -I$(%watt_root)\inc -I.\msdos\pm_drvr &
34         -$(MODEL) -mf -zff -zgf -zq -bt=dos -fr=nul -w6 -fpi        &
35         -oilrtf -zm
36
37TEMPBIN = tmp.bin
38
39all: $(OBJDIR) $(OBJDIR)\pcap.lib
40
41$(OBJDIR):
42          - mkdir $(OBJDIR)
43
44$(OBJDIR)\pcap.lib: $(OBJS) wlib.arg
45          wlib -q -b -c $(OBJDIR)\pcap.lib @wlib.arg
46
47wlib.arg: msdos\makefile.wc
48          %create $^@
49          for %f in ($(OBJS)) do %append $^@ +- %f
50
51$(OBJDIR)\pktdrvr.obj: msdos\pkt_stub.inc msdos\pktdrvr.c gnuc.h &
52  pcap-dos.h pcap-int.h pcap.h msdos\pktdrvr.h
53          *$(CC) $(CFLAGS) msdos\pktdrvr.c -fo=$@
54
55$(OBJDIR)\ndis2.obj: msdos\ndis2.c
56          *$(CC) $(CFLAGS) msdos\ndis2.c -fo=$@
57
58.ERASE
59.c{$(OBJDIR)}.obj:
60          *$(CC) $(CFLAGS) $[@ -fo=$@
61
62grammar.c tokdefs.h: grammar.y 
63          bison --name-prefix=pcap_ --yacc --defines $[@
64          - @del grammar.c
65          - @del tokdefs.h
66          ren y_tab.c grammar.c
67          ren y_tab.h tokdefs.h
68
69scanner.c: scanner.l
70          flex -Ppcap_ -7 -o$@ $[@
71
72msdos\pkt_stub.inc: bin2c.exe msdos\pkt_rx1.S
73          nasm -fbin -dDEBUG -o $(TEMPBIN) -lmsdos\pkt_rx1.lst msdos\pkt_rx1.S
74          bin2c.exe  $(TEMPBIN) > $@
75          @del $(TEMPBIN)
76
77bin2c.exe: msdos\bin2c.c
78          wcl $[@
79
80clean realclean vclean: .SYMBOLIC
81          for %f in (dos4g.w3r dos4g.w3s pharlap.w3r pharlap.w3s) do &
82            @del %f\*.obj
83          @del grammar.c
84          @del tokdefs.h
85          @del scanner.c
86          @del bin2c.exe
87          @del bin2c.obj
88          @del msdos\pkt_stub.inc
89          @echo Cleaned
90
91#
92# dependencies
93#                     
94$(OBJDIR)\bpf_filt.obj: bpf_filt.c pcap-int.h pcap.h pcap-bpf.h gnuc.h
95
96$(OBJDIR)\bpf_imag.obj: bpf_imag.c pcap-int.h pcap.h pcap-bpf.h
97
98$(OBJDIR)\bpf_dump.obj: bpf_dump.c pcap.h pcap-bpf.h
99
100$(OBJDIR)\etherent.obj: etherent.c pcap-int.h pcap.h pcap-bpf.h pcap-nam.h
101
102$(OBJDIR)\optimize.obj: optimize.c pcap-int.h pcap.h pcap-bpf.h gencode.h
103
104$(OBJDIR)\savefile.obj: savefile.c pcap-int.h pcap.h pcap-bpf.h
105
106$(OBJDIR)\pcap.obj: pcap.c pcap-dos.h pcap-int.h pcap.h pcap-bpf.h
107
108$(OBJDIR)\inet.obj: inet.c pcap-int.h pcap.h pcap-bpf.h
109
110$(OBJDIR)\grammar.obj: grammar.c pcap-int.h pcap.h pcap-bpf.h gencode.h &
111  pf.h pcap-nam.h
112
113$(OBJDIR)\scanner.obj: scanner.c pcap-int.h pcap.h pcap-bpf.h gencode.h &
114  pcap-nam.h tokdefs.h
115
116$(OBJDIR)\gencode.obj: gencode.c pcap-dos.h pcap-int.h pcap.h pcap-bpf.h &
117  ethertyp.h nlpid.h llc.h gencode.h atmuni31.h sunatmpo.h ppp.h sll.h &
118  arcnet.h pf.h pcap-nam.h
119
120$(OBJDIR)\nametoad.obj: nametoad.c pcap-int.h pcap.h pcap-bpf.h gencode.h &
121  pcap-nam.h ethertyp.h
122
123$(OBJDIR)\pcap-dos.obj: pcap-dos.c pcap.h pcap-bpf.h pcap-dos.h pcap-int.h &
124  msdos\pktdrvr.h
125
126$(OBJDIR)\pktdrvr.obj: msdos\pktdrvr.c gnuc.h pcap-dos.h pcap-int.h &
127  pcap.h pcap-bpf.h msdos\pktdrvr.h msdos\pkt_stub.inc
128
129$(OBJDIR)\ndis2.obj: msdos\ndis2.c pcap-dos.h pcap-int.h pcap.h pcap-bpf.h &
130  msdos\ndis2.h
131
132