summaryrefslogtreecommitdiff
path: root/src/VBox/NetworkServices/NAT/Makefile.kmk
blob: a482d1e3486f5b8f36e657f797363ed9e0aadedc (plain)
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
# $Id$
## @file
#

#
# Copyright (C) 2006-2012 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# you can redistribute it and/or modify it under the terms of the GNU
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#

SUB_DEPTH = ../../../..
include $(KBUILD_PATH)/subheader.kmk

ifdef VBOX_WITH_LWIP_NAT
# XXX: do not depend on order
ifndef LWIP_SOURCES
  include ../../Devices/Network/lwip-new/Makefile.kmk
endif

ifdef VBOX_WITH_HARDENING
 PROGRAMS += VBoxNetLwipNATHardened
 DLLS += VBoxNetLwipNAT
else
 PROGRAMS += VBoxNetLwipNAT
endif

ifdef VBOX_WITH_HARDENING
 VBoxNetLwipNATHardened_SOURCES += VBoxNetNATHardened.cpp
 VBoxNetLwipNATHardened_DEFS += SERVICE_NAME=\"VBoxNetNAT\"
 VBoxNetLwipNATHardened_TEMPLATE=VBOXR3HARDENEDEXE
 VBoxNetLwipNATHardened_NAME = VBoxNetNAT
 VBoxNetLwipNATHardened_LDFLAGS.win = /SUBSYSTEM:windows
endif

VBoxNetLwipNAT_TEMPLATE =
VBoxNetLwipNAT_TEMPLATE := VBOXMAIN$(if-expr defined(VBOX_WITH_HARDENING),DLL,CLIENTEXE)
VBoxNetLwipNAT_NAME = VBoxNetNAT
VBoxNetLwipNAT_DEFS += ${LWIP_DEFS} IPv6
# VBoxNetLwipNAT_DEFS.linux += WITH_VALGRIND # instrument lwip memp.c
VBoxNetLwipNAT_DEFS.win += VBOX_COM_OUTOFPROC_MODULE _WIN32_WINNT=0x501 # Windows XP
VBoxNetLwipNAT_SOURCES += VBoxNetLwipNAT.cpp	\
	../NetLib/VBoxNetBaseService.cpp \
	../NetLib/VBoxNetPortForwardString.cpp \
	../NetLib/VBoxNetIntIf.cpp \
	../NetLib/VBoxNetUDP.cpp \
	../NetLib/VBoxNetARP.cpp \
	../NetLib/ComHostUtils.cpp

VBoxNetLwipNAT_LIBS = \
	$(LIB_RUNTIME)
VBoxNetLwipNAT_LIBS.solaris += socket nsl
VBoxNetLwipNAT_LDFLAGS.win = /SUBSYSTEM:windows

# Convince Solaris headers to expose socket stuff we need.
#
# Setting _XOPEN_SOURCE to either 500 or 600 would always work, but
# <sys/feature_tests.h> insists that 600 requires C99 and so it
# explodes for older g++.  It also insists that 500 is NOT to be used
# with C99.
#
# Newer g++ in C++11 mode (formerly known as C++0x) needs 600, so it
# employs sleight of hand to pretend it's C99 to keep feature test
# happy.
#
# Compile the C code with settings that match g++.  This probably
# should be centralized so that whole codebase uses consistent
# settings.
ifeq ($(KBUILD_TARGET),solaris)
 ifneq ($(VBOX_GCC_VERSION_CXX),)
  ifneq ($(int-ge $(VBOX_GCC_VERSION_CXX),40600),)
   # we compile C++ code with -std=c++0x / -std=c++11
   VBoxNetLwipNAT_CFLAGS.solaris += -std=c99
   VBoxNetLwipNAT_DEFS.solaris += _XOPEN_SOURCE=600
  else
   VBoxNetLwipNAT_DEFS.solaris += _XOPEN_SOURCE=500
  endif
 endif
 VBoxNetLwipNAT_DEFS.solaris += __EXTENSIONS__=1
endif

VBoxNetLwipNAT_SOURCES += \
    proxy_pollmgr.c \
    proxy_rtadvd.c \
    proxy.c \
    pxremap.c \
    pxtcp.c \
    pxudp.c \
    pxdns.c \
    fwtcp.c \
    fwudp.c \
    portfwd.c \
    proxy_dhcp6ds.c \
    proxy_tftpd.c

ifeq ($(KBUILD_TARGET),win)
 # unprivileged Icmp API
 VBoxNetLwipNAT_SOURCES += pxping_win.c
else
 # raw sockets
 VBoxNetLwipNAT_SOURCES += pxping.c
endif

# ifeq ($(VBOX_WITH_HARDENING),)
#  ifn1of ($(KBUILD_TARGET), darwin win)
#   # helper for debugging unprivileged
#   VBoxNetLwipNAT_DEFS += VBOX_RAWSOCK_DEBUG_HELPER
#   VBoxNetLwipNAT_SOURCES += getrawsock.c
#  endif
# endif

VBoxNetLwipNAT_SOURCES.darwin  += rtmon_bsd.c
VBoxNetLwipNAT_SOURCES.freebsd += rtmon_bsd.c
VBoxNetLwipNAT_SOURCES.linux   += rtmon_linux.c
VBoxNetLwipNAT_SOURCES.solaris += rtmon_bsd.c
VBoxNetLwipNAT_SOURCES.win     += rtmon_win.c

VBoxNetLwipNAT_SOURCES.win += \
    RTWinPoll.cpp \
    RTWinSocketPair.cpp

VBoxNetLwipNAT_INCS += . # for lwipopts.h
$(eval $(call def_vbox_lwip_public, \
    VBoxNetLwipNAT, ../../Devices/Network/lwip-new))
endif

include $(FILE_KBUILD_SUB_FOOTER)