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