-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.in
More file actions
136 lines (107 loc) · 4.26 KB
/
Makefile.in
File metadata and controls
136 lines (107 loc) · 4.26 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#
# VTun - Virtual Tunnel over TCP/IP network.
#
# Copyright (C) 1998-2016 Maxim Krasnyansky <max_mk@yahoo.com>
# Copyright (C) 2025 Jan-Espen Oversand <sigsegv@radiotube.org>
#
# VTun has been derived from VPPP package by Maxim Krasnyansky.
#
# 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; either version 2 of the License, or
# (at your option) any later version.
#
# 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.
#
# $Id: Makefile.in,v 1.11.2.8 2016/10/01 21:46:00 mtbishop Exp $
#
CC = @CC@
CFLAGS = @CFLAGS@ @CPPFLAGS@
LDFLAGS = @LDFLAGS@ @LIBS@
BISON = @BISON@
BISONFLAGS = -d
LEX = @LEX@
LEXFLAGS = -t
INSTALL = @INSTALL@
INSTALL_OWNER = -o root -g 0
prefix = @prefix@
exec_prefix = @exec_prefix@
SBIN_DIR = @sbindir@
BIN_DIR = @bindir@
MAN_DIR = @mandir@
ETC_DIR = @sysconfdir@
VAR_DIR = @localstatedir@
PID_FILE = ${VAR_DIR}/run/vtunemd.pid
CFG_FILE = ${ETC_DIR}/vtunemd.conf
STAT_DIR = ${VAR_DIR}/log/vtunemd
LOCK_DIR = ${VAR_DIR}/lock/vtunemd
DEFS = -DVTUN_CONFIG_FILE=\"$(CFG_FILE)\" -DVTUN_PID_FILE=\"$(PID_FILE)\" \
-DVTUN_STAT_DIR=\"$(STAT_DIR)\" -DVTUN_LOCK_DIR=\"$(LOCK_DIR)\"
OBJS = main.o vtun.o cfg_file.tab.o cfg_file.lex.o server.o client.o lib.o \
llist.o auth.o tunnel.o lock.o netlib.o \
tun_dev.o tap_dev.o pty_dev.o pipe_dev.o \
tcp_proto.o udp_proto.o \
linkfd.o lfd_shaper.o lfd_zlib.o lfd_lzo.o lfd_encrypt.o lfd_legacy_encrypt.o \
lfd_gcm_encrypt.o md5.o blowfish.o auth_prim.o auth1.o auth2.o \
dropcaps.o sys_dropcaps.o
CONFIGURE_FILES = Makefile config.status config.cache config.h config.log
%.o: %.c vtun.h lib.h
$(CC) $(CFLAGS) $(DEFS) -o $@ -c $<
vtunemd: $(OBJS)
$(CC) $(CFLAGS) -o vtunemd $(OBJS) $(LFD_OBJS) $(LDFLAGS)
cfg_file.tab.h:
$(BISON) $(BISONFLAGS) -b cfg_file cfg_file.y
cfg_file.tab.c: cfg_file.y cfg_kwords.h config.h cfg_file.tab.h
cfg_file.lex.c: cfg_file.l cfg_kwords.h config.h cfg_file.tab.h
$(LEX) $(LEXFLAGS) cfg_file.l > cfg_file.lex.c
depend:
makedepend -- $(CFLAGS) -- *.c
clean: clean-test
rm -f core cfg_file.tab.* cfg_file.lex.* *.o *~ .#* *.bak vtunemd
distclean: clean
rm -f $(CONFIGURE_FILES)
rm -f `cat vtun.drivers`
install_man:
$(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(MAN_DIR)/man8
$(INSTALL) -m 644 $(INSTALL_OWNER) vtunemd.8 $(DESTDIR)$(MAN_DIR)/man8
$(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(MAN_DIR)/man5
$(INSTALL) -m 644 $(INSTALL_OWNER) vtunemd.conf.5 $(DESTDIR)$(MAN_DIR)/man5
rm -f $(DESTDIR)$(MAN_DIR)/man8/vtunem.8
ln -s vtunemd.8 $(DESTDIR)$(MAN_DIR)/man8/vtunem.8
install_config:
$(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(ETC_DIR)
if [ ! -f $(ETC_DIR)/vtunemd.conf ]; then \
$(INSTALL) -m 600 $(INSTALL_OWNER) vtunemd.conf $(DESTDIR)$(ETC_DIR); \
fi
install: vtunemd install_config install_man
$(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(VAR_DIR)/run
$(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(STAT_DIR)
$(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(LOCK_DIR)
$(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(SBIN_DIR)
$(INSTALL) -m 755 $(INSTALL_OWNER) vtunemd $(DESTDIR)$(SBIN_DIR)
$(BIN_DIR)/strip $(DESTDIR)$(SBIN_DIR)/vtunemd
# Test configuration
TEST_DIR = tests
TEST_CFLAGS = $(CFLAGS) $(shell pkg-config --cflags check)
TEST_LDFLAGS = $(LDFLAGS) $(shell pkg-config --libs check)
# Test sources
TEST_SRCS = $(wildcard $(TEST_DIR)/unit/*.c) $(TEST_DIR)/test_runner.c
TEST_OBJS = $(TEST_SRCS:.c=.o)
# Test binary
TEST_BIN = run_tests
.PHONY: test clean-test
# Build and run tests
test: $(TEST_BIN)
./$(TEST_BIN)
# Build test-specific auth object with UNIT_TEST to expose wrappers
auth_ut.o: auth.c vtun.h lib.h
$(CC) $(CFLAGS) $(DEFS) -DUNIT_TEST -o $@ -c $<
$(TEST_BIN): $(TEST_OBJS) $(filter-out main.o auth.o, $(OBJS)) auth_ut.o
$(CC) -o $@ $(filter-out main.o auth.o, $(OBJS)) auth_ut.o $(LFD_OBJS) $(TEST_OBJS) $(TEST_LDFLAGS)
# Clean test artifacts
clean-test:
rm -f $(TEST_OBJS) $(TEST_BIN)
# DO NOT DELETE THIS LINE -- make depend depends on it.