1 | # $Id: Makefile.kmk 97071 2022-10-10 16:30:56Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # Sub-makefile for NAT Networking
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2006-2022 Oracle and/or its affiliates.
|
---|
8 | #
|
---|
9 | # This file is part of VirtualBox base platform packages, as
|
---|
10 | # available from https://www.virtualbox.org.
|
---|
11 | #
|
---|
12 | # This program is free software; you can redistribute it and/or
|
---|
13 | # modify it under the terms of the GNU General Public License
|
---|
14 | # as published by the Free Software Foundation, in version 3 of the
|
---|
15 | # License.
|
---|
16 | #
|
---|
17 | # This program is distributed in the hope that it will be useful, but
|
---|
18 | # WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | # General Public License for more details.
|
---|
21 | #
|
---|
22 | # You should have received a copy of the GNU General Public License
|
---|
23 | # along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | #
|
---|
25 | # SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | #
|
---|
27 |
|
---|
28 | SUB_DEPTH = ../../../..
|
---|
29 | include $(KBUILD_PATH)/subheader.kmk
|
---|
30 | ifdef VBOX_WITH_LWIP_NAT # entire file
|
---|
31 |
|
---|
32 | ifndef LWIP_SOURCES
|
---|
33 | include $(PATH_SUB_CURRENT)/../../Devices/Network/lwip-new/Config.kmk
|
---|
34 | endif
|
---|
35 |
|
---|
36 | #
|
---|
37 | # Globals
|
---|
38 | #
|
---|
39 | VBOX_PATH_NAT_SRC := $(PATH_SUB_CURRENT)
|
---|
40 |
|
---|
41 |
|
---|
42 | #
|
---|
43 | # Hardened stub exe for VBoxNetNAT.
|
---|
44 | #
|
---|
45 | ifdef VBOX_WITH_HARDENING
|
---|
46 | PROGRAMS += VBoxNetNATHardened
|
---|
47 | VBoxNetNATHardened_TEMPLATE = VBOXR3HARDENEDEXE
|
---|
48 | VBoxNetNATHardened_NAME = VBoxNetNAT
|
---|
49 | ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING
|
---|
50 | VBoxNetNATHardened_DEFS = SERVICE_NAME="VBoxNetNAT"
|
---|
51 | else
|
---|
52 | VBoxNetNATHardened_DEFS = SERVICE_NAME=\"VBoxNetNAT\"
|
---|
53 | endif
|
---|
54 | VBoxNetNATHardened_SOURCES = VBoxNetNATHardened.cpp
|
---|
55 | VBoxNetNATHardened_LDFLAGS.win = /SUBSYSTEM:windows
|
---|
56 | $(call VBOX_SET_VER_INFO_EXE,VBoxNetNATHardened,VirtualBox NAT Engine,$(VBOX_WINDOWS_ICON_FILE)) # Version info / description.
|
---|
57 | endif
|
---|
58 |
|
---|
59 |
|
---|
60 | #
|
---|
61 | # VBoxNetNAT.
|
---|
62 | #
|
---|
63 | ifdef VBOX_WITH_HARDENING
|
---|
64 | DLLS += VBoxNetNAT
|
---|
65 | else
|
---|
66 | PROGRAMS += VBoxNetNAT
|
---|
67 | endif
|
---|
68 | VBoxNetNAT_TEMPLATE := $(if-expr defined(VBOX_WITH_HARDENING),VBOXMAINDLL,VBOXMAINCLIENTEXE)
|
---|
69 | VBoxNetNAT_NAME := VBoxNetNAT
|
---|
70 | VBoxNetNAT_DEFS = \
|
---|
71 | IPv6 \
|
---|
72 | $(if $(VBOX_WITH_INTNET_SERVICE_IN_R3),VBOX_WITH_INTNET_SERVICE_IN_R3,)
|
---|
73 | # VBoxNetNAT_DEFS.linux = WITH_VALGRIND # instrument lwip memp.c
|
---|
74 | VBoxNetNAT_DEFS.win = VBOX_COM_OUTOFPROC_MODULE _WIN32_WINNT=0x501 # Windows XP
|
---|
75 | # Convince Solaris headers to expose socket stuff we need.
|
---|
76 | #
|
---|
77 | # Setting _XOPEN_SOURCE to either 500 or 600 would always work, but
|
---|
78 | # <sys/feature_tests.h> insists that 600 requires C99 and so it
|
---|
79 | # explodes for older g++. It also insists that 500 is NOT to be used
|
---|
80 | # with C99.
|
---|
81 | #
|
---|
82 | # Newer g++ in C++11 mode (formerly known as C++0x) needs 600, so it
|
---|
83 | # employs sleight of hand to pretend it's C99 to keep feature test
|
---|
84 | # happy.
|
---|
85 | #
|
---|
86 | # Compile the C code with settings that match g++. This probably
|
---|
87 | # should be centralized so that whole codebase uses consistent
|
---|
88 | # settings.
|
---|
89 | ifeq ($(KBUILD_TARGET),solaris)
|
---|
90 | ifneq ($(VBOX_GCC_VERSION_CXX),)
|
---|
91 | if $(VBOX_GCC_VERSION_CXX) >= 40600
|
---|
92 | # we compile C++ code with -std=c++0x / -std=c++11
|
---|
93 | VBoxNetNAT_CFLAGS.solaris += -std=c99
|
---|
94 | VBoxNetNAT_DEFS.solaris += _XOPEN_SOURCE=600
|
---|
95 | else
|
---|
96 | VBoxNetNAT_DEFS.solaris += _XOPEN_SOURCE=500
|
---|
97 | endif
|
---|
98 | endif
|
---|
99 | VBoxNetNAT_DEFS.solaris += __EXTENSIONS__=1
|
---|
100 | endif
|
---|
101 |
|
---|
102 | # (current dir is for for lwipopts.h)
|
---|
103 | VBoxNetNAT_INCS += . $(addprefix ../../Devices/Network/lwip-new/,$(LWIP_INCS))
|
---|
104 |
|
---|
105 | VBoxNetNAT_SOURCES = \
|
---|
106 | VBoxNetLwipNAT.cpp \
|
---|
107 | ../NetLib/IntNetIf.cpp \
|
---|
108 | ../NetLib/IntNetIfCtx.cpp \
|
---|
109 | ../NetLib/VBoxNetPortForwardString.cpp \
|
---|
110 | $(addprefix ../../Devices/Network/lwip-new/,$(LWIP_SOURCES)) \
|
---|
111 | proxy_pollmgr.c \
|
---|
112 | proxy_rtadvd.c \
|
---|
113 | proxy.c \
|
---|
114 | pxremap.c \
|
---|
115 | pxtcp.c \
|
---|
116 | pxudp.c \
|
---|
117 | pxdns.c \
|
---|
118 | fwtcp.c \
|
---|
119 | fwudp.c \
|
---|
120 | portfwd.c \
|
---|
121 | proxy_dhcp6ds.c \
|
---|
122 | proxy_tftpd.c
|
---|
123 |
|
---|
124 | ifeq ($(KBUILD_TARGET),win)
|
---|
125 | VBoxNetNAT_SOURCES += pxping_win.c # unprivileged Icmp API
|
---|
126 | else
|
---|
127 | VBoxNetNAT_SOURCES += pxping.c # raw sockets
|
---|
128 | VBoxNetNAT_CFLAGS.linux += -Wno-address-of-packed-member # Needed for GCC 9.
|
---|
129 | endif
|
---|
130 |
|
---|
131 | VBoxNetNAT_SOURCES.darwin += rtmon_bsd.c
|
---|
132 | VBoxNetNAT_SOURCES.freebsd += rtmon_bsd.c
|
---|
133 | VBoxNetNAT_SOURCES.linux += rtmon_linux.c
|
---|
134 | VBoxNetNAT_SOURCES.solaris += rtmon_bsd.c
|
---|
135 | VBoxNetNAT_SOURCES.win += \
|
---|
136 | rtmon_win.c \
|
---|
137 | RTWinPoll.cpp \
|
---|
138 | RTWinSocketPair.cpp
|
---|
139 |
|
---|
140 | VBoxNetNAT_LIBS = \
|
---|
141 | $(LIB_RUNTIME)
|
---|
142 | VBoxNetNAT_LIBS.solaris += socket nsl
|
---|
143 |
|
---|
144 | VBoxNetNAT_LDFLAGS.win = /SUBSYSTEM:windows
|
---|
145 |
|
---|
146 | # ifeq ($(VBOX_WITH_HARDENING),)
|
---|
147 | # ifn1of ($(KBUILD_TARGET), darwin win)
|
---|
148 | # # helper for debugging unprivileged
|
---|
149 | # VBoxNetNAT_DEFS += VBOX_RAWSOCK_DEBUG_HELPER
|
---|
150 | # VBoxNetNAT_SOURCES += getrawsock.c
|
---|
151 | # endif
|
---|
152 | # endif
|
---|
153 |
|
---|
154 |
|
---|
155 | ifdef VBOX_WITH_HARDENING
|
---|
156 | $(call VBOX_SET_VER_INFO_DLL,VBoxNetNAT,VirtualBox NAT Engine (dll),$(VBOX_WINDOWS_ICON_FILE)) # Version info / description.
|
---|
157 | else
|
---|
158 | $(call VBOX_SET_VER_INFO_EXE,VBoxNetNAT,VirtualBox NAT Engine,$(VBOX_WINDOWS_ICON_FILE)) # Version info / description.
|
---|
159 | endif
|
---|
160 |
|
---|
161 | endif # VBOX_WITH_LWIP_NAT
|
---|
162 | include $(FILE_KBUILD_SUB_FOOTER)
|
---|
163 |
|
---|