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