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