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