-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
78 lines (69 loc) · 2.38 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
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# Soft: The main goal of gtp-guard is to provide robust and secure
# extensions to GTP protocol (GPRS Tunneling Procol). GTP is
# widely used for data-plane in mobile core-network. gtp-guard
# implements a set of 3 main frameworks:
# A Proxy feature for data-plane tweaking, a Routing facility
# to inter-connect and a Firewall feature for filtering,
# rewriting and redirecting.
#
# Authors: Alexandre Cassen, <[email protected]>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public
# License Version 3.0 as published by the Free Software Foundation;
# either version 3.0 of the License, or (at your option) any later
# version.
#
# Copyright (C) 2023-2024 Alexandre Cassen, <[email protected]>
#
EXEC = gtp-guard
BIN = bin
VERSION := $(shell cat VERSION)
TARBALL = $(EXEC)-$(VERSION).tar.xz
TARFILES = AUTHOR VERSION LICENSE README.md bin src lib Makefile libbpf
prefix ?= /usr/local
exec_prefix ?= ${prefix}
sbindir ?= ${exec_prefix}/sbin
sysconfdir ?= ${prefix}/etc
init_script = etc/init.d/gtp-guard.init
conf_file = etc/gtp-guard/gtp-guard.conf
CC ?= gcc
LDFLAGS = -lpthread -lcrypt -ggdb -lm -lz -lresolv -lelf
SUBDIRS = lib src src/bpf
LIBBPF = libbpf
OBJDIR = $(LIBBPF)/src
all: $(OBJDIR)/libbpf.a
@set -e; \
for i in $(SUBDIRS); do \
$(MAKE) -C $$i || exit 1; done && \
echo "Building $(BIN)/$(EXEC)" && \
$(CC) -o $(BIN)/$(EXEC) `find $(SUBDIRS) -name '*.[oa]'` $(OBJDIR)/libbpf.a $(LDFLAGS)
# strip $(BIN)/$(EXEC)
@echo ""
@echo "Make complete"
$(OBJDIR)/libbpf.a:
@$(MAKE) -C $(LIBBPF)/src BUILD_STATIC_ONLY=y NO_PKG_CONFIG=y
@ln -sf ../include/uapi $(OBJDIR)
clean:
@$(MAKE) -C $(LIBBPF)/src clean
@rm -vf $(OBJDIR)/uapi
@set -e; \
for i in $(SUBDIRS); do \
$(MAKE) -C $$i clean; done
@rm -vf $(BIN)/$(EXEC)
@echo ""
@echo "Make complete"
uninstall:
rm -f $(sbindir)/$(EXEC)
install:
install -d $(sbindir)
install -m 700 $(BIN)/$(EXEC) $(sbindir)/$(EXEC)-$(VERSION)
ln -sf $(sbindir)/$(EXEC)-$(VERSION) $(sbindir)/$(EXEC)
tarball: clean
@mkdir $(EXEC)-$(VERSION)
@cp -a $(TARFILES) $(EXEC)-$(VERSION)
@tar -cJf $(TARBALL) $(EXEC)-$(VERSION)
@rm -rf $(EXEC)-$(VERSION)
@echo $(TARBALL)