VirtualBox

Changeset 2422 in vbox for trunk/src/recompiler/Makefile.kmk


Ignore:
Timestamp:
Apr 30, 2007 12:03:47 PM (18 years ago)
Author:
vboxsync
Message:

Removed the old recompiler code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/recompiler/Makefile.kmk

    r1 r2422  
     1# $Id$
    12## @file
    2 #
    3 # !GNU MAKE!
     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
    419#
    520# Copyright (C) 2006 InnoTek Systemberatung GmbH
     
    2237include $(PATH_KBUILD)/header.kmk
    2338
     39
    2440# todo this is a BUILD_PLATFORM binary, to a target binary!
    25 ifeq ($(filter darwin,$(BUILD_TARGET)),)
    26  ifeq ($(VBOX_USING_GCC4),)
    27   BLDPROGS            = dyngen
    28  endif
    29  DLLS                 = VBoxREM
    30  ifeq ($(BUILD_TARGET_ARCH),amd64)
    31   SYSMODS             = VBoxREM2
    32   REM_MOD             = VBoxREM2
    33  else
    34   REM_MOD             = VBoxREM
    35  endif
    36 endif # !darwin
     41BLDPROGS              = dyngen
     42ifeq ($(BUILD_TARGET_ARCH),amd64)
     43 SYSMODS              = VBoxREM2
     44 REM_MOD              = VBoxREM2
     45else
     46 REM_MOD              = VBoxREM
     47endif
     48DLLS                  = VBoxREM
    3749IMPORT_LIBS           = VBoxREMImp
    38 GPLEXPORTS            = qemu-source-drop
    3950
    4051OTHER_CLEAN           = \
     
    4253        $(PATH_$(REM_MOD))/opc.h \
    4354        $(PATH_$(REM_MOD))/gen-op.h \
    44         $(PATH_$(REM_MOD))/opc.h \
    45         $(PATH_TARGET)/VBoxREMImp.c
    46 
    47 #DEFS += DEBUG_DISAS
    48 
    49 # private hack for gcc 4.1
    50 ifeq ($(USERNAME).$(BUILD_TARGET),bird.linux)
    51  TOOL_GCC3_CC = gcc-3.4.6
    52  override VBOX_GCC_Wno-variadic-macros=
    53  override VBOX_USING_GCC4=
    54 endif
    55 
     55        $(PATH_$(REM_MOD))/opc.h
     56
     57DEFS.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#
     65ifeq ($(filter-out l4 darwin freebsd,$(BUILD_TARGET)),)
     66 REM_USE_NOCRT := 1
     67endif
     68ifeq ($(BUILD_TARGET_ARCH),amd64)
     69 REM_USE_NOCRT := 1
     70endif
     71
     72
     73#
     74# The dyngen build tool.
     75#
    5676ifeq ($(BUILD_PLATFORM),win)
    5777 dyngen_TOOL          = MINGW32
     
    6080 dyngen_BLD_TRG_ARCH  = x86
    6181 dyngen_BLD_TRG_CPU   = i386
    62  dyngen_CFLAGS        = -Wall -g -fno-strict-aliasing
     82 dyngen_CFLAGS        = -Wall -g -fno-strict-aliasing
     83 ifeq ($(BUILD_TARGET_ARCH),amd64)
     84  dyngen_DEFS        += HOST_X86_64=1
     85 endif
    6386else
    64  dyngen_TEMPLATE      = VBOXBLDPRO
    65 endif
     87 dyngen_TEMPLATE      = VBOXBLDPROG
     88endif
     89dyngen_CFLAGS        += -Wno-missing-prototypes -Wno-missing-declarations
    6690dyngen_INCS           = \
    6791        InnoTek \
    6892        target-i386 \
    69         fpu \
    70         $(PATH_ROOT)/ ## @todo what is $(PATH_ROOT) doing here?
     93        fpu
    7194dyngen_SOURCES        = dyngen.c
    7295
    7396
    7497#
    75 # The VBoxREM or VBoxREM2 DLL/SO.
    76 #
    77 $(REM_MOD)_TOOL          = GCC3
    78 $(REM_MOD)_TOOL.win.x86  = MINGW32
    79 $(REM_MOD)_TOOL.win.amd64= XGCCAMD64LINUX
    80 $(REM_MOD)_SDKS.win.x86  = W32API                                                       ## @todo do we really need this now?
    81 $(REM_MOD)_ASFLAGS       = -x assembler-with-cpp                        ## @todo didn't I make this default already?
    82 $(REM_MOD)_SYSSUFF       = .rel                             # amd64
    83 
    84 $(REM_MOD)_CFLAGS        = -Wall -g
    85 ifdef ($(BUILD_TARGET),win64) # with -O1 and higher, it generates incorrect code for double and long double constants. ## @todo didn't I fix this yet?
    86  REMNoCRT_CFLAGS.release  = -O0
    87  $(REM_MOD)_CFLAGS.amd64  = -mcmodel=medium -fno-common -O0 -fno-strict-aliasing -fno-math-errno -fno-peephole2
    88 else
    89 $(REM_MOD)_CFLAGS.amd64  = -mcmodel=medium -fno-common -O2 -fno-strict-aliasing
    90 endif
    91 $(REM_MOD)_CFLAGS.debug  = -O0
    92 ifdef ($(BUILD_TARGET_ARCH),x86)
    93 $(REM_MOD)_CFLAGS.release += -fomit-frame-pointer -fno-gcse
    94 endif
    95 $(REM_MOD)_CFLAGS.profile = $($(REM_MOD)_CFLAGS.release)
    96 $(REM_MOD)_CFLAGS.kprofile = $($(REM_MOD)_CFLAGS.release)
    97 $(REM_MOD)_CFLAGS.l4     = -nostdinc
    98 $(REM_MOD)_INCS          = \
     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             = \
    99104        InnoTek \
    100         InnoTek/crt \
     105        InnoTek/crt\
    101106        target-i386 \
    102107        fpu \
    103108        $(PATH_$(REM_MOD)) \
    104109        $(PATH_ROOT)/src/VBox/VMM
    105 ifeq ($(BUILD_TARGET),l4)
    106 $(REM_MOD)_INCS         += $(VBOX_L4_GCC3_INCS) $(L4_INCDIR)
    107 endif
    108 $(REM_MOD)_DEFS          = IN_RING3 IN_REM_R3 REM_INCLUDE_CPU_H #LOG_USE_C99
    109 #$(REM_MOD)_DEFS          += DEBUG_PCALL DEBUG_EXEC DEBUG_FLUSH DEBUG_IOPORT DEBUG_SIGNAL DEBUG_TLB_CHECK DEBUG_TB_INVALIDATE DEBUG_TLB  # Enables huge amounts of debug logging.
    110 # these defines are probably all irrelevant now:
    111 $(REM_MOD)_DEFS         += _GNU_SOURCE _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE _REENTRANT
    112 ifeq ($(VBOX_USING_GCC4),)
    113  $(REM_MOD)_SOURCES      = \
     110
     111$(REM_MOD)_SOURCES          = \
    114112        VBoxRecompiler.c \
    115113        cpu-exec.c \
    116114        exec.c \
    117115        translate-all.c \
     116        translate-op.c \
     117        fpu/softfloat-native.c \
    118118        target-i386/helper.c \
    119119        target-i386/helper2.c \
    120         target-i386/translate.c
    121 #       translate-op.c \
    122 #       fpu/softfloat-native.c \
    123 #       InnoTek/testmath.c
    124 
    125 # ***hacking***
    126 # ifeq ($(filter-out win os2,$(BUILD_TARGET)),)
    127   $(REM_MOD)_SOURCES    += target-i386/op.c
    128   FILE_OP_OBJ            = $(PATH_$(REM_MOD)_target-i386/op.c)/op.o
    129 # else # The remaining targets can be using gcc-4 and needs checking.
    130 #  $(REM_MOD)_SOURCES    += $(PATH_$(REM_MOD))/op.S
    131 #  FILE_OP_OBJ            = $(PATH_$(REM_MOD)_$(PATH_$(REM_MOD))/op.S)/op.o
    132 #  $(REM_MOD)_CLEAN       = $(FILE_OP_OBJ)
    133 # endif
    134  $(REM_MOD)_SOURCES     += InnoTek/loghack.c                                                            # this will be obsoleted soon.
    135 else
    136  $(REM_MOD)_SOURCES      = \
    137         precompiled/VBoxRecompiler.o \
    138         precompiled/cpu-exec.o \
    139         precompiled/exec.o \
    140         precompiled/translate-all.o \
    141         precompiled/op.o \
    142         precompiled/helper.o \
    143         precompiled/helper2.o \
    144         precompiled/translate.o \
    145         precompiled/loghack.o
    146  FILE_OP_OBJ             = precompiled/op.o
    147 endif
    148 $(REM_MOD)_DEFS         += fprintf=hacked_fprintf printf=hacked_printf      # ditto
    149 ifneq ($(BUILD_TYPE),debug)
    150 $(REM_MOD)_SOURCES.win.x86 = $(REM_MOD).def
    151 else
    152 $(REM_MOD)_LDFLAGS.win.x86 = --export-all-symbols --output-def $(PATH_TARGET)/$(REM_MOD)-new.def \
    153         --exclude-symbols=console_main --exclude-symbols=WinMain@16
    154 endif
    155 $(REM_MOD)_SOURCES.os2   = $(PATH_TARGET)/VBoxREMOS2.def
    156 $(REM_MOD)_LDFLAGS.linux = -Wl,--no-undefined
    157 $(REM_MOD)_LDFLAGS.l4    = -T$(L4_LIBDIR)/../main_rel.ld -nostdlib -Wl,--no-undefined
    158 
    159 ifeq ($(BUILD_TARGET_ARCH),amd64)
    160 $(REM_MOD)_LIBS           = \
    161         $(LIB_RUNTIME_NOCRT_GCC64) # !create this!
    162 #       $(VBOX_GCC_LIBGCC)  - fix this
    163 else # x86
    164 $(REM_MOD)_LIBS           = \
    165         $(LIB_VMM) \
    166         $(LIB_RUNTIME)
    167 $(REM_MOD)_LIBS.win       = \
    168         mingw32 \
    169         user32 gdi32 winmm ws2_32 iphlpapi dxguid
    170 $(REM_MOD)_LIBS.linux     = \
    171         $(LIB_UUID) \
    172         m \
    173         util \
    174         rt \
    175         $(LIB_PTHREAD)
    176 $(REM_MOD)_LIBS.l4        = \
    177         gcc \
    178         $(L4_LIBDIR)/libvboxserver.s.so \
    179         $(L4_LIBDIR)/libdl.s.so \
    180         $(L4_LIBDIR)/libuc.0.s.so
    181 endif # x86
     120        target-i386/translate.c \
     121        InnoTek/testmath.c
     122ifeq ($(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
     125else # 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
     129endif
     130#$(REM_MOD)_SOURCES.os2      = $(PATH_TARGET)/$(REM_MOD).def
     131$(REM_MOD)_SOURCES.win.x86  = $(REM_MOD).def
     132
     133
     134ifdef 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
     163else # !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
     211endif # !REM_USE_NOCRT
    182212
    183213# Extra flags for these source modules.
    184214target-i386/op.c_CFLAGS         = -O2 -fno-strict-aliasing -fomit-frame-pointer -falign-functions=0 -fno-reorder-blocks -fno-optimize-sibling-calls
    185215target-i386/op.c_CFLAGS.x86     = -fno-gcse -fno-instrument-functions -mpreferred-stack-boundary=2
     216target-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...
    186217target-i386/helper.c_CFLAGS.x86 = -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-gcse
    187218cpu-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
     226testmath_TOOL           = GCC3
     227testmath_TOOL.win.x86   = MINGW32
     228testmath_SDKS.win.x86   = W32API
     229ifeq ($(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
     234endif
     235testmath_ASTOOL         = $(VBOX_ASTOOL)
     236ifeq ($(filter-out win32 win64,$(BUILD_PLATFORM)),)
     237 testmath_ASFLAGS        = -f win32 -DNASM_FORMAT_PE $(VBOX_ASFLAGS) -w+orphan-labels
     238else
     239 testmath_ASFLAGS        = -f elf -DNASM_FORMAT_ELF $(VBOX_ASFLAGS) -w+orphan-labels
     240endif
     241testmath_ASFLAGS.amd64  = -m amd64
     242testmath_CFLAGS         = -Wall -g
     243testmath_CFLAGS.release = -O3
     244testmath_LDFLAGS        = -g
     245testmath_DEFS           = MATHTEST_STANDALONE
     246testmath_SOURCES        = InnoTek/testmath.c
     247#testmath_SOURCES        += $(PATH_LIB)/RuntimeR3NoCRTGCC$(VBOX_SUFF_LIB)
    188248
    189249
     
    197257        VBoxREMWrapper.cpp \
    198258        VBoxREMWrapperA.asm
     259VBoxREM_LDFLAGS.darwin = -install_name @executable_path/VBoxREM.dylib
    199260VBoxREM_LIBS           = \
    200261        $(LIB_VMM) \
     
    207268#
    208269VBoxREMImp_TEMPLATE         = VBOXR3
     270ifeq ($(BUILD_TARGET),darwin)
     271VBoxREMImp_INST             = $(INST_LIB)
     272endif
    209273VBoxREMImp_SOURCES.win      = VBoxREM.def
    210274VBoxREMImp_SOURCES.os2      = $(PATH_TARGET)/VBoxREMOS2.def
    211275ifeq ($(filter win os2,$(BUILD_TARGET)),)
    212276VBoxREMImp_SOURCES          = $(PATH_TARGET)/VBoxREMImp.c
     277VBoxREMImp_CLEAN            = $(PATH_TARGET)/VBoxREMImp.c
    213278endif
    214279VBoxREMImp_SONAME.linux     = VBoxREM.so
    215280VBoxREMImp_SONAME.l4        = VBoxREM.s.so
    216 VBoxREMImp_LDFLAGS.darwin   = -install_name VBoxREM.dylib
     281VBoxREMImp_LDFLAGS.darwin   = -install_name @executable_path/VBoxREM.dylib
     282#VBoxREMImp_LDFLAGS.darwin   = -install_name VBoxREM.dylib
    217283VBoxREMImp_LDFLAGS.l4       = -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
    218284
     
    238304# Generate the op.S file somehow...
    239305#
    240 # Gathering the flags, defines and include dirs for the command is a lot 
    241 # of work. Unfortunately, there is only a highly specialized kBuild function 
     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
    242308# for doing this, so we're currently left to our own devices here.
    243309#
    244 
     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#
    245317ifndef VBOX_RECOMPILER_OP_GCC
    246318 ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),darwin.x86)
    247   VBOX_RECOMPILER_OP_GCC ?= gcc-elf-something
    248  endif
    249  ifeq ($(USERNAME).$(BUILD_TARGET),bird.linux)
    250   VBOX_RECOMPILER_OP_GCC ?= gcc-3.4.6
    251  endif
    252  VBOX_RECOMPILER_OP_GCC ?= $(TOOL_$(VBOX_GCC_TOOL)_CC)
    253  VBOX_RECOMPILER_OP_GCC ?= false
    254 endif
    255 
    256 ## @todo Check gcc version if plain gcc, gcc32 or gcc64.
    257 ## @todo minimal dependencies.
    258 
    259 $(PATH_$(REM_MOD))/op.S: target-i386/op.c staged/op-elf-$(BUILD_TARGET_ARCH).S | $(call DIRDEP,$(PATH_$(REM_MOD)))
    260         $(RM) -f $@ [email protected] [email protected]
    261         $(VBOX_RECOMPILER_OP_GCC) $(addsuffix $(SP)\$(NL)$(TAB),\
    262                 -S -s \
    263                 $(filter-out -g -O0, \
    264                         $($(REM_MOD)_CFLAGS) $($(REM_MOD)_CFLAGS.$(BUILD_TYPE)) $($(REM_MOD)_CFLAGS.$(BUILD_TARGET_ARCH)) \
    265                         $(target-i386/op.c_CFLAGS) $(target-i386/op.c_CFLAGS.$(BUILD_TARGET_ARCH)) \
    266                         ) \
    267                 $(addprefix -I, \
    268                         $($(REM_MOD)_CINCS.$(BUILD_TARGET_ARCH)) $($(REM_MOD)_CINCS.$(BUILD_TARGET)) $($(REM_MOD)_CINCS) $(CINCS) \
    269                         $($(REM_MOD)_INCS.$(BUILD_TARGET_ARCH))  $($(REM_MOD)_INCS.$(BUILD_TARGET))  $($(REM_MOD)_INCS) $(INCS) \
    270                         ) \
    271                 $(addprefix -D, \
    272                         $($(REM_MOD)_CDEFS.$(BUILD_TARGET_ARCH)) $($(REM_MOD)_CDEFS.$(BUILD_TARGET)) $($(REM_MOD)_CDEFS) $(CDEFS.$(BUILD_TARGET)) $(CDEFS.release) $(CDEFS) \
    273                         $($(REM_MOD)_DEFS.$(BUILD_TARGET_ARCH))  $($(REM_MOD)_DEFS.$(BUILD_TARGET))  $($(REM_MOD)_DEFS)  $(DEFS.$(BUILD_TARGET))  $(DEFS.release)  $(DEFS) \
    274                         ) \
     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
     327else
     328 # If set, assume it's an OK compiler.
     329 VBOX_RECOMPILER_OP_GCC_OK := yes
     330endif
     331
     332
     333# The command sans -o op.S.tmp.
     334COMPILE_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.
     354ifdef VBOX_RECOMPILER_OP_GCC_INCS
     355COMPILE_OP_CMDS := $(subst $(VBOX_PATH_GCC_INCS),$(VBOX_RECOMPILER_OP_GCC_INCS),$(COMPILE_OP_CMDS))
     356endif
     357
     358# Drop incompatible options when using the cross-compiler on darwin.
     359ifeq ($(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
     363endif
     364
     365# include the dependencies
     366-include $(PATH_$(REM_MOD))/op.S.dep
     367
     368# The rule.
     369$(PATH_$(REM_MOD))/op.S: \
    275370                target-i386/op.c \
    276                 ) -o [email protected] \
    277                 || $(CP) staged/op-elf-$(BUILD_TARGET_ARCH).S [email protected] # @todo only do this with gcc-4.
    278         $(SED) -f op-validate.sed [email protected] || $(CP) staged/op-elf-$(BUILD_TARGET_ARCH).S [email protected] # This isn't good enough yet.
     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]
     379ifeq ($(VBOX_RECOMPILER_OP_GCC_OK),yes)
     380        $(call MSG_COMPILE,VBoxREM,$<,$@,AS)
     381        $(addsuffix $(SP)\$(NL)$(TAB)  ,$(COMPILE_OP_CMDS)) -o [email protected]
     382else 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
     393else
     394        $(CP) staged/op-elf-$(BUILD_TARGET_ARCH).S [email protected]
     395endif
     396        $(SED) -f op-validate.sed [email protected]
    279397ifeq ($(BUILD_TARGET),darwin)
    280398        $(SED) -f op-darwin.sed [email protected] > [email protected]
    281         $(MV) -f [email protected] [email protected]
     399        $(SED) -e 's/^\(.*\)$$/#define \1 _\1/' op-undefined.lst > [email protected]
     400        $(CAT_EXT) [email protected] >> [email protected]
    282401endif
    283402        $(MV) -f [email protected] $@
    284        
    285 
    286 # predefined dependencies to the headers are generated.
    287 translate-all.c:             $(PATH_$(REM_MOD))/op.h     $(PATH_$(REM_MOD))/opc.h
    288 target-i386/translate.c:     $(PATH_$(REM_MOD))/gen-op.h $(PATH_$(REM_MOD))/opc.h
    289 
    290 # atm this will be build because of the direct dependency.
     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.
    291410DYNGEN = $(PATH_dyngen)/dyngen$(HOSTSUFF_EXE)
    292411DYNGEN_EXEC = $(DYNGEN)
     
    298417endif
    299418
    300 
     419# The dyngen rules.
    301420$(PATH_$(REM_MOD))/op.h:     $(FILE_OP_OBJ) $(DYNGEN)
    302421        $(call MSG_L1,dyngen => $@)
     
    311430        $(QUIET)$(DYNGEN_EXEC) -g -o $@ $<
    312431
     432# Dyngen dependants (sp?).
     433translate-all.c \
     434translate-op.c \
     435target-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
     440do_dyngen: $(PATH_$(REM_MOD))/gen-op.h $(PATH_$(REM_MOD))/opc.h $(PATH_$(REM_MOD))/op.h
    313441importlib: $(LIB_REM)
    314 
    315 
    316 #
    317 # Phony rule for making the qemu source drop.
    318 # This is just an incomplete EXAMPLE. It does NOT include all we have to ship!
    319 #
    320 .PHONY: qemu-source-drop
    321 qemu-source-drop:
    322         $(RM) -f $(PATH_BIN)/qemu-source.zip
    323         zip -9 $(PATH_BIN)/qemu-source.zip \
    324                 target-i386/op.c \
    325                 target-i386/helper.c \
    326                 target-i386/ops_template_mem.h \
    327                 target-i386/ops_sse.h \
    328                 target-i386/helper2.c \
    329                 target-i386/ops_template.h \
    330                 target-i386/ops_mem.h \
    331                 target-i386/translate-copy.c \
    332                 target-i386/exec.h \
    333                 target-i386/cpu.h \
    334                 target-i386/opreg_template.h \
    335                 target-i386/translate.c \
    336                 \
    337                 a.out.h \
    338                 COPYING.LIB \
    339                 cpu-defs.h \
    340                 dyngen.c \
    341                 dyngen.h \
    342                 elf.h \
    343                 exec.c \
    344                 softmmu_header.h \
    345                 translate-all.c \
    346                 bswap.h \
    347                 cpu-all.h \
    348                 cpu-exec.c \
    349                 disas.h \
    350                 dyngen-exec.h \
    351                 dyngen-op.h \
    352                 exec-all.h \
    353                 osdep.h \
    354                 softmmu_template.h \
    355                 vl.h \
    356                 \
    357                 tests/hello-arm.c \
    358                 tests/hello-i386.c \
    359                 tests/linux-test.c \
    360                 tests/Makefile \
    361                 tests/pi_10.com \
    362                 tests/qruncom.c \
    363                 tests/runcom.c \
    364                 tests/sha1.c \
    365                 tests/test-i386.c \
    366                 tests/test-i386-code16.S \
    367                 tests/test-i386.h \
    368                 tests/test-i386-muldiv.h \
    369                 tests/test-i386-shift.h \
    370                 tests/test-i386-vm86.S \
    371                 tests/test_path.c \
    372                 tests/testthread.c
    373 
     442op.S: $(PATH_$(REM_MOD))/op.S
     443
     444
Note: See TracChangeset for help on using the changeset viewer.

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