forked from marcelog/SimplePcap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GNUmakefile
48 lines (41 loc) · 928 Bytes
/
GNUmakefile
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
PHPINC += /usr/include/php
SWIG += /usr/bin/swig
OUTPUTDIR += ./build
SRCDIR += ./src
INCDIR += ./include
SHELL = /bin/bash
.SUFFIXES =
.SUFFIXES = .cpp .o
NAME = SimplePcap
CPP = g++
CPPFLAGS = \
-fPIC \
-I${INCDIR} \
-I${OUTPUTDIR}/build \
-I${PHPINC}/Zend \
-I${PHPINC}/main \
-I${PHPINC}/ext \
-I${PHPINC}/TSRM \
-I${PHPINC}
LD = ld
LIBS = -lpcap -lstdc++
LDFLAGS +=
all: prepare ${OUTPUTDIR}/${NAME}.so
prepare:
mkdir -p ${OUTPUTDIR}
${OUTPUTDIR}/${NAME}_swig.cpp:
${SWIG} -outdir ${OUTPUTDIR} \
-oh ${OUTPUTDIR}/${NAME}_swig.h \
-o ${OUTPUTDIR}/${NAME}_swig.cpp \
-c++ -php \
${NAME}.i
${OUTPUTDIR}/${NAME}.so: \
${OUTPUTDIR}/SimplePcap.o \
${OUTPUTDIR}/Packet.o \
${OUTPUTDIR}/Exception.o \
${OUTPUTDIR}/SimplePcap_swig.o
ld -shared ${LDFLAGS} ${OUTPUTDIR}/*.o -o ${OUTPUTDIR}/${NAME}.so ${LIBS}
clean:
rm -rf ${OUTPUTDIR}
$(OUTPUTDIR)/%.o: $(SRCDIR)/%.cpp
${CPP} -c ${CPPFLAGS} -o $@ $<