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