-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.in
286 lines (247 loc) · 9.96 KB
/
Makefile.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# Copyright (C) 2001-2012 The Bochs Project
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
####################################################
# NOTE: To be compatibile with nmake (microsoft vc++) please follow
# the following rules:
# use $(VAR) not ${VAR}
prefix = @prefix@
exec_prefix = @exec_prefix@
srcdir = @srcdir@
VPATH = @srcdir@
bindir = @bindir@
libdir = @libdir@
datarootdir = @datarootdir@
mandir = @mandir@
man1dir = $(mandir)/man1
man5dir = $(mandir)/man5
docdir = $(datarootdir)/doc/bochs
sharedir = $(datarootdir)/bochs
top_builddir = .
top_srcdir = $(srcdir)
DESTDIR =
VERSION=@VERSION@
VER_STRING=@VER_STRING@
REL_STRING=@REL_STRING@
MAN_PAGE_1_LIST=box
MAN_PAGE_5_LIST=bochsrc
INSTALL_LIST_SHARE=bios/BIOS-bochs-* bios/VGABIOS* @INSTALL_LIST_FOR_PLATFORM@
INSTALL_LIST_DOC=CHANGES COPYING README TODO
INSTALL_LIST_BIN=bochs@EXE@ bximage@EXE@ bxcommit@EXE@
INSTALL_LIST_BIN_OPTIONAL=bochsdbg@EXE@
INSTALL_LIST_WIN32=$(INSTALL_LIST_SHARE) $(INSTALL_LIST_DOC) $(INSTALL_LIST_BIN) $(INSTALL_LIST_BIN_OPTIONAL) niclist@EXE@
INSTALL_LIST_MACOSX=$(INSTALL_LIST_SHARE) $(INSTALL_LIST_DOC) bochs.scpt
# for win32 and macosx, these files get renamed to *.txt in install process
TEXT_FILE_LIST=README CHANGES COPYING TODO VGABIOS-elpin-LICENSE VGABIOS-lgpl-README
CP=cp
CAT=cat
RM=rm
MV=mv
LN_S=ln -sf
DLXLINUX_TAR=dlxlinux4.tar.gz
DLXLINUX_TAR_URL=http://bochs.sourceforge.net/guestos/$(DLXLINUX_TAR)
DLXLINUX_ROMFILE=BIOS-bochs-latest
GUNZIP=gunzip
WGET=@WGET@
SED=sed
MKDIR=mkdir
RMDIR=rmdir
TAR=tar
CHMOD=chmod
# the GZIP variable is reserved by gzip program
GZIP_BIN=gzip -9
GUNZIP=gunzip
ZIP=zip
UNIX2DOS=unix2dos
LIBTOOL=@LIBTOOL@
DLLTOOL=dlltool
RC_CMD=@RC_CMD@
@SUFFIX_LINE@
srcdir = @srcdir@
VPATH = @srcdir@
SHELL = @SHELL@
@SET_MAKE@
CC = @CC@
CXX = @CXX@
CFLAGS = @CFLAGS@ @GUI_CFLAGS@ $(MCH_CFLAGS) $(FLA_FLAGS) @DEFINE_PLUGIN_PATH@ -DBX_SHARE_PATH='"$(sharedir)"'
CXXFLAGS = @CXXFLAGS@ @GUI_CXXFLAGS@ $(MCH_CFLAGS) $(FLA_FLAGS) @DEFINE_PLUGIN_PATH@ -DBX_SHARE_PATH='"$(sharedir)"'
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
RANLIB = @RANLIB@
CFLAGS_CONSOLE = @CFLAGS@ $(MCH_CFLAGS) $(FLA_FLAGS)
CXXFLAGS_CONSOLE = @CXXFLAGS@ $(MCH_CFLAGS) $(FLA_FLAGS)
BXIMAGE_LINK_OPTS = @BXIMAGE_LINK_OPTS@
BX_INCDIRS = -I. -I$(srcdir)/. -I@INSTRUMENT_DIR@ -I$(srcdir)/@INSTRUMENT_DIR@
NONINLINE_OBJS = \
@EXTRA_BX_OBJS@
DEBUGGER_LIB = bx_debug/libdebug.a
DISASM_LIB = disasm/libdisasm.a
INSTRUMENT_LIB = @INSTRUMENT_DIR@/libinstrument.a
FPU_LIB = fpu/libfpu.a
READLINE_LIB = @READLINE_LIB@
EXTRA_LINK_OPTS = @EXTRA_LINK_OPTS@
GDBSTUB_OBJS = gdbstub.o
BX_OBJS = @NONINLINE_VAR@
BX_INCLUDES = bochs.h config.h
$(CXX) @DASH@c $(BX_INCDIRS) $(CXXFLAGS) @CXXFP@$< @OFP@$@
.c.o:
$(CC) @DASH@c $(BX_INCDIRS) $(CFLAGS) $(FPU_FLAGS) $< @OFP@$@
SUBDIRS = cpu fpu runtime elf disasm memory syscall
BX_OBJS = $(wildcard $(addsuffix /*.o, $(SUBDIRS)))
.PHONY: build-deps clean dist-clean $(SUBDIRS)
all: @PRIMARY_TARGET@
all: box
box@EXE@: build-deps
@LINK@ @EXPORT_DYNAMIC@ \
$(BX_OBJS) \
$(MCH_LINK_FLAGS) \
$(SIMX86_LINK_FLAGS) \
$(READLINE_LIB) \
$(EXTRA_LINK_OPTS) \
$(LIBS)
build-deps:
for subdir in $(SUBDIRS); do \
echo making $@ in $$subdir; \
($(MAKE) -C $$subdir $(MDEFINES) all) || exit 1; \
done
clean: local-clean
for subdir in $(SUBDIRS); do \
echo making $@ in $$subdir; \
($(MAKE) -C $$subdir $(MDEFINES) $@) || exit 1; \
done
dist-clean: local-dist-clean
for subdir in $(SUBDIRS); do \
echo making $@ in $$subdir; \
($(MAKE) -C $$subdir $(MDEFINES) $@) || exit 1; \
done
local-clean:
@RMCOMMAND@ *.o
@RMCOMMAND@ box@EXE@
@RMCOMMAND@ -rf bochs.app
@RMCOMMAND@ -rf .libs
local-dist-clean: local-clean
@RMCOMMAND@ config.h config.status config.log config.cache
@RMCOMMAND@ -rf autom4te.cache
@RMCOMMAND@ .dummy `find . -name '*.dsp' -o -name '*.dsw' -o -name '*.opt' -o -name '.DS_Store'`
@RMCOMMAND@ bxversion.h bxversion.rc build/linux/bochs-dlx _rpm_top *.rpm
@RMCOMMAND@ Makefile configure libtool
@RMCOMMAND@ ltdlconf.h
###########################################
# Build app on MacOS X
###########################################
MACOSX_STUFF=build/macosx
MACOSX_STUFF_SRCDIR=$(srcdir)/$(MACOSX_STUFF)
APP=bochs.app
APP_PLATFORM=MacOS
SCRIPT_EXEC=bochs.scpt
SCRIPT_DATA=$(MACOSX_STUFF_SRCDIR)/script.data
SCRIPT_R=$(MACOSX_STUFF_SRCDIR)/script.r
SCRIPT_APPLESCRIPT=$(MACOSX_STUFF_SRCDIR)/bochs.applescript
SCRIPT_COMPILED_RSRC=$(MACOSX_STUFF)/script_compiled.rsrc
REZ=/Developer/Tools/Rez
CPMAC=/Developer/Tools/CpMac
RINCLUDES=/System/Library/Frameworks/Carbon.framework/Libraries/RIncludes
REZ_ARGS=-append -i $RINCLUDES -d SystemSevenOrLater=1 -useDF
STANDALONE_LIBDIR=`pwd`/$(APP)/Contents/$(APP_PLATFORM)/lib
OSACOMPILE=/usr/bin/osacompile
SETFILE=/Developer/Tools/SetFile
# On a MacOS X machine, you run rez, osacompile, and setfile to
# produce the script executable, which has both a data fork and a
# resource fork. Ideally, we would just recompile the whole
# executable at build time, but unfortunately this cannot be done on
# the SF compile farm through an ssh connection because osacompile
# needs to be run locally for some reason. Solution: If the script
# sources are changed, rebuild the executable on a MacOSX machine,
# split it into its data and resource forks and check them into SVN
# as separate files. Then at release time, all that's left to do is
# put the data and resource forks back together to make a working script.
# (This can be done through ssh.)
#
# Sources:
# 1. script.r: resources for the script
# 2. script.data: binary data for the script
# 3. bochs.applescript: the source of the script
#
# NOTE: All of this will fail if you aren't building on an HFS+
# filesystem! On the SF compile farm building in your user directory
# will fail, while doing the build in /tmp will work ok.
# check if this filesystem supports resource forks at all
test_hfsplus:
$(RM) -rf test_hfsplus
echo data > test_hfsplus
# if you get "Not a directory", then this filesystem doesn't support resources
echo resource > test_hfsplus/rsrc
# test succeeded
$(RM) -rf test_hfsplus
# Step 1 (must be done locally on MacOSX, only when sources change)
# Compile and pull out just the resource fork. The resource fork is
# checked into SVN as script_compiled.rsrc. Note that we don't need
# to check in the data fork of tmpscript because it is identical to the
# script.data input file.
$(SCRIPT_COMPILED_RSRC): $(SCRIPT_R) $(SCRIPT_APPLESCRIPT)
$(RM) -f tmpscript
$(CP) -f $(SCRIPT_DATA) tmpscript
$(REZ) -append $(SCRIPT_R) -o tmpscript
$(OSACOMPILE) -o tmpscript $(SCRIPT_APPLESCRIPT)
$(CP) tmpscript/rsrc $(SCRIPT_COMPILED_RSRC)
$(RM) -f tmpscript
# Step 2 (can be done locally or remotely on MacOSX)
# Combine the data fork and resource fork, and set attributes.
$(SCRIPT_EXEC): $(SCRIPT_DATA) $(SCRIPT_COMPILED_RSRC)
rm -f $(SCRIPT_EXEC)
$(CP) $(SCRIPT_DATA) $(SCRIPT_EXEC)
if test ! -f $(SCRIPT_COMPILED_RSRC); then $(CP) $(srcdir)/$(SCRIPT_COMPILED_RSRC) $(SCRIPT_COMPILED_RSRC); fi
$(CP) $(SCRIPT_COMPILED_RSRC) $(SCRIPT_EXEC)/rsrc
$(SETFILE) -t "APPL" -c "aplt" $(SCRIPT_EXEC)
$(APP)/.build: bochs test_hfsplus $(SCRIPT_EXEC)
rm -f $(APP)/.build
$(MKDIR) -p $(APP)
$(MKDIR) -p $(APP)/Contents
$(CP) -f $(MACOSX_STUFF)/Info.plist $(APP)/Contents
$(CP) -f $(MACOSX_STUFF_SRCDIR)/pbdevelopment.plist $(APP)/Contents
echo -n "APPL????" > $(APP)/Contents/PkgInfo
$(MKDIR) -p $(APP)/Contents/$(APP_PLATFORM)
$(CP) bochs $(APP)/Contents/$(APP_PLATFORM)
$(MKDIR) -p $(APP)/Contents/Resources
$(REZ) $(REZ_ARGS) $(MACOSX_STUFF_SRCDIR)/bochs.r -o $(APP)/Contents/Resources/bochs.rsrc
$(CP) -f $(MACOSX_STUFF_SRCDIR)/bochs-icn.icns $(APP)/Contents/Resources
ls -ld $(APP) $(SCRIPT_EXEC) $(SCRIPT_EXEC)/rsrc
touch $(APP)/.build
$(APP)/.build_plugins: $(APP)/.build bochs_plugins
rm -f $(APP)/.build_plugins
$(MKDIR) -p $(STANDALONE_LIBDIR);
list=`cd gui && echo *.la`; for i in $$list; do $(LIBTOOL) cp gui/$$i $(STANDALONE_LIBDIR); done;
list=`cd iodev && echo *.la`; for i in $$list; do $(LIBTOOL) cp iodev/$$i $(STANDALONE_LIBDIR); done;
$(LIBTOOL) --finish $(STANDALONE_LIBDIR);
touch $(APP)/.build_plugins
install_macosx: all download_dlx install_man @INSTALL_DOCBOOK_VAR@
-mkdir -p $(DESTDIR)$(sharedir)
for i in $(INSTALL_LIST_MACOSX); do if test -e $$i; then $(CPMAC) -r $$i $(DESTDIR)$(sharedir); else $(CPMAC) -r $(srcdir)/$$i $(DESTDIR)$(sharedir); fi; done
$(CPMAC) $(srcdir)/.bochsrc $(DESTDIR)$(sharedir)/bochsrc-sample.txt
-mkdir $(DESTDIR)$(sharedir)/keymaps
$(CPMAC) $(srcdir)/gui/keymaps/*.map $(DESTDIR)$(sharedir)/keymaps
cat $(DLXLINUX_TAR) | (cd $(DESTDIR)$(sharedir) && tar xzvf -)
dlxrc=$(DESTDIR)$(sharedir)/dlxlinux/bochsrc.txt; mv "$$dlxrc" "$$dlxrc.orig" && sed < "$$dlxrc.orig" 's/\/usr\/local\/bochs\/latest/../' > "$$dlxrc" && rm -f "$$dlxrc.orig"
mv $(srcdir)/README $(srcdir)/README.orig
cat $(srcdir)/build/macosx/README.macosx-binary $(srcdir)/README.orig > $(DESTDIR)$(sharedir)/README
rm -f $(DESTDIR)$(sharedir)/README.orig
$(CPMAC) $(SCRIPT_EXEC) $(DESTDIR)$(sharedir)/dlxlinux
# for i in $(TEXT_FILE_LIST); do mv $(srcdir)/$$i $(DESTDIR)$(sharedir)/$$i.txt; done
###########################################
# dependencies generated by
# gcc -MM -I. -Iinstrument/stubs *.cc | sed -e 's/\.cc/.@CPP_SUFFIX@/g' -e 's,cpu/,cpu/,g'
###########################################