1 | # $Id: Makefile.kmk 3315 2007-06-27 11:54:17Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # The Recompiler Makefile.
|
---|
4 | #
|
---|
5 | # There are a few of complicating factors here, esp. on AMD64 systems:
|
---|
6 | #
|
---|
7 | # * op.c doesn't compile work correctly with gcc 4. For this we've
|
---|
8 | # checked in op.S, which is the reason why we don't compile op.c
|
---|
9 | # directly but always compile via the assembly file.s
|
---|
10 | # * On 64-bit Windows we lack a compiler and have to resort to a
|
---|
11 | # linux cross compiler building an ELF relocatable module which
|
---|
12 | # we then load using a wrapper module. Thus the REM_MOD mess.
|
---|
13 | # * On platforms using the 64-bit GCC ABI, we're not allowed to
|
---|
14 | # generate non-PIC shared objects, and op.c requires the code
|
---|
15 | # to be non-PIC. We apply the same trick as we developed for
|
---|
16 | # 64-bit windows.
|
---|
17 | #
|
---|
18 |
|
---|
19 | #
|
---|
20 | # Copyright (C) 2006-2007 innotek GmbH
|
---|
21 | #
|
---|
22 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
23 | # available from http://www.virtualbox.org. This file is free software;
|
---|
24 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
25 | # General Public License as published by the Free Software Foundation,
|
---|
26 | # in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
27 | # distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
28 | # be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
29 | #
|
---|
30 | # If you received this file as part of a commercial VirtualBox
|
---|
31 | # distribution, then only the terms of your commercial VirtualBox
|
---|
32 | # license agreement apply instead of the previous paragraph.
|
---|
33 | #
|
---|
34 |
|
---|
35 |
|
---|
36 | DEPTH = ../..
|
---|
37 | include $(PATH_KBUILD)/header.kmk
|
---|
38 |
|
---|
39 |
|
---|
40 | # todo this is a BUILD_PLATFORM binary, to a target binary!
|
---|
41 | BLDPROGS = dyngen
|
---|
42 | ifeq ($(BUILD_TARGET_ARCH),amd64)
|
---|
43 | SYSMODS = VBoxREM2
|
---|
44 | REM_MOD = VBoxREM2
|
---|
45 | else
|
---|
46 | REM_MOD = VBoxREM
|
---|
47 | endif
|
---|
48 | DLLS = VBoxREM
|
---|
49 | IMPORT_LIBS = VBoxREMImp
|
---|
50 |
|
---|
51 | OTHER_CLEAN = \
|
---|
52 | $(PATH_$(REM_MOD))/op.h \
|
---|
53 | $(PATH_$(REM_MOD))/opc.h \
|
---|
54 | $(PATH_$(REM_MOD))/gen-op.h \
|
---|
55 | $(PATH_$(REM_MOD))/opc.h
|
---|
56 |
|
---|
57 | DEFS.amd64 += REM_PHYS_ADDR_IN_TLB
|
---|
58 |
|
---|
59 | #
|
---|
60 | # L4 must use the no-crt path because it's lacking math stuff it seems...
|
---|
61 | # Darwin must use the non-crt path because it can't compile op.c nativly.
|
---|
62 | # All the AMD64 target must use the no-crt path because ELF doesn't like op.c
|
---|
63 | # when stuffed into a shared library and windows doesn't have 64-bit gcc (yet).
|
---|
64 | #
|
---|
65 | ifeq ($(filter-out l4 darwin freebsd,$(BUILD_TARGET)),)
|
---|
66 | REM_USE_NOCRT := 1
|
---|
67 | endif
|
---|
68 | ifeq ($(BUILD_TARGET_ARCH),amd64)
|
---|
69 | REM_USE_NOCRT := 1
|
---|
70 | endif
|
---|
71 |
|
---|
72 |
|
---|
73 | #
|
---|
74 | # The dyngen build tool.
|
---|
75 | #
|
---|
76 | ifeq ($(BUILD_PLATFORM),win)
|
---|
77 | dyngen_TOOL = MINGW32
|
---|
78 | dyngen_SDKS = W32API
|
---|
79 | # On 64-bit Windows we pretend to be 32-bit.
|
---|
80 | dyngen_BLD_TRG_ARCH = x86
|
---|
81 | dyngen_BLD_TRG_CPU = i386
|
---|
82 | dyngen_CFLAGS = -Wall -g -fno-strict-aliasing
|
---|
83 | ifeq ($(BUILD_TARGET_ARCH),amd64)
|
---|
84 | dyngen_DEFS += HOST_X86_64=1
|
---|
85 | endif
|
---|
86 | else
|
---|
87 | dyngen_TEMPLATE = VBOXBLDPROG
|
---|
88 | endif
|
---|
89 | dyngen_CFLAGS += -Wno-missing-prototypes -Wno-missing-declarations
|
---|
90 | dyngen_INCS := \
|
---|
91 | InnoTek \
|
---|
92 | target-i386 \
|
---|
93 | fpu \
|
---|
94 | $(PATH_SUB_CURRENT)
|
---|
95 | dyngen_SOURCES = dyngen.c
|
---|
96 |
|
---|
97 |
|
---|
98 | #
|
---|
99 | # The VBoxREM.[dll|so|..] or VBoxREM2.rel.
|
---|
100 | #
|
---|
101 | $(REM_MOD)_DEFS = IN_REM_R3 REM_INCLUDE_CPU_H
|
---|
102 | #$(REM_MOD)_DEFS += DEBUG_ALL_LOGGING DEBUG_DISAS DEBUG_PCALL DEBUG_EXEC DEBUG_FLUSH DEBUG_IOPORT DEBUG_SIGNAL DEBUG_TLB_CHECK DEBUG_TB_INVALIDATE DEBUG_TLB # Enables huge amounts of debug logging.
|
---|
103 |
|
---|
104 | $(REM_MOD)_INCS = \
|
---|
105 | InnoTek \
|
---|
106 | InnoTek/crt\
|
---|
107 | target-i386 \
|
---|
108 | fpu \
|
---|
109 | $(PATH_$(REM_MOD)) \
|
---|
110 | $(PATH_ROOT)/src/VBox/VMM \
|
---|
111 | $(PATH_CURRENT)
|
---|
112 |
|
---|
113 | $(REM_MOD)_SOURCES = \
|
---|
114 | VBoxRecompiler.c \
|
---|
115 | cpu-exec.c \
|
---|
116 | exec.c \
|
---|
117 | translate-all.c \
|
---|
118 | translate-op.c \
|
---|
119 | fpu/softfloat-native.c \
|
---|
120 | target-i386/helper.c \
|
---|
121 | target-i386/helper2.c \
|
---|
122 | target-i386/translate.c
|
---|
123 | $(REM_MOD)_SOURCES.debug = \
|
---|
124 | InnoTek/testmath.c
|
---|
125 | ifeq ($(filter-out win os2,$(BUILD_TARGET)),)
|
---|
126 | $(REM_MOD)_SOURCES += target-i386/op.c
|
---|
127 | FILE_OP_OBJ = $(PATH_$(REM_MOD)_target-i386/op.c)/op.o
|
---|
128 | else # The remaining targets can be using gcc-4 and needs checking.
|
---|
129 | $(REM_MOD)_SOURCES += $(PATH_$(REM_MOD))/op.S
|
---|
130 | FILE_OP_OBJ = $(PATH_$(REM_MOD)_$(PATH_$(REM_MOD))/op.S)/op.o
|
---|
131 | $(REM_MOD)_CLEAN = $(FILE_OP_OBJ) $(PATH_$(REM_MOD))/op.S.dep
|
---|
132 | endif
|
---|
133 | #$(REM_MOD)_SOURCES.os2 = $(PATH_TARGET)/$(REM_MOD).def
|
---|
134 | $(REM_MOD)_SOURCES.win.x86 = $(REM_MOD).def
|
---|
135 | ifneq ($(REM_MOD),VBoxREM2)
|
---|
136 | $(REM_MOD)_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
|
---|
137 | endif
|
---|
138 |
|
---|
139 |
|
---|
140 | ifdef REM_USE_NOCRT
|
---|
141 | $(REM_MOD)_TEMPLATE = VBOXNOCRTGAS
|
---|
142 | $(REM_MOD)_DEFS += LOG_USE_C99
|
---|
143 | $(REM_MOD)_CFLAGS.amd64 = -O2
|
---|
144 | $(REM_MOD)_CFLAGS.debug = -O0
|
---|
145 | $(REM_MOD)_CFLAGS.darwin = -fno-common -mdynamic-no-pic
|
---|
146 | ifdef ($(BUILD_TARGET_ARCH),x86)
|
---|
147 | $(REM_MOD)_CFLAGS.release+= -fomit-frame-pointer -fno-gcse
|
---|
148 | endif
|
---|
149 |
|
---|
150 | # This doesn't fit in IPRT because it requires GAS and is LGPL.
|
---|
151 | $(REM_MOD)_SOURCES += \
|
---|
152 | InnoTek/e_powl-$(BUILD_TARGET_ARCH).S
|
---|
153 |
|
---|
154 | ifeq ($(REM_MOD),VBoxREM)
|
---|
155 | $(REM_MOD)_LIBS = \
|
---|
156 | $(PATH_LIB)/RuntimeR3NoCRTGCC$(VBOX_SUFF_LIB) \
|
---|
157 | $(LIB_VMM) \
|
---|
158 | $(LIB_RUNTIME)
|
---|
159 | ifeq ($(BUILD_TARGET),l4)
|
---|
160 | $(REM_MOD)_LIBS += \
|
---|
161 | $(L4_LIBDIR)/libuc.0.s.so
|
---|
162 | endif
|
---|
163 | $(REM_MOD)_LIBS.darwin = \
|
---|
164 | $(TARGET_VBoxREMImp)
|
---|
165 | # $(PATH_BIN)/VBoxREMImp.dylib
|
---|
166 | $(REM_MOD)_LDFLAGS.darwin = -read_only_relocs suppress -multiply_defined warning #-install_name @executable_path/$(REM_MOD).dylib#
|
---|
167 | else
|
---|
168 | $(REM_MOD)_LIBS = \
|
---|
169 | $(PATH_LIB)/RuntimeR3NoCRTGCC$(VBOX_SUFF_LIB)
|
---|
170 | $(REM_MOD)_SYSSUFF = .rel
|
---|
171 | endif
|
---|
172 |
|
---|
173 | else # !REM_USE_NOCRT
|
---|
174 |
|
---|
175 | $(REM_MOD)_TOOL = GXX3
|
---|
176 | $(REM_MOD)_TOOL.win.x86 = MINGW32
|
---|
177 | $(REM_MOD)_TOOL.win.amd64 = XGCCAMD64LINUX
|
---|
178 | $(REM_MOD)_SDKS.win.x86 = W32API ## @todo do we really need this now?
|
---|
179 | $(REM_MOD)_ASFLAGS = -x assembler-with-cpp ## @todo didn't I make this default already?
|
---|
180 | $(REM_MOD)_CFLAGS = -Wall -g
|
---|
181 | $(REM_MOD)_CFLAGS.debug = -O0
|
---|
182 | $(REM_MOD)_CFLAGS.release += -fomit-frame-pointer -fno-gcse
|
---|
183 | $(REM_MOD)_CFLAGS.profile = $($(REM_MOD)_CFLAGS.release)
|
---|
184 | $(REM_MOD)_CFLAGS.kprofile = $($(REM_MOD)_CFLAGS.release)
|
---|
185 | $(REM_MOD)_CFLAGS.l4 = -nostdinc
|
---|
186 | ifeq ($(BUILD_TARGET),l4)
|
---|
187 | $(REM_MOD)_INCS += $(VBOX_L4_GCC3_INCS) $(L4_INCDIR)
|
---|
188 | endif
|
---|
189 |
|
---|
190 | $(REM_MOD)_DEFS += IN_RING3 LOG_USE_C99
|
---|
191 | #$(REM_MOD)_DEFS += DEBUG_DISAS DEBUG_PCALL DEBUG_EXEC DEBUG_FLUSH DEBUG_IOPORT DEBUG_SIGNAL DEBUG_TLB_CHECK DEBUG_TB_INVALIDATE DEBUG_TLB # Enables huge amounts of debug logging.
|
---|
192 | # these defines are probably all irrelevant now:
|
---|
193 | $(REM_MOD)_DEFS += _GNU_SOURCE _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE _REENTRANT
|
---|
194 |
|
---|
195 | $(REM_MOD)_LDFLAGS.darwin = -read_only_relocs suppress -install_name @executable_path/$(REM_MOD).dylib -multiple_defined warning
|
---|
196 | $(REM_MOD)_LDFLAGS.l4 = -T$(L4_LIBDIR)/../main_rel.ld -nostdlib -Wl,--no-undefined
|
---|
197 | $(REM_MOD)_LDFLAGS.os2 = -Zomf
|
---|
198 | $(REM_MOD)_LDFLAGS.debug = -g
|
---|
199 | ifeq ($(BUILD_TARGET_ARCH),amd64)
|
---|
200 | $(REM_MOD)_LIBS = $(FILE_TOOL_GCC3_LIBGCC)
|
---|
201 | else # x86
|
---|
202 | $(REM_MOD)_LIBS = \
|
---|
203 | $(LIB_VMM) \
|
---|
204 | $(LIB_RUNTIME)
|
---|
205 | $(REM_MOD)_LIBS.win.x86 = \
|
---|
206 | mingw32 \
|
---|
207 | user32 gdi32 winmm ws2_32 iphlpapi dxguid
|
---|
208 | $(REM_MOD)_LIBS.linux = \
|
---|
209 | $(LIB_UUID) \
|
---|
210 | m \
|
---|
211 | util \
|
---|
212 | rt \
|
---|
213 | $(LIB_PTHREAD)
|
---|
214 | $(REM_MOD)_LIBS.l4 = \
|
---|
215 | gcc \
|
---|
216 | $(L4_LIBDIR)/libvboxserver.s.so \
|
---|
217 | $(L4_LIBDIR)/libdl.s.so \
|
---|
218 | $(L4_LIBDIR)/libuc.0.s.so
|
---|
219 | endif # x86
|
---|
220 |
|
---|
221 | endif # !REM_USE_NOCRT
|
---|
222 |
|
---|
223 | # Extra flags for these source modules.
|
---|
224 | target-i386/op.c_CFLAGS = -O2 -fno-strict-aliasing -fomit-frame-pointer -falign-functions=0 -fno-reorder-blocks -fno-optimize-sibling-calls
|
---|
225 | target-i386/op.c_CFLAGS.x86 = -fno-gcse -fno-instrument-functions -mpreferred-stack-boundary=2
|
---|
226 | target-i386/op.c_CFLAGS.darwin.x86 = -m128bit-long-double -mpreferred-stack-boundary=4
|
---|
227 | target-i386/helper.c_CFLAGS.x86 = -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-gcse
|
---|
228 | cpu-exec.c_CFLAGS.x86 = -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-gcse
|
---|
229 |
|
---|
230 |
|
---|
231 | #
|
---|
232 | # The math testcase as a standalone program for testing and debugging purposes.
|
---|
233 | #
|
---|
234 | ## @todo This is a bit messy because of MINGW32.
|
---|
235 | #BLDPROGS += testmath
|
---|
236 | testmath_TOOL = GXX3
|
---|
237 | testmath_TOOL.win.x86 = MINGW32
|
---|
238 | testmath_SDKS.win.x86 = W32API
|
---|
239 | ifeq ($(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH),win.amd64)
|
---|
240 | # 64-bit windows: Pretend to be 32-bit.
|
---|
241 | testmath_BLD_TRG = win32
|
---|
242 | testmath_BLD_TRG_ARCH = x86
|
---|
243 | testmath_BLD_TRG_CPU = i386
|
---|
244 | endif
|
---|
245 | testmath_ASTOOL = $(VBOX_ASTOOL)
|
---|
246 | ifeq ($(filter-out win32 win64,$(BUILD_PLATFORM)),)
|
---|
247 | testmath_ASFLAGS = -f win32 -DNASM_FORMAT_PE $(VBOX_ASFLAGS) -w+orphan-labels
|
---|
248 | else
|
---|
249 | testmath_ASFLAGS = -f elf -DNASM_FORMAT_ELF $(VBOX_ASFLAGS) -w+orphan-labels
|
---|
250 | endif
|
---|
251 | testmath_ASFLAGS.amd64 = -m amd64
|
---|
252 | testmath_CFLAGS = -Wall -g
|
---|
253 | testmath_CFLAGS.release = -O3
|
---|
254 | testmath_LDFLAGS = -g
|
---|
255 | testmath_DEFS = MATHTEST_STANDALONE
|
---|
256 | testmath_SOURCES = InnoTek/testmath.c
|
---|
257 | #testmath_SOURCES += $(PATH_LIB)/RuntimeR3NoCRTGCC$(VBOX_SUFF_LIB)
|
---|
258 |
|
---|
259 |
|
---|
260 | ifeq ($(BUILD_TARGET_ARCH),amd64)
|
---|
261 | #
|
---|
262 | # The VBoxREM2 wrapper.
|
---|
263 | #
|
---|
264 | VBoxREM_TEMPLATE = VBOXR3
|
---|
265 | VBoxREM_DEFS = IN_REM_R3
|
---|
266 | VBoxREM_SOURCES = \
|
---|
267 | VBoxREMWrapper.cpp \
|
---|
268 | VBoxREMWrapperA.asm
|
---|
269 | VBoxREM_LDFLAGS.darwin = -install_name @executable_path/VBoxREM.dylib
|
---|
270 | VBoxREM_LIBS = \
|
---|
271 | $(LIB_VMM) \
|
---|
272 | $(LIB_RUNTIME)
|
---|
273 | endif
|
---|
274 |
|
---|
275 |
|
---|
276 | #
|
---|
277 | # The VBoxREM import library.
|
---|
278 | #
|
---|
279 | VBoxREMImp_TEMPLATE = VBOXR3
|
---|
280 | ifeq ($(BUILD_TARGET),darwin)
|
---|
281 | VBoxREMImp_INST = $(INST_LIB)
|
---|
282 | endif
|
---|
283 | VBoxREMImp_SOURCES.win = VBoxREM.def
|
---|
284 | VBoxREMImp_SOURCES.os2 = $(PATH_TARGET)/VBoxREMOS2.def
|
---|
285 | ifeq ($(filter win os2,$(BUILD_TARGET)),)
|
---|
286 | VBoxREMImp_SOURCES = $(PATH_TARGET)/VBoxREMImp.c
|
---|
287 | VBoxREMImp_CLEAN = $(PATH_TARGET)/VBoxREMImp.c
|
---|
288 | endif
|
---|
289 | VBoxREMImp_SONAME.linux = VBoxREM.so
|
---|
290 | VBoxREMImp_SONAME.l4 = VBoxREM.s.so
|
---|
291 | VBoxREMImp_LDFLAGS.darwin = -install_name @executable_path/VBoxREM.dylib
|
---|
292 | #VBoxREMImp_LDFLAGS.darwin = -install_name VBoxREM.dylib
|
---|
293 | VBoxREMImp_LDFLAGS.l4 = -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
|
---|
294 |
|
---|
295 | $(PATH_TARGET)/VBoxREMImp.c: VBoxREM.def InnoTek/deftoimp.sed Makefile.kmk | $(call DIRDEP,$(PATH_TARGET))
|
---|
296 | $(call MSG_GENERATE,,$@)
|
---|
297 | $(QUIET)$(MKDIR) -p $(PATH_TARGET)
|
---|
298 | $(QUIET)$(APPEND) [email protected] '#ifdef VBOX_HAVE_VISIBILITY_HIDDEN'
|
---|
299 | $(QUIET)$(APPEND) [email protected] '# define EXPORT __attribute__((visibility("default")))'
|
---|
300 | $(QUIET)$(APPEND) [email protected] '#else'
|
---|
301 | $(QUIET)$(APPEND) [email protected] '# define EXPORT'
|
---|
302 | $(QUIET)$(APPEND) [email protected] '#endif'
|
---|
303 | $(QUIET)$(APPEND) [email protected] ''
|
---|
304 | $(QUIET)$(SED) -f InnoTek/deftoimp.sed VBoxREM.def >> [email protected]
|
---|
305 | $(QUIET)$(MV) -f [email protected] $@
|
---|
306 |
|
---|
307 | $(VBoxREMImp_SOURCES.os2): VBoxREM.def $(MAKEFILE) | $(call DIRDEP,$(PATH_TARGET))
|
---|
308 | $(SED) \
|
---|
309 | -e 's/^[ \t][ \t]*REMR3/ _REMR3/' \
|
---|
310 | -e 's/\.[Dd][Ll][Ll]//' \
|
---|
311 | -e 's/^LIBRARY .*/LIBRARY VBoxREM INITINSTANCE TERMINSTANCE\nDATA MULTIPLE\n/' \
|
---|
312 | VBoxREM.def > [email protected]
|
---|
313 | $(MV) -f [email protected] $@
|
---|
314 |
|
---|
315 |
|
---|
316 |
|
---|
317 | include $(PATH_KBUILD)/footer.kmk
|
---|
318 |
|
---|
319 |
|
---|
320 | #
|
---|
321 | # Generate the op.S file somehow...
|
---|
322 | #
|
---|
323 | # Gathering the flags, defines and include dirs for the command is a lot
|
---|
324 | # of work. Unfortunately, there is only a highly specialized kBuild function
|
---|
325 | # for doing this, so we're currently left to our own devices here.
|
---|
326 | #
|
---|
327 | # Add something like VBOX_RECOMPILER_OP_GCC = gcc-3.4.6 to LocalConfig.kmk
|
---|
328 | # to be 100% sure that you get a working op.S. My gcc 4.1.1 seems to work
|
---|
329 | # fine, so feel free to try VBOX_RECOMPILER_OP_GCC = gcc.
|
---|
330 | #
|
---|
331 | # The op-undefined.lst is generated by finding all the undefined symbols
|
---|
332 | # in one (or more) ELF op.o files using nm.
|
---|
333 | #
|
---|
334 | ifndef VBOX_RECOMPILER_OP_GCC
|
---|
335 | ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),darwin.x86)
|
---|
336 | VBOX_RECOMPILER_OP_GCC ?= i386-elf-gcc-3.4.3 # (port install i386-gcc-elf)
|
---|
337 | VBOX_RECOMPILER_OP_GCC_OK := yes
|
---|
338 | VBOX_RECOMPILER_OP_GCC_INCS ?= $(abspath $(dir $(shell LC_ALL=C $(VBOX_RECOMPILER_OP_GCC) -print-libgcc-file-name)))/include
|
---|
339 | endif
|
---|
340 | ifndef VBOX_RECOMPILER_OP_GCC
|
---|
341 | VBOX_RECOMPILER_OP_GCC := $(TOOL_$(VBOX_GCC_TOOL)_CC)
|
---|
342 | VBOX_RECOMPILER_OP_GCC_OK := dunno
|
---|
343 | endif
|
---|
344 | else
|
---|
345 | # If set, assume it's an OK compiler.
|
---|
346 | VBOX_RECOMPILER_OP_GCC_OK := yes
|
---|
347 | endif
|
---|
348 |
|
---|
349 |
|
---|
350 | # The command sans -o op.S.tmp.
|
---|
351 | COMPILE_OP_CMDS = $(VBOX_RECOMPILER_OP_GCC) \
|
---|
352 | -S -s \
|
---|
353 | $(filter-out -g -O0, \
|
---|
354 | $($(REM_MOD)_CFLAGS) $($(REM_MOD)_CFLAGS.$(BUILD_TYPE)) $($(REM_MOD)_CFLAGS.$(BUILD_TARGET)) $($(REM_MOD)_CFLAGS.$(BUILD_TARGET_ARCH)) $($(REM_MOD)_CFLAGS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
355 | $(target-i386/op.c_CFLAGS) $(target-i386/op.c_CFLAGS.$(BUILD_TARGET)) $(target-i386/op.c_CFLAGS.$(BUILD_TARGET_ARCH)) $(target-i386/op.c_CFLAGS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
356 | ) \
|
---|
357 | $(addprefix -I, \
|
---|
358 | $($(REM_MOD)_CINCS.$(BUILD_TARGET_ARCH)) $($(REM_MOD)_CINCS.$(BUILD_TARGET)) $($(REM_MOD)_CINCS) $(CINCS) \
|
---|
359 | $($(REM_MOD)_INCS.$(BUILD_TARGET_ARCH)) $($(REM_MOD)_INCS.$(BUILD_TARGET)) $($(REM_MOD)_INCS) $(INCS) \
|
---|
360 | ) \
|
---|
361 | $(addprefix -D, \
|
---|
362 | $($(REM_MOD)_CDEFS.$(BUILD_TARGET_ARCH)) $($(REM_MOD)_CDEFS.$(BUILD_TARGET)) $($(REM_MOD)_CDEFS) $(CDEFS.$(BUILD_TARGET)) $(CDEFS.$(BUILD_TARGET_ARCH)) $(CDEFS.$(BUILD_TYPE)) $(CDEFS) \
|
---|
363 | $($(REM_MOD)_DEFS.$(BUILD_TARGET_ARCH)) $($(REM_MOD)_DEFS.$(BUILD_TARGET)) $($(REM_MOD)_DEFS) $(DEFS.$(BUILD_TARGET)) $(DEFS.$(BUILD_TARGET_ARCH)) $(DEFS.$(BUILD_TYPE)) $(DEFS) \
|
---|
364 | ) \
|
---|
365 | -Wp,-MD,$(PATH_$(REM_MOD))/op.S.dep \
|
---|
366 | -Wp,-MT,$(PATH_$(REM_MOD))/op.S \
|
---|
367 | -Wp,-MP \
|
---|
368 | target-i386/op.c
|
---|
369 |
|
---|
370 | # Use the right GCC includes.
|
---|
371 | ifdef VBOX_RECOMPILER_OP_GCC_INCS
|
---|
372 | COMPILE_OP_CMDS := $(subst $(VBOX_PATH_GCC_INCS),$(VBOX_RECOMPILER_OP_GCC_INCS),$(COMPILE_OP_CMDS))
|
---|
373 | endif
|
---|
374 |
|
---|
375 | # Drop incompatible options when using the cross-compiler on darwin.
|
---|
376 | ifeq ($(BUILD_TARGET),darwin)
|
---|
377 | ifeq ($(filter-out i386-elf-gcc%, $(VBOX_RECOMPILER_OP_GCC)),)
|
---|
378 | COMPILE_OP_CMDS := $(filter-out -mdynamic-no-pic, $(COMPILE_OP_CMDS))
|
---|
379 | endif
|
---|
380 | endif
|
---|
381 |
|
---|
382 | # include the dependencies
|
---|
383 | -include $(PATH_$(REM_MOD))/op.S.dep
|
---|
384 |
|
---|
385 | # The rule.
|
---|
386 | $(PATH_$(REM_MOD))/op.S: \
|
---|
387 | target-i386/op.c \
|
---|
388 | InnoTek/staged-op-elf-$(BUILD_TARGET_ARCH).S \
|
---|
389 | InnoTek/op-validate.sed \
|
---|
390 | InnoTek/op-darwin.sed \
|
---|
391 | InnoTek/op-undefined.lst \
|
---|
392 | Makefile.kmk \
|
---|
393 | $(comp-cmds COMPILE_OP_CMDS,COMPILE_OP_CMDS_PREV,FORCE) \
|
---|
394 | | $(call DIRDEP,$(PATH_$(REM_MOD)))
|
---|
395 | $(RM) -f $@ [email protected] [email protected] [email protected]
|
---|
396 | ifeq ($(VBOX_RECOMPILER_OP_GCC_OK),yes)
|
---|
397 | $(call MSG_COMPILE,VBoxREM,$<,$@,AS)
|
---|
398 | $(addsuffix $(SP)\$(NL)$(TAB) ,$(COMPILE_OP_CMDS)) -o [email protected]
|
---|
399 | else ifeq ($(VBOX_RECOMPILER_OP_GCC_OK),dunno) # (permit 3.x.x and 4.1.x+ for now)
|
---|
400 | major_ver=`$(VBOX_RECOMPILER_OP_GCC) -dumpversion | $(SED) -e 's/^\([2-9]\)\..*$$/\1/'`; \
|
---|
401 | minor_ver=`$(VBOX_RECOMPILER_OP_GCC) -dumpversion | $(SED) -e 's/^[2-9]\.\([0-9]\)\..*$$/\1/'`; \
|
---|
402 | bugfix_ver=`$(VBOX_RECOMPILER_OP_GCC) -dumpversion | $(SED) -e 's/^[2-9]\.[0-9]\.\([0-9]\).*$$/\1/'`; \
|
---|
403 | if test "$$major_ver" = "3" -o "(" "$$major_ver" = "4" -a "$$minor_ver" != "0" ")"; then \
|
---|
404 | $(ECHO_EXT) "Compiling $< => $@ [gcc v$${major_ver}.$${minor_ver}.$${bugfix_ver}]" && \
|
---|
405 | $(addsuffix $(SP)\$(NL)$(TAB)$(TAB) ,$(COMPILE_OP_CMDS)) -o [email protected]; \
|
---|
406 | else \
|
---|
407 | $(ECHO_EXT) "Using staged op.S [gcc v$${major_ver}.$${minor_ver}.$${bugfix_ver}]" && \
|
---|
408 | $(CP_EXT) -f InnoTek/staged-op-elf-$(BUILD_TARGET_ARCH).S [email protected]; \
|
---|
409 | fi
|
---|
410 | else
|
---|
411 | $(CP) InnoTek/staged-op-elf-$(BUILD_TARGET_ARCH).S [email protected]
|
---|
412 | endif
|
---|
413 | $(SED) -f InnoTek/op-validate.sed [email protected]
|
---|
414 | ifeq ($(BUILD_TARGET),darwin)
|
---|
415 | $(SED) -f InnoTek/op-darwin.sed [email protected] > [email protected]
|
---|
416 | $(SED) -e 's/^\(.*\)$$/#define \1 _\1/' InnoTek/op-undefined.lst > [email protected]
|
---|
417 | $(CAT_EXT) [email protected] >> [email protected]
|
---|
418 | endif
|
---|
419 | $(MV) -f [email protected] $@
|
---|
420 | $(QUIET2)$(APPEND) "[email protected]"
|
---|
421 | $(QUIET2)$(APPEND) "[email protected]" 'define COMPILE_OP_CMDS_PREV'
|
---|
422 | $(QUIET2)$(APPEND) "[email protected]" '$(subst $(NL),'$(NL)$(TAB)@$(APPEND) "[email protected]" ',$(COMPILE_OP_CMDS))'
|
---|
423 | $(QUIET2)$(APPEND) "[email protected]" 'endef'
|
---|
424 |
|
---|
425 |
|
---|
426 | # Hack for crosscompiling.
|
---|
427 | DYNGEN = $(PATH_dyngen)/dyngen$(HOSTSUFF_EXE)
|
---|
428 | DYNGEN_EXEC = $(DYNGEN)
|
---|
429 | ifneq ($(BUILD_PLATFORM),$(BUILD_TARGET)) # hack for crosscompiling.
|
---|
430 | ifeq ($(BUILD_TARGET),win)
|
---|
431 | DYNGEN = $(PATH_dyngen)/dyngen.exe
|
---|
432 | DYNGEN_EXEC := $(EXEC_X86_WIN32) $(DYNGEN_EXEC)
|
---|
433 | endif
|
---|
434 | endif
|
---|
435 |
|
---|
436 | # The dyngen rules.
|
---|
437 | $(PATH_$(REM_MOD))/op.h: $(FILE_OP_OBJ) $(DYNGEN)
|
---|
438 | $(call MSG_TOOL,dyngen,VBoxREM,$<,$@)
|
---|
439 | $(QUIET)$(DYNGEN_EXEC) -o $@ $<
|
---|
440 |
|
---|
441 | $(PATH_$(REM_MOD))/opc.h: $(FILE_OP_OBJ) $(DYNGEN)
|
---|
442 | $(call MSG_TOOL,dyngen,VBoxREM,$<,$@)
|
---|
443 | $(QUIET)$(DYNGEN_EXEC) -c -o $@ $<
|
---|
444 |
|
---|
445 | $(PATH_$(REM_MOD))/gen-op.h: $(FILE_OP_OBJ) $(DYNGEN)
|
---|
446 | $(call MSG_TOOL,dyngen,VBoxREM,$<,$@)
|
---|
447 | $(QUIET)$(DYNGEN_EXEC) -g -o $@ $<
|
---|
448 |
|
---|
449 | # Dyngen dependants (sp?).
|
---|
450 | translate-all.c \
|
---|
451 | translate-op.c \
|
---|
452 | target-i386/translate.c \
|
---|
453 | : $(PATH_$(REM_MOD))/op.h $(PATH_$(REM_MOD))/opc.h $(PATH_$(REM_MOD))/gen-op.h
|
---|
454 |
|
---|
455 |
|
---|
456 | # Some aliases
|
---|
457 | do_dyngen: $(PATH_$(REM_MOD))/gen-op.h $(PATH_$(REM_MOD))/opc.h $(PATH_$(REM_MOD))/op.h
|
---|
458 | importlib: $(LIB_REM)
|
---|
459 | op.S: $(PATH_$(REM_MOD))/op.S
|
---|
460 |
|
---|
461 |
|
---|