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