VirtualBox

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

Last change on this file since 1125 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 11.5 KB
Line 
1## @file
2#
3# !GNU MAKE!
4#
5# Copyright (C) 2006 InnoTek Systemberatung GmbH
6#
7# This file is part of VirtualBox Open Source Edition (OSE), as
8# available from http://www.virtualbox.org. This file is free software;
9# you can redistribute it and/or modify it under the terms of the GNU
10# General Public License as published by the Free Software Foundation,
11# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
12# distribution. VirtualBox OSE is distributed in the hope that it will
13# be useful, but WITHOUT ANY WARRANTY of any kind.
14#
15# If you received this file as part of a commercial VirtualBox
16# distribution, then only the terms of your commercial VirtualBox
17# license agreement apply instead of the previous paragraph.
18#
19
20
21DEPTH = ../..
22include $(PATH_KBUILD)/header.kmk
23
24# todo this is a BUILD_PLATFORM binary, to a target binary!
25ifeq ($(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
36endif # !darwin
37IMPORT_LIBS = VBoxREMImp
38GPLEXPORTS = qemu-source-drop
39
40OTHER_CLEAN = \
41 $(PATH_$(REM_MOD))/op.h \
42 $(PATH_$(REM_MOD))/opc.h \
43 $(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
50ifeq ($(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=
54endif
55
56ifeq ($(BUILD_PLATFORM),win)
57 dyngen_TOOL = MINGW32
58 dyngen_SDKS = W32API
59 # On 64-bit Windows we pretend to be 32-bit.
60 dyngen_BLD_TRG_ARCH = x86
61 dyngen_BLD_TRG_CPU = i386
62 dyngen_CFLAGS = -Wall -g -fno-strict-aliasing
63else
64 dyngen_TEMPLATE = VBOXBLDPRO
65endif
66dyngen_INCS = \
67 InnoTek \
68 target-i386 \
69 fpu \
70 $(PATH_ROOT)/ ## @todo what is $(PATH_ROOT) doing here?
71dyngen_SOURCES = dyngen.c
72
73
74#
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
85ifdef ($(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
88else
89$(REM_MOD)_CFLAGS.amd64 = -mcmodel=medium -fno-common -O2 -fno-strict-aliasing
90endif
91$(REM_MOD)_CFLAGS.debug = -O0
92ifdef ($(BUILD_TARGET_ARCH),x86)
93$(REM_MOD)_CFLAGS.release += -fomit-frame-pointer -fno-gcse
94endif
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 = \
99 InnoTek \
100 InnoTek/crt \
101 target-i386 \
102 fpu \
103 $(PATH_$(REM_MOD)) \
104 $(PATH_ROOT)/src/VBox/VMM
105ifeq ($(BUILD_TARGET),l4)
106$(REM_MOD)_INCS += $(VBOX_L4_GCC3_INCS) $(L4_INCDIR)
107endif
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
112ifeq ($(VBOX_USING_GCC4),)
113 $(REM_MOD)_SOURCES = \
114 VBoxRecompiler.c \
115 cpu-exec.c \
116 exec.c \
117 translate-all.c \
118 target-i386/helper.c \
119 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.
135else
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
147endif
148$(REM_MOD)_DEFS += fprintf=hacked_fprintf printf=hacked_printf # ditto
149ifneq ($(BUILD_TYPE),debug)
150$(REM_MOD)_SOURCES.win.x86 = $(REM_MOD).def
151else
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
154endif
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
159ifeq ($(BUILD_TARGET_ARCH),amd64)
160$(REM_MOD)_LIBS = \
161 $(LIB_RUNTIME_NOCRT_GCC64) # !create this!
162# $(VBOX_GCC_LIBGCC) - fix this
163else # 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
181endif # x86
182
183# Extra flags for these source modules.
184target-i386/op.c_CFLAGS = -O2 -fno-strict-aliasing -fomit-frame-pointer -falign-functions=0 -fno-reorder-blocks -fno-optimize-sibling-calls
185target-i386/op.c_CFLAGS.x86 = -fno-gcse -fno-instrument-functions -mpreferred-stack-boundary=2
186target-i386/helper.c_CFLAGS.x86 = -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-gcse
187cpu-exec.c_CFLAGS.x86 = -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-gcse
188
189
190ifeq ($(BUILD_TARGET_ARCH),amd64)
191#
192# The VBoxREM2 wrapper.
193#
194VBoxREM_TEMPLATE = VBOXR3
195VBoxREM_DEFS = IN_REM_R3
196VBoxREM_SOURCES = \
197 VBoxREMWrapper.cpp \
198 VBoxREMWrapperA.asm
199VBoxREM_LIBS = \
200 $(LIB_VMM) \
201 $(LIB_RUNTIME)
202endif
203
204
205#
206# The VBoxREM import library.
207#
208VBoxREMImp_TEMPLATE = VBOXR3
209VBoxREMImp_SOURCES.win = VBoxREM.def
210VBoxREMImp_SOURCES.os2 = $(PATH_TARGET)/VBoxREMOS2.def
211ifeq ($(filter win os2,$(BUILD_TARGET)),)
212VBoxREMImp_SOURCES = $(PATH_TARGET)/VBoxREMImp.c
213endif
214VBoxREMImp_SONAME.linux = VBoxREM.so
215VBoxREMImp_SONAME.l4 = VBoxREM.s.so
216VBoxREMImp_LDFLAGS.darwin = -install_name VBoxREM.dylib
217VBoxREMImp_LDFLAGS.l4 = -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
218
219$(PATH_TARGET)/VBoxREMImp.c: VBoxREM.def deftoimp.sed | $(call DIRDEP,$(PATH_TARGET))
220 $(MKDIR) -p $(PATH_TARGET)
221 $(SED) -f deftoimp.sed VBoxREM.def > $@.tmp
222 $(MV) -f $@.tmp $@
223
224$(VBoxREMImp_SOURCES.os2): VBoxREM.def $(MAKEFILE) | $(call DIRDEP,$(PATH_TARGET))
225 $(SED) \
226 -e 's/^[ \t][ \t]*REMR3/ _REMR3/' \
227 -e 's/\.[Dd][Ll][Ll]//' \
228 -e 's/^LIBRARY .*/LIBRARY VBoxREM INITINSTANCE TERMINSTANCE\nDATA MULTIPLE\n/' \
229 VBoxREM.def > $@.tmp
230 $(MV) -f $@.tmp $@
231
232
233
234include $(PATH_KBUILD)/footer.kmk
235
236
237#
238# Generate the op.S file somehow...
239#
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
242# for doing this, so we're currently left to our own devices here.
243#
244
245ifndef VBOX_RECOMPILER_OP_GCC
246 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
254endif
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 $@ $@.tmp $@.tmp2
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 ) \
275 target-i386/op.c \
276 ) -o $@.tmp \
277 || $(CP) staged/op-elf-$(BUILD_TARGET_ARCH).S $@.tmp # @todo only do this with gcc-4.
278 $(SED) -f op-validate.sed $@.tmp || $(CP) staged/op-elf-$(BUILD_TARGET_ARCH).S $@.tmp # This isn't good enough yet.
279ifeq ($(BUILD_TARGET),darwin)
280 $(SED) -f op-darwin.sed $@.tmp > $@.tmp2
281 $(MV) -f $@.tmp2 $@.tmp
282endif
283 $(MV) -f $@.tmp $@
284
285
286# predefined dependencies to the headers are generated.
287translate-all.c: $(PATH_$(REM_MOD))/op.h $(PATH_$(REM_MOD))/opc.h
288target-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.
291DYNGEN = $(PATH_dyngen)/dyngen$(HOSTSUFF_EXE)
292DYNGEN_EXEC = $(DYNGEN)
293ifneq ($(BUILD_PLATFORM),$(BUILD_TARGET)) # hack for crosscompiling.
294 ifeq ($(BUILD_TARGET),win)
295 DYNGEN = $(PATH_dyngen)/dyngen.exe
296 DYNGEN_EXEC := $(EXEC_X86_WIN32) $(DYNGEN_EXEC)
297 endif
298endif
299
300
301$(PATH_$(REM_MOD))/op.h: $(FILE_OP_OBJ) $(DYNGEN)
302 $(call MSG_L1,dyngen => $@)
303 $(QUIET)$(DYNGEN_EXEC) -o $@ $<
304
305$(PATH_$(REM_MOD))/opc.h: $(FILE_OP_OBJ) $(DYNGEN)
306 $(call MSG_L1,dyngen => $@)
307 $(QUIET)$(DYNGEN_EXEC) -c -o $@ $<
308
309$(PATH_$(REM_MOD))/gen-op.h: $(FILE_OP_OBJ) $(DYNGEN)
310 $(call MSG_L1,dyngen => $@)
311 $(QUIET)$(DYNGEN_EXEC) -g -o $@ $<
312
313importlib: $(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
321qemu-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
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