VirtualBox

source: vbox/trunk/src/recompiler/Makefile.kmk@ 9219

Last change on this file since 9219 was 9219, checked in by vboxsync, 16 years ago

More fixes for 32 bits hosts & 64 bits guests.

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette