forked from fredburger/xt_sslpin
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
101 lines (83 loc) · 2.53 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#
# xt_sslpin makefile
#
# Copyright (C) 2010-2013 fredburger (github.com/fredburger)
#
# This program is free software; you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program; if not, write to
# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
.PHONY: debug all modules modules_install install clean log_install format
# Detect libdir: /lib vs. /lib64
libdir.x86_64 = /lib64
libdir.i686 = /lib
libdir = $(libdir.$(shell uname -m))
# System configuration
MODULES_DIR := /lib/modules/$(shell uname -r)
KERNEL_DIR := $(MODULES_DIR)/build
XTABLES_DIRNAME := xtables
#XTABLES_DIRNAME := iptables
#XTABLES_DIR := $(libdir)/$(XTABLES_DIRNAME)
XTABLES_DIR := $(libdir.i686)/$(XTABLES_DIRNAME)
# --
LIB_INSTALLPATH := $(XTABLES_DIR)/libxt_sslpin.so
MOD_INSTALLPATH := $(MODULES_DIR)/extra/xt_sslpin.ko
CLIBFLAGS := -O2 -Wall -fPIC
CPPFLAGS :=
obj-m := xt_sslpin.o
lib%.so: lib%.o
$(CC) -shared -o $@ $^;
lib%.o: lib%.c
$(CC) $(CLIBFLAGS) $(CPPFLAGS) -D_INIT=lib$*_init -c -o $@ $<;
all: libxt_sslpin.so
@echo $(LIB_INSTALLPATH)
KCPPFLAGS="$(CPPFLAGS)" \
make -C $(KERNEL_DIR) M=$$PWD;
debug: CPPFLAGS = -DDEBUG=1
debug: all
modules:
KCPPFLAGS="$(CPPFLAGS)" \
make -C $(KERNEL_DIR) M=$$PWD $@;
modules_install:
KCPPFLAGS="$(CPPFLAGS)" \
make -C $(KERNEL_DIR) M=$$PWD $@;
install: log_install all modules_install
depmod -a
install -p -m 0644 libxt_sslpin.so $(XTABLES_DIR)
@echo
@echo "INSTALLED"
@echo
modinfo xt_sslpin
@echo
@echo "libxt_sslpin.so:"
@ls -al $(LIB_INSTALLPATH)
@echo
uninstall: log_install
@if [ -f $(MOD_INSTALLPATH) ]; then \
modprobe -r xt_sslpin && \
rm -f $(MOD_INSTALLPATH) && \
depmod -a; \
fi
@if [ -f $(LIB_INSTALLPATH) ]; then \
rm -f /test; \
fi
@echo
@echo "UNINSTALLED"
@echo
clean:
make -C $(KERNEL_DIR) M=$$PWD $@;
@rm -f libxt_sslpin.so
log_install:
@echo
@echo "MODULES_DIR: $(MODULES_DIR)"
@echo "KERNEL_DIR: $(KERNEL_DIR)"
@echo "XTABLES_DIR: $(XTABLES_DIR)"
@echo
format:
find -type f -name '*.[ch]' | xargs astyle --options=.astylerc