forked from luainkernel/lunatik
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
29 lines (20 loc) · 823 Bytes
/
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
# SPDX-FileCopyrightText: (c) 2024 Mohammad Shehar Yaar Tausif <[email protected]>
# SPDX-License-Identifier: MIT OR GPL-2.0-only
ifndef LUAXTABLE_MODULE
$(error LUAXTABLE_MODULE is not defined. Run LUAXTABLE_MODULE=<module> make)
endif
CFLAGS = -DLUAXTABLE_MODULE=\"${LUAXTABLE_MODULE}\" -O2 -Wall -I../../../lib
XTABLES_SO_DIR = $(shell pkg-config xtables --variable xtlibdir)
LUA_FLAGS = -llua -lm
all:
make libxt_${LUAXTABLE_MODULE}.so
install:
sudo cp libxt_*.so ${XTABLES_SO_DIR}
uninstall:
sudo rm -f ${XTABLES_SO_DIR}/libxt_${LUAXTABLE_MODULE}.so
clean:
rm -f libxt_*.so libxt_*.o
lib%.so: lib%.o
gcc -shared -fPIC -o libxt_${LUAXTABLE_MODULE}.so libxt_${LUAXTABLE_MODULE}.o ${LUA_FLAGS};
lib%.o: luaxt.c
gcc ${CFLAGS} ${LUA_FLAGS} -D_INIT=lib$*_init -fPIC -c -o libxt_${LUAXTABLE_MODULE}.o $<;