1 | # $Id: Makefile.kmk 106239 2024-10-08 14:47:35Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # Sub-Makefile for the Guest Additions loader.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2008-2024 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 |
|
---|
31 | # This has to be 32-bit.
|
---|
32 | PROGRAMS += VBoxWindowsAdditions
|
---|
33 | VBoxWindowsAdditions_TEMPLATE = VBoxGuestR3Exe
|
---|
34 | VBoxWindowsAdditions_BLD_TRG_ARCH = x86
|
---|
35 | VBoxWindowsAdditions_DEFS = _WIN32_WINNT=0x0400
|
---|
36 | VBoxWindowsAdditions_INCS = ../../include
|
---|
37 | VBoxWindowsAdditions_SOURCES = \
|
---|
38 | VBoxWindowsAdditions.cpp \
|
---|
39 | VBoxWindowsAdditions.rc
|
---|
40 | ifdef VBOX_WITH_NOCRT_STATIC
|
---|
41 | VBoxWindowsAdditions_LDFLAGS = /SubSystem:Windows
|
---|
42 | else
|
---|
43 | VBoxWindowsAdditions_LDFLAGS = \
|
---|
44 | /DISALLOWLIB:msvcrt.lib \
|
---|
45 | /DISALLOWLIB:msvcprt.lib \
|
---|
46 | /DISALLOWLIB:libcmt.lib
|
---|
47 | VBoxWindowsAdditions_LIBS = \
|
---|
48 | $(PATH_TOOL_$(TEMPLATE_VBoxR3Exe_TOOL.win.$(KBUILD_TARGET_ARCH))_LIB)/oldnames.lib \
|
---|
49 | $(PATH_TOOL_$(TEMPLATE_VBoxR3Exe_TOOL.win.$(KBUILD_TARGET_ARCH))_LIB)/libcmt.lib \
|
---|
50 | $(PATH_TOOL_$(TEMPLATE_VBoxR3Exe_TOOL.win.$(KBUILD_TARGET_ARCH))_LIB)/libcpmt.lib
|
---|
51 | endif
|
---|
52 | VBoxWindowsAdditions_VBOX_IMPORT_CHECKER.win.x86 := nt4
|
---|
53 |
|
---|
54 | # Version stuff.
|
---|
55 | VBoxWindowsAdditions.cpp_DEFS += VBOX_SVN_REV=$(VBOX_SVN_REV)
|
---|
56 | VBoxWindowsAdditions.cpp_DEPS = $(VBOX_SVN_REV_KMK)
|
---|
57 |
|
---|
58 | # The icon location is configurable.
|
---|
59 | VBoxWindowsAdditions.rc_INCS += $(VBoxWindowsAdditions_0_OUTDIR)
|
---|
60 | VBoxWindowsAdditions.rc_DEPS += $(VBoxWindowsAdditions_0_OUTDIR)/VBoxWindowsAdditions-icon.rc
|
---|
61 | VBoxWindowsAdditions.rc_CLEAN = $(VBoxWindowsAdditions_0_OUTDIR)/VBoxWindowsAdditions-icon.rc
|
---|
62 |
|
---|
63 |
|
---|
64 | # Icon include file.
|
---|
65 | $$(VBoxWindowsAdditions_0_OUTDIR)/VBoxWindowsAdditions-icon.rc: \
|
---|
66 | $(VBOX_WINDOWS_ADDITIONS_ICON_FILE) $(MAKEFILE_CURRENT) | $$(dir $$@)
|
---|
67 | $(RM) -f $@
|
---|
68 | $(APPEND) $@ 'IDI_VIRTUALBOX ICON DISCARDABLE "$(subst /,\\,$(VBOX_WINDOWS_ADDITIONS_ICON_FILE))"'
|
---|
69 |
|
---|
70 |
|
---|
71 | # Signing certificate.
|
---|
72 | ifdef VBOX_SIGNING_MODE
|
---|
73 | if1of ($(VBOX_SIGNING_MODE), test)
|
---|
74 | # If signing the installer, the loader stub must be signed as well.
|
---|
75 | # Hack alert! Using POST_CMDS.win to place the signing after VBoxPeSetVersion.
|
---|
76 | VBoxWindowsAdditions_POST_CMDS.win = $(call VBOX_SIGN_IMAGE_FN,$(out),,2)
|
---|
77 | VBoxWindowsAdditions_ORDERDEPS = $(VBOX_SIGN_IMAGE_ORDERDEPS)
|
---|
78 | endif
|
---|
79 | VBoxWindowsAdditions_DEFS += VBOX_SIGNING_MODE
|
---|
80 | VBoxWindowsAdditions_INCS += $(VBoxWindowsAdditions_0_OUTDIR)
|
---|
81 | VBoxWindowsAdditions_INTERMEDIATES = $(VBoxWindowsAdditions_0_OUTDIR)/BuildCert.h
|
---|
82 |
|
---|
83 | # Dummy signed program that we can extract the signature from.
|
---|
84 | BLDPROGS += bldAddSignedDummy
|
---|
85 | bldAddSignedDummy_TEMPLATE := VBoxBldProg
|
---|
86 | bldAddSignedDummy_SOURCES := bldAddSignedDummy.cpp
|
---|
87 | bldAddSignedDummy_ORDERDEPS = $(VBOX_SIGN_IMAGE_ORDERDEPS)
|
---|
88 | bldAddSignedDummy_POST_CMDS = $(call VBOX_SIGN_IMAGE_FN,$(out),,2)
|
---|
89 |
|
---|
90 | # The certificate include file.
|
---|
91 | $$(VBoxWindowsAdditions_0_OUTDIR)/BuildCert.h: \
|
---|
92 | $(VBOX_BIN2C) \
|
---|
93 | $(VBOX_RTSIGNTOOL) \
|
---|
94 | $$(bldAddSignedDummy_1_TARGET) \
|
---|
95 | | $$(dir $$@)
|
---|
96 | $(QUIET)$(RM) -f -- "$@" "[email protected]"
|
---|
97 | $(VBOX_RTSIGNTOOL) extract-exe-signer-cert --exe "$(bldAddSignedDummy_1_TARGET)" --output "[email protected]" --der
|
---|
98 | $(VBOX_BIN2C) -ascii --append BuildCert "[email protected]" "$@"
|
---|
99 | $(QUIET)$(RM) -f -- [email protected]
|
---|
100 |
|
---|
101 | OTHER_CLEAN += $(VBOX_SUP_WIN_CERTS_FILE)
|
---|
102 |
|
---|
103 | endif # VBOX_SIGNING_MODE
|
---|
104 |
|
---|
105 |
|
---|
106 | include $(FILE_KBUILD_SUB_FOOTER)
|
---|
107 |
|
---|