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