-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
43 lines (33 loc) · 1.1 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
# SPDX-License-Identifier: GPL-2.0
#
# Makefile for TRIPSO module.
#
KVER ?= $(shell uname -r)
KDIR ?= /lib/modules/$(KVER)/build/
DEPMOD = /sbin/depmod -a
CC ?= gcc
ifeq ($(KERNELRELEASE),)
CFLAGS ?= -O2 -g
endif
XFLAGS ?= $(shell pkg-config xtables --cflags 2>/dev/null)
XDIR ?= $(shell pkg-config --variable xtlibdir xtables)
VERSION = $(shell git -C $M describe --dirty)
VOPT = '-DVERSION="$(VERSION)"'
obj-m = xt_TRIPSO.o
CFLAGS_xt_TRIPSO.o = -DDEBUG $(VOPT)
all: xt_TRIPSO.ko libxt_TRIPSO.so
xt_TRIPSO.ko: xt_TRIPSO.c xt_TRIPSO.h
make -C $(KDIR) M=$(CURDIR) modules CONFIG_DEBUG_INFO=y
install: install-mod install-lib
install-mod: xt_TRIPSO.ko
make -C $(KDIR) M=$(CURDIR) modules_install INSTALL_MOD_PATH=$(DESTDIR)
install-lib: libxt_TRIPSO.so
install -D $< $(DESTDIR)$(shell pkg-config --variable xtlibdir xtables)/$<
%.so: %_sh.o
gcc -shared -o $@ $< $(shell pkg-config xtables --libs)
%_sh.o: libxt_TRIPSO.c xt_TRIPSO.h
gcc -Wall -Wunused -fPIC $(XFLAGS) $(CFLAGS) -o $@ -c $<
clean:
-make -C $(KDIR) M=$(CURDIR) clean
-rm -f *.so *.o modules.order
.PHONY: clean all install install-mod install-lib