summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 79958839a5560a1da7e356a6a09802b94a8044d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
TOP	= $(shell readlink -f .)

CC	= gcc
ARCH	= x86-linux64

ifeq ($(ARCH),x86-linux32)
CFLAGS	= -m32
endif

INSTALLDIR	= $(TOP)/inst.$(ARCH)

all: sources build pack

sources:
	cd $(TOP)/SOURCES && make

build:
	rm -Rf $(TOP)/build.$(ARCH) && mkdir $(TOP)/build.$(ARCH)
ifneq (,$(findstring x86-mingw,$(ARCH)))
	cd $(TOP)/build.$(ARCH) && \
		unzip $(TOP)/SOURCES/WpdPack_4_1_2.zip
	mkdir -p $(INSTALLDIR)/include
	mkdir -p $(INSTALLDIR)/lib
	cp -rf $(TOP)/build.$(ARCH)/WpdPack/Include/* $(INSTALLDIR)/include/
ifeq ($(ARCH),x86-mingw32)
	cp -f $(TOP)/build.$(ARCH)/WpdPack/Lib/*.a $(INSTALLDIR)/lib/
	cp -f $(TOP)/build.$(ARCH)/WpdPack/Lib/*.lib $(INSTALLDIR)/lib/
else
	cp -f $(TOP)/build.$(ARCH)/WpdPack/Lib/*.a $(INSTALLDIR)/lib/
	cp -f $(TOP)/build.$(ARCH)/WpdPack/Lib/x64/*.lib $(INSTALLDIR)/lib/
endif
else
	cd $(TOP)/build.$(ARCH) && \
		unzip $(TOP)/SOURCES/WpcapSrc_4_1_3.zip
	cd $(TOP)/build.$(ARCH)/winpcap/wpcap/libpcap && \
		mkdir -p $(INSTALLDIR)/bin && \
		chmod a+x ./configure && \
		CC=$(CC) CFLAGS=$(CFLAGS) \
		./configure --prefix=$(INSTALLDIR) && \
		make && make install
endif

pack:
	cd $(INSTALLDIR) && \
		tar -zcvf $(TOP)/libpcap-$(ARCH).tgz .

clean:
	find $(INSTALLDIR) -name "pcap*" | xargs rm -Rf
	find $(INSTALLDIR) -type f -name "libpcap*" | xargs rm -f
	rm -Rf build.$(ARCH)

fullclean:
	rm -Rf $(TOP)/inst.*
	rm -Rf $(TOP)/build.*
	rm -f $(TOP)/*.tgz