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