summaryrefslogtreecommitdiffstats
path: root/src/VBox/Frontends/VBoxSDL/Makefile.kmk
blob: f0b11af9935cdc9eefd3461a2a7ff9d36a46f1a5 (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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# $Id: Makefile.kmk $
## @file
# Sub-Makefile for VBoxSDL (a simple frontend based on SDL).
#

#
# Copyright (C) 2006-2022 Oracle and/or its affiliates.
#
# This file is part of VirtualBox base platform packages, as
# available from https://www.virtualbox.org.
#
# 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, in version 3 of the
# License.
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <https://www.gnu.org/licenses>.
#
# SPDX-License-Identifier: GPL-3.0-only
#

SUB_DEPTH = ../../../..
include $(KBUILD_PATH)/subheader.kmk
if !defined(VBOX_WITH_HARDENING) || "$(KBUILD_TARGET)" != "darwin" # No hardened VBoxSDL on darwin.


ifdef VBOX_WITH_HARDENING
 #
 # Hardened VBoxSDL
 #
 PROGRAMS += VBoxSDLHardened
 VBoxSDLHardened_TEMPLATE = VBOXR3HARDENEDEXE
 VBoxSDLHardened_SOURCES = VBoxSDLHardened.cpp
 VBoxSDLHardened_NAME = VBoxSDL
 $(call VBOX_SET_VER_INFO_EXE,VBoxSDLHardened,VirtualBox Pure SDL Frontend,$(VBOX_WINDOWS_ICON_FILE)) # Version info / description.
endif


#
# VBoxSDL
#
ifdef VBOX_WITH_HARDENING
 DLLS += VBoxSDL
else
 PROGRAMS += VBoxSDL
endif
VBoxSDL_TEMPLATE  := $(if $(VBOX_WITH_HARDENING),VBOXMAINCLIENTDLL,VBOXMAINCLIENTEXE)
VBoxSDL_SDKS       = LIBSDL
VBoxSDL_SOURCES    = \
	VBoxSDL.cpp \
	Framebuffer.cpp \
	Helper.cpp \
	../Common/PasswordInput.cpp
VBoxSDL_SOURCES.darwin = \
	VBoxSDLMain-darwin.m \
	Framebuffer-darwin.m

VBoxSDL_DEFS       =
ifdef VBOX_WITH_SDL2
 VBoxSDL_DEFS     += VBOX_WITH_SDL2
endif
if !defined(VBOX_WITH_SDL2)
 ifdef VBOX_WITH_SECURELABEL
  VBoxSDL_DEFS    += VBOX_SECURELABEL
 endif
endif
VBoxSDL_DEFS.freebsd = VBOXSDL_WITH_X11
VBoxSDL_DEFS.linux = _GNU_SOURCE VBOXSDL_WITH_X11
VBoxSDL_DEFS.solaris = VBOXSDL_WITH_X11
ifdef VBOX_OPENGL
 #VBoxSDL_DEFS.linux += VBOX_OPENGL
endif
VBoxSDL_DEFS.win.x86 = _WIN32_WINNT=0x0500
VBoxSDL_DEFS.win.amd64 = _WIN32_WINNT=0x0510

VBoxSDL_INCS = \
	$(VBoxSDL_0_OUTDIR) \
	$(VBOX_GRAPHICS_INCS) \
	../Common
ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(KBUILD_TARGET)),) # X11
VBoxSDL_INCS += \
	$(VBOX_XCURSOR_INCS)
endif
ifneq ($(filter-out win solaris,$(KBUILD_TARGET)),)

VBoxSDL_LIBS = \
	$(LIB_SDK_LIBSDL_SDLMAIN)
endif
ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(KBUILD_TARGET)),) # X11
VBoxSDL_LIBS += \
	$(PATH_STAGE_DLL)/VBoxKeyboard$(VBOX_SUFF_DLL) \
	$(VBOX_XCURSOR_LIBS) \
	X11
VBoxSDL_LIBPATH = \
	$(VBOX_LIBPATH_X11)
endif
ifdef VBOX_OPENGL
 #VBoxSDL_LIBS.linux += GL
endif

VBoxSDL_LDFLAGS.darwin = \
	-framework Foundation -framework AppKit

VBoxSDL_CLEAN = $(VBoxSDL_0_OUTDIR)/Ico64x01.h
VBoxSDL_INTERMEDIATES = $(VBoxSDL_0_OUTDIR)/Ico64x01.h


# Convert the pnm-file to a byte array.
$$(VBoxSDL_0_OUTDIR)/Ico64x01.h: $(PATH_ROOT)/src/VBox/Frontends/VBoxSDL/ico64x01.pnm $(VBOX_BIN2C) | $$(dir $$@)
	$(call MSG_TOOL,bin2c,VBoxSDL,$<,$@)
	$(QUIET)$(VBOX_BIN2C) Ico64x01 $< $@

ifdef VBOX_WITH_HARDENING
$(call VBOX_SET_VER_INFO_DLL,VBoxSDL,VirtualBox Pure SDL Frontend,$(VBOX_WINDOWS_ICON_FILE)) # Version info / description.
else
$(call VBOX_SET_VER_INFO_EXE,VBoxSDL,VirtualBox Pure SDL Frontend,$(VBOX_WINDOWS_ICON_FILE)) # Version info / description.
endif


#
# tstSDL
#
PROGRAMS += tstSDL
tstSDL_TEMPLATE = VBOXR3NPEXE
tstSDL_SDKS = LIBSDL
tstSDL_INST = $(INST_TESTCASE)
tstSDL_SOURCES = \
	VBoxSDLTest.cpp
tstSDL_SOURCES.darwin = \
	VBoxSDLMain-darwin.m
tstSDL_DEFS = IN_RING3 IN_RT_R3 _GNU_SOURCE
tstSDL_DEFS.win.x86 = _WIN32_WINNT=0x0500
ifdef VBOX_OPENGL
tstSDL_DEFS.linux = VBOX_OPENGL
endif

tstSDL_LIBS = \
	$(LIB_RUNTIME)
ifneq ($(filter-out win solaris,$(KBUILD_TARGET)),)
tstSDL_LIBS += \
	$(LIB_SDK_LIBSDL_SDLMAIN)
endif

ifdef VBOX_OPENGL
tstSDL_LIBS.linux += GL
endif
ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(KBUILD_TARGET)),) # X11
tstSDL_LIBPATH = \
	$(VBOX_LIBPATH_X11)
endif

tstSDL_LDFLAGS.darwin = \
	-framework Foundation -framework AppKit

## @todo What was this stuff doing here? The exception config is saying two different things, and why just -O for release builds?
#tstSDL_CXXFLAGS.win = \
#	-EHsc
#tstSDL_CXXFLAGS.linux = \
#	-DNDEBUG -DTRIMMED -O -Wall -fno-rtti -fno-exceptions \
#	-Wno-non-virtual-dtor -Wno-long-long -fshort-wchar -pthread -pipe
# Is this what's intended? Why -fshort-wchar?
tstSDL_DEFS.linux = NDEBUG TRIMMED
tstSDL_CXXFLAGS.linux = -O -Wall -Wno-non-virtual-dtor -Wno-long-long -fshort-wchar


endif # !VBOX_WITH_HARDENING || "$(KBUILD_TARGET)" != "darwin"
include $(FILE_KBUILD_SUB_FOOTER)