-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
63 lines (50 loc) · 1.07 KB
/
Makefile
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
57
58
59
60
61
62
63
prefix := /usr/local
libdir := ${prefix}/lib
includedir := ${prefix}/include
rootdir := $(PWD)
SRC := ${rootdir}/src
INC := ${rootdir}/include
BIN := ${rootdir}/bin
LIB := ${rootdir}/lib
EXM := ${rootdir}/example
MAJOR := 1
MINOR := 0
PROG := libjpkt
LIBJPKT := $(PROG).$(MAJOR).$(MINOR)
CC := gcc
AR := ar
CFLAGS := -O2 -Wall -Werror -fPIC
ARFLAGS := -rcs
DEPS = \
$(shell pkg-config --libs libpcap glib-2.0 json-glib-1.0) \
$(shell pkg-config --cflags glib-2.0 json-glib-1.0)
OBJS := \
jpkt.o \
jpkt-packet.o \
jpkt-queue.o \
jpkt-eth.o \
jpkt-arp.o \
jpkt-ip.o \
jpkt-udp.o \
jpkt-tcp.o \
jpkt-icmp.o \
jpkt-data.o
.PHONY: lib
lib:
mkdir -p $(LIB) $(BIN)
$(CC) $(CFLAGS) -c $(SRC)/*.c -I $(INC) $(DEPS)
$(CC) -shared -o $(LIB)/$(LIBJPKT).so $(OBJS)
$(AR) $(ARFLAGS) $(LIB)/$(LIBJPKT).a $(OBJS)
mv $(OBJS) $(BIN)
example: lib
$(CC) $(CFLAGS) -g $(EXM)/[email protected] $(LIB)/$(LIBJPKT).so -o $(EXM)/$@ -I $(INC) $(DEPS)
install: lib
@echo
@echo install
uninstall:
@echo Uninstall
clean:
rm -rf $(BIN)
cleanall: clean
rm -rf $(LIB)
rm -rf $(EXM)/example