VirtualBox

Changeset 82746 in vbox


Ignore:
Timestamp:
Jan 14, 2020 8:46:09 PM (5 years ago)
Author:
vboxsync
Message:

VBoxNetNAT: No need for custom RC file, use template and get version info in the hardened .exe too. Cleaned up the makefile, renaming the target to match the output.

Location:
trunk/src/VBox/NetworkServices/NAT
Files:
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/NetworkServices/NAT/Makefile.kmk

    r81673 r82746  
    1818SUB_DEPTH = ../../../..
    1919include $(KBUILD_PATH)/subheader.kmk
    20 ifdef VBOX_WITH_LWIP_NAT
     20ifdef VBOX_WITH_LWIP_NAT # entire file
    2121
    22 VBOX_PATH_NAT_SRC := $(PATH_SUB_CURRENT)
    23 
    24  # XXX: do not depend on order
    2522 ifndef LWIP_SOURCES
    2623  include $(PATH_SUB_CURRENT)/../../Devices/Network/lwip-new/Config.kmk
    2724 endif
    2825
     26#
     27# Globals
     28#
     29VBOX_PATH_NAT_SRC := $(PATH_SUB_CURRENT)
    2930
     31
     32#
     33# Hardened stub exe for VBoxNetNAT.
     34#
    3035 ifdef VBOX_WITH_HARDENING
    31   #
    32   # Hardened stub exe for VBoxNetLwipNAT.
    33   #
    34   PROGRAMS += VBoxNetLwipNATHardened
    35   VBoxNetLwipNATHardened_TEMPLATE = VBOXR3HARDENEDEXE
    36   VBoxNetLwipNATHardened_NAME     = VBoxNetNAT
    37   VBoxNetLwipNATHardened_DEFS     = SERVICE_NAME=\"VBoxNetNAT\"
    38   VBoxNetLwipNATHardened_SOURCES  = VBoxNetNATHardened.cpp
    39   VBoxNetLwipNATHardened_SOURCES.win = $(VBoxNetLwipNAT_0_OUTDIR)/VBoxNetLwipNAT-icon.rc
    40   VBoxNetLwipNATHardened_LDFLAGS.win = /SUBSYSTEM:windows
     36PROGRAMS += VBoxNetNATHardened
     37VBoxNetNATHardened_TEMPLATE = VBOXR3HARDENEDEXE
     38VBoxNetNATHardened_NAME     = VBoxNetNAT
     39VBoxNetNATHardened_DEFS     = SERVICE_NAME=\"VBoxNetNAT\"
     40VBoxNetNATHardened_SOURCES  = VBoxNetNATHardened.cpp
     41VBoxNetNATHardened_LDFLAGS.win = /SUBSYSTEM:windows
     42$(call VBOX_SET_VER_INFO_EXE,VBoxNetNATHardened,VirtualBox NAT Engine,$(VBOX_WINDOWS_ICON_FILE)) # Version info / description.
    4143 endif
    4244
    4345
    44  #
    45  # VBoxNetLwipNAT.
    46  #
     46#
     47# VBoxNetNAT.
     48#
    4749 ifdef VBOX_WITH_HARDENING
    48   DLLS += VBoxNetLwipNAT
     50DLLS     += VBoxNetNAT
    4951 else
    50   PROGRAMS += VBoxNetLwipNAT
     52PROGRAMS += VBoxNetNAT
    5153 endif
    52  VBoxNetLwipNAT_TEMPLATE := $(if-expr defined(VBOX_WITH_HARDENING),VBOXMAINDLL,VBOXMAINCLIENTEXE)
    53  VBoxNetLwipNAT_NAME     := VBoxNetNAT
    54  VBoxNetLwipNAT_DEFS      = IPv6
    55  # VBoxNetLwipNAT_DEFS.linux = WITH_VALGRIND # instrument lwip memp.c
    56  VBoxNetLwipNAT_DEFS.win  = VBOX_COM_OUTOFPROC_MODULE _WIN32_WINNT=0x501 # Windows XP
    57  # Convince Solaris headers to expose socket stuff we need.
    58  #
    59  # Setting _XOPEN_SOURCE to either 500 or 600 would always work, but
    60  # <sys/feature_tests.h> insists that 600 requires C99 and so it
    61  # explodes for older g++.  It also insists that 500 is NOT to be used
    62  # with C99.
    63  #
    64  # Newer g++ in C++11 mode (formerly known as C++0x) needs 600, so it
    65  # employs sleight of hand to pretend it's C99 to keep feature test
    66  # happy.
    67  #
    68  # Compile the C code with settings that match g++.  This probably
    69  # should be centralized so that whole codebase uses consistent
    70  # settings.
     54VBoxNetNAT_TEMPLATE := $(if-expr defined(VBOX_WITH_HARDENING),VBOXMAINDLL,VBOXMAINCLIENTEXE)
     55VBoxNetNAT_NAME     := VBoxNetNAT
     56VBoxNetNAT_DEFS      = IPv6
     57# VBoxNetNAT_DEFS.linux = WITH_VALGRIND # instrument lwip memp.c
     58VBoxNetNAT_DEFS.win  = VBOX_COM_OUTOFPROC_MODULE _WIN32_WINNT=0x501 # Windows XP
     59# Convince Solaris headers to expose socket stuff we need.
     60#
     61# Setting _XOPEN_SOURCE to either 500 or 600 would always work, but
     62# <sys/feature_tests.h> insists that 600 requires C99 and so it
     63# explodes for older g++.  It also insists that 500 is NOT to be used
     64# with C99.
     65#
     66# Newer g++ in C++11 mode (formerly known as C++0x) needs 600, so it
     67# employs sleight of hand to pretend it's C99 to keep feature test
     68# happy.
     69#
     70# Compile the C code with settings that match g++.  This probably
     71# should be centralized so that whole codebase uses consistent
     72# settings.
    7173 ifeq ($(KBUILD_TARGET),solaris)
    7274  ifneq ($(VBOX_GCC_VERSION_CXX),)
    7375   ifneq ($(int-ge $(VBOX_GCC_VERSION_CXX),40600),)
    74     # we compile C++ code with -std=c++0x / -std=c++11
    75     VBoxNetLwipNAT_CFLAGS.solaris += -std=c99
    76     VBoxNetLwipNAT_DEFS.solaris += _XOPEN_SOURCE=600
     76# we compile C++ code with -std=c++0x / -std=c++11
     77VBoxNetNAT_CFLAGS.solaris += -std=c99
     78VBoxNetNAT_DEFS.solaris += _XOPEN_SOURCE=600
    7779   else
    78     VBoxNetLwipNAT_DEFS.solaris += _XOPEN_SOURCE=500
     80VBoxNetNAT_DEFS.solaris += _XOPEN_SOURCE=500
    7981   endif
    8082  endif
    81   VBoxNetLwipNAT_DEFS.solaris += __EXTENSIONS__=1
     83VBoxNetNAT_DEFS.solaris += __EXTENSIONS__=1
    8284 endif
    8385
    84  # (current dir is for for lwipopts.h)
    85  VBoxNetLwipNAT_INCS += . $(addprefix ../../Devices/Network/lwip-new/,$(LWIP_INCS))
     86# (current dir is for for lwipopts.h)
     87VBoxNetNAT_INCS += . $(addprefix ../../Devices/Network/lwip-new/,$(LWIP_INCS))
    8688
    87  VBoxNetLwipNAT_SOURCES = \
    88         VBoxNetLwipNAT.cpp \
    89         ../NetLib/VBoxNetBaseService.cpp \
    90         ../NetLib/VBoxNetPortForwardString.cpp \
    91         ../NetLib/VBoxNetIntIf.cpp \
    92         ../NetLib/VBoxNetUDP.cpp \
    93         ../NetLib/VBoxNetARP.cpp \
    94         ../NetLib/ComHostUtils.cpp \
    95         $(addprefix ../../Devices/Network/lwip-new/,$(LWIP_SOURCES)) \
    96         proxy_pollmgr.c \
    97         proxy_rtadvd.c \
    98         proxy.c \
    99         pxremap.c \
    100         pxtcp.c \
    101         pxudp.c \
    102         pxdns.c \
    103         fwtcp.c \
    104         fwudp.c \
    105         portfwd.c \
    106         proxy_dhcp6ds.c \
    107         proxy_tftpd.c
     89VBoxNetNAT_SOURCES = \
     90        VBoxNetLwipNAT.cpp \
     91        ../NetLib/VBoxNetBaseService.cpp \
     92        ../NetLib/VBoxNetPortForwardString.cpp \
     93        ../NetLib/VBoxNetIntIf.cpp \
     94        ../NetLib/VBoxNetUDP.cpp \
     95        ../NetLib/VBoxNetARP.cpp \
     96        ../NetLib/ComHostUtils.cpp \
     97        $(addprefix ../../Devices/Network/lwip-new/,$(LWIP_SOURCES)) \
     98        proxy_pollmgr.c \
     99        proxy_rtadvd.c \
     100        proxy.c \
     101        pxremap.c \
     102        pxtcp.c \
     103        pxudp.c \
     104        pxdns.c \
     105        fwtcp.c \
     106        fwudp.c \
     107        portfwd.c \
     108        proxy_dhcp6ds.c \
     109        proxy_tftpd.c
    108110
    109111 ifeq ($(KBUILD_TARGET),win)
    110   VBoxNetLwipNAT_SOURCES += pxping_win.c # unprivileged Icmp API
     112VBoxNetNAT_SOURCES += pxping_win.c # unprivileged Icmp API
    111113 else
    112   VBoxNetLwipNAT_SOURCES        += pxping.c     # raw sockets
    113   VBoxNetLwipNAT_CFLAGS.linux   += -Wno-address-of-packed-member # Needed for GCC 9.
     114VBoxNetNAT_SOURCES        += pxping.c     # raw sockets
     115VBoxNetNAT_CFLAGS.linux   += -Wno-address-of-packed-member # Needed for GCC 9.
    114116 endif
    115117
    116  VBoxNetLwipNAT_SOURCES.darwin  += rtmon_bsd.c
    117  VBoxNetLwipNAT_SOURCES.freebsd += rtmon_bsd.c
    118  VBoxNetLwipNAT_SOURCES.linux   += rtmon_linux.c
    119  VBoxNetLwipNAT_SOURCES.solaris += rtmon_bsd.c
    120  VBoxNetLwipNAT_SOURCES.win     += \
    121         rtmon_win.c \
    122         RTWinPoll.cpp \
    123         RTWinSocketPair.cpp
     118VBoxNetNAT_SOURCES.darwin  += rtmon_bsd.c
     119VBoxNetNAT_SOURCES.freebsd += rtmon_bsd.c
     120VBoxNetNAT_SOURCES.linux   += rtmon_linux.c
     121VBoxNetNAT_SOURCES.solaris += rtmon_bsd.c
     122VBoxNetNAT_SOURCES.win     += \
     123        rtmon_win.c \
     124        RTWinPoll.cpp \
     125        RTWinSocketPair.cpp
    124126
    125  VBoxNetLwipNAT_LIBS = \
     127VBoxNetNAT_LIBS = \
    126128        $(LIB_RUNTIME)
    127  VBoxNetLwipNAT_LIBS.solaris += socket nsl
     129VBoxNetNAT_LIBS.solaris += socket nsl
    128130
    129  VBoxNetLwipNAT_LDFLAGS.win = /SUBSYSTEM:windows
     131VBoxNetNAT_LDFLAGS.win = /SUBSYSTEM:windows
    130132
    131  # ifeq ($(VBOX_WITH_HARDENING),)
    132  #  ifn1of ($(KBUILD_TARGET), darwin win)
    133  #   # helper for debugging unprivileged
    134  #   VBoxNetLwipNAT_DEFS += VBOX_RAWSOCK_DEBUG_HELPER
    135  #   VBoxNetLwipNAT_SOURCES += getrawsock.c
    136  #  endif
    137  # endif
     133# ifeq ($(VBOX_WITH_HARDENING),)
     134#  ifn1of ($(KBUILD_TARGET), darwin win)
     135#   # helper for debugging unprivileged
     136#   VBoxNetNAT_DEFS += VBOX_RAWSOCK_DEBUG_HELPER
     137#   VBoxNetNAT_SOURCES += getrawsock.c
     138#  endif
     139# endif
    138140
    139  ifeq ($(KBUILD_TARGET),win)
    140   # Icon include file.
    141   VBoxNetLwipNAT_SOURCES  += VBoxNetNAT.rc
    142   VBoxNetNAT.rc_INCS       = $(VBoxNetLwipNAT_0_OUTDIR)
    143   VBoxNetNAT.rc_DEPS       = $(VBoxNetLwipNAT_0_OUTDIR)/VBoxNetLwipNAT-icon.rc
    144   VBoxNetNAT.rc_CLEAN      = $(VBoxNetLwipNAT_0_OUTDIR)/VBoxNetLwipNAT-icon.rc
    145   $$(VBoxNetLwipNAT_0_OUTDIR)/VBoxNetLwipNAT-icon.rc: $(VBOX_WINDOWS_ICON_FILE) $$(VBoxNetLwipNAT_DEFPATH)/Makefile.kmk | $$(dir $$@)
    146         $(RM) -f $@
    147         $(APPEND) $@ 'IDI_VIRTUALBOX ICON DISCARDABLE "$(subst /,\\,$(VBOX_WINDOWS_ICON_FILE))"'
    148  endif # win
     141
     142 ifdef VBOX_WITH_HARDENING
     143$(call VBOX_SET_VER_INFO_DLL,VBoxNetNAT,VirtualBox NAT Engine (dll),$(VBOX_WINDOWS_ICON_FILE)) # Version info / description.
     144 else
     145$(call VBOX_SET_VER_INFO_EXE,VBoxNetNAT,VirtualBox NAT Engine,$(VBOX_WINDOWS_ICON_FILE)) # Version info / description.
     146 endif
    149147
    150148endif # VBOX_WITH_LWIP_NAT
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette