VirtualBox

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

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