forked from Netsukuku/netsukuku
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.in
106 lines (87 loc) · 3.63 KB
/
Makefile.in
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
102
103
104
105
106
# This file is part of Netsukuku
# (c) Copyright 2021 d0p1 <[email protected]>
#
# This source code is free software; you can redistribute it and/or
# modify it under the terms of the GNU Public License as published
# by the Free Software Foundation; either version 2 of the License,
# or (at your option) any later version.
#
# This source code 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.
# Please refer to the GNU Public License for more details.
#
# You should have received a copy of the GNU Public License along with
# this source code; if not, write to:
# Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
CC ?= gcc
RM = rm -f
CFLAGS += %(CFLAGS) -Wall -Wextra -Isrc/
LDFLAGS += -lgmp -lpthread -lcrypto -lz
SRCS_COMMON = xmalloc.c log.c misc.c buffer.c endianness.c
SRCS_QSPN = qspn-empiric.c
SRCS_NETSUKUKU = accept.c llist.c ipv6-gmp.c inet.c request.c map.c gmap.c \
bmap.c pkts.c radar.c hook.c rehook.c tracer.c qspn.c \
hash.c daemon.c crypto.c snsd_cache.c andna_cache.c \
andna.c andns_lib.c err_errno.c dnslib.c andns.c \
andns_net.c andns_snsd.c ll_map.c libnetlink.c if.c \
krnl_route.c krnl_rule.c iptunnel.c route.c conf.c \
dns_wrapper.c igs.c mark.c libiptc/libip4tc.c libping.c \
ntk-console-server.c netsukuku.c
SRCS_NTKRESOLV = andns_lib.c andns_net.c crypto.c snsd_cache.c inet.c \
ll_map.c libnetlink.c err_errno.c ntkresolv.c
SRCS_NTKCONSOLE = ntk-console.c
SRCS_TEST = test_common.c test_buffer.c test_misc.c
OBJS_COMMON = $(addprefix src/, $(SRCS_COMMON:.c=.o))
OBJS_QSPN = $(addprefix src/, $(SRCS_QSPN:.c=.o))
OBJS_NETSUKUKU = $(addprefix src/, $(SRCS_NETSUKUKU:.c=.o))
OBJS_NTKRESOLV = $(addprefix src/, $(SRCS_NTKRESOLV:.c=.o))
OBJS_NTKCONSOLE = $(addprefix src/, $(SRCS_NTKCONSOLE:.c=.o))
OBJS_TEST = $(addprefix test/, $(SRCS_TEST:.c=.o))
OBJS = $(OBJS_QSPN) $(OBJS_NETSUKUKU) $(OBJS_NTKCONSOLE) $(OBJS_NTKRESOLV) \
$(OBJS_COMMON) $(OBJS_TEST)
test: CFLAGS += --coverage
test: LDFLAGS += -lcmocka --coverage
test: CC := gcc
all: ntkd ntkresolv ntkconsole qspn-empiric
ntkd: $(OBJS_NETSUKUKU) $(OBJS_COMMON)
$(CC) -o $@ $^ $(LDFLAGS)
ntkresolv: $(OBJS_NTKRESOLV) $(OBJS_COMMON)
$(CC) -o $@ $^ $(LDFLAGS)
ntkconsole: $(OBJS_NTKCONSOLE)
$(CC) -o $@ $^ $(LDFLAGS)
qspn-empiric: $(OBJS_QSPN) $(OBJS_COMMON)
$(CC) -o $@ $^ $(LDFLAGS)
test: $(OBJS_TEST) $(OBJS_COMMON)
$(CC) -o unittest $^ $(LDFLAGS)
@./unittest
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
clean:
$(RM) ntkd ntkresolv ntkconsole qspn unittest
$(RM) $(OBJS)
$(RM) $(OBJS:.o=.gcda)
$(RM) $(OBJS:.o=.gcno)
re: clean all
install:
install -d %(SYSROOT)%(DATA_DIR)
install -d %(SYSROOT)%(CONF_DIR)
install src/conf/netsukuku.conf %(SYSROOT)%(CONF_DIR)
install src/conf/andna_hostnames %(SYSROOT)%(CONF_DIR)
install src/conf/snsd_nodes %(SYSROOT)%(CONF_DIR)
install src/scripts/ip_masquerade.sh %(SYSROOT)%(CONF_DIR)
install src/scripts/rc.ntk %(SYSROOT)%(CONF_DIR)
install src/scripts/tc_shaper.sh %(SYSROOT)%(CONF_DIR)
install -d %(SYSROOT)%(MAN_DIR)/main8
install -d %(SYSROOT)%(MAN_DIR)/main4
install src/man/ntkd.8 %(SYSROOT)%(MAN_DIR)/man8
install src/man/ntk-wifi.8 %(SYSROOT)%(MAN_DIR)/man8
install src/man/ntk-resolv.8 %(SYSROOT)%(MAN_DIR)/man8
install src/man/andna.8 %(SYSROOT)%(MAN_DIR)/man8
install src/man/netsukuku.conf.5 %(SYSROOT)%(MAN_DIR)/man5
install -d %(SYSROOT)%(BIN_DIR)
install src/scripts/ntk-wifi %(SYSROOT)%(BIN_DIR)
install ntkd %(SYSROOT)%(BIN_DIR)
install ntkresolv %(SYSROOT)%(BIN_DIR)
install ntkconsole %(SYSROOT)%(BIN_DIR)
.PHONY: all test clean re install