Home | History | Annotate | Download | only in bochs
      1 # Copyright (C) 2002  MandrakeSoft S.A.
      2 #
      3 #   MandrakeSoft S.A.
      4 #   43, rue d'Aboukir
      5 #   75002 Paris - France
      6 #   http://www.linux-mandrake.com/
      7 #   http://www.mandrakesoft.com/
      8 #
      9 # This library is free software; you can redistribute it and/or
     10 # modify it under the terms of the GNU Lesser General Public
     11 # License as published by the Free Software Foundation; either
     12 # version 2 of the License, or (at your option) any later version.
     13 #
     14 # This library is distributed in the hope that it will be useful,
     15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
     16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     17 # Lesser General Public License for more details.
     18 #
     19 # You should have received a copy of the GNU Lesser General Public
     20 # License along with this library; if not, write to the Free Software
     21 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
     22 #
     23 ####################################################
     24 # NOTE: To be compatibile with nmake (microsoft vc++) please follow
     25 # the following rules:
     26 #   use $(VAR) not ${VAR}
     27 
     28 prefix          = @prefix@
     29 exec_prefix     = @exec_prefix@
     30 srcdir          = @srcdir@
     31 VPATH = @srcdir@
     32 bindir          = @bindir@
     33 libdir          = @libdir@
     34 plugdir         = @libdir@/bochs/plugins
     35 datarootdir     = @datarootdir@
     36 mandir          = @mandir@
     37 man1dir         = $(mandir)/man1
     38 man5dir         = $(mandir)/man5
     39 docdir          = $(datarootdir)/doc/bochs
     40 sharedir        = $(datarootdir)/bochs
     41 top_builddir    = .
     42 top_srcdir      = $(srcdir)
     43 
     44 DESTDIR =
     45 
     46 VERSION=@VERSION@
     47 VER_STRING=@VER_STRING@
     48 REL_STRING=@REL_STRING@
     49 MAN_PAGE_1_LIST=bochs bximage bxcommit bochs-dlx
     50 MAN_PAGE_5_LIST=bochsrc
     51 INSTALL_LIST_SHARE=bios/BIOS-bochs-* bios/VGABIOS* @INSTALL_LIST_FOR_PLATFORM@
     52 INSTALL_LIST_DOC=CHANGES COPYING README TODO
     53 INSTALL_LIST_BIN=bochs@EXE@ bximage@EXE@ bxcommit@EXE@
     54 INSTALL_LIST_BIN_OPTIONAL=bochsdbg@EXE@
     55 INSTALL_LIST_WIN32=$(INSTALL_LIST_SHARE) $(INSTALL_LIST_DOC) $(INSTALL_LIST_BIN) $(INSTALL_LIST_BIN_OPTIONAL) niclist@EXE@
     56 INSTALL_LIST_MACOSX=$(INSTALL_LIST_SHARE) $(INSTALL_LIST_DOC) bochs.scpt
     57 # for win32 and macosx, these files get renamed to *.txt in install process
     58 TEXT_FILE_LIST=README CHANGES COPYING TODO VGABIOS-elpin-LICENSE VGABIOS-lgpl-README
     59 CP=cp
     60 CAT=cat
     61 RM=rm
     62 MV=mv
     63 LN_S=ln -sf
     64 DLXLINUX_TAR=dlxlinux4.tar.gz
     65 DLXLINUX_TAR_URL=http://bochs.sourceforge.net/guestos/$(DLXLINUX_TAR)
     66 DLXLINUX_ROMFILE=BIOS-bochs-latest
     67 GUNZIP=gunzip
     68 WGET=@WGET@
     69 SED=sed
     70 MKDIR=mkdir
     71 RMDIR=rmdir
     72 TAR=tar
     73 CHMOD=chmod
     74 # the GZIP variable is reserved by gzip program
     75 GZIP_BIN=gzip -9
     76 GUNZIP=gunzip
     77 ZIP=zip
     78 UNIX2DOS=unix2dos
     79 LIBTOOL=@LIBTOOL@
     80 DLLTOOL=dlltool
     81 RC_CMD=@RC_CMD@
     82 
     83 @SUFFIX_LINE@
     84 
     85 srcdir = @srcdir@
     86 VPATH = @srcdir@
     87 
     88 SHELL = /bin/sh
     89 
     90 @SET_MAKE@
     91 
     92 CC = @CC@
     93 CXX = @CXX@
     94 CFLAGS = @CFLAGS@ @GUI_CFLAGS@ $(MCH_CFLAGS) $(FLA_FLAGS) @DEFINE_PLUGIN_PATH@ -DBX_SHARE_PATH='"$(sharedir)"'
     95 CXXFLAGS = @CXXFLAGS@ @GUI_CXXFLAGS@ $(MCH_CFLAGS) $(FLA_FLAGS) @DEFINE_PLUGIN_PATH@ -DBX_SHARE_PATH='"$(sharedir)"'
     96 
     97 LDFLAGS = @LDFLAGS@
     98 LIBS = @LIBS@
     99 # To compile with readline:
    100 #   linux needs just -lreadline
    101 #   solaris needs -lreadline -lcurses
    102 X_LIBS = @X_LIBS@
    103 X_PRE_LIBS = @X_PRE_LIBS@
    104 XPM_LIB = @XPM_LIB@
    105 GUI_LINK_OPTS_X = $(X_LIBS) $(X_PRE_LIBS) -lX11 $(XPM_LIB)
    106 GUI_LINK_OPTS_SDL = `sdl-config --cflags --libs`
    107 GUI_LINK_OPTS_SVGA =  -lvga -lvgagl
    108 GUI_LINK_OPTS_BEOS = -lbe
    109 GUI_LINK_OPTS_RFB = @RFB_LIBS@
    110 GUI_LINK_OPTS_AMIGAOS =
    111 GUI_LINK_OPTS_WIN32 = -luser32 -lgdi32 -lcomdlg32 -lcomctl32 -lwsock32 -lshell32
    112 GUI_LINK_OPTS_WIN32_VCPP = user32.lib gdi32.lib winmm.lib \
    113   comdlg32.lib comctl32.lib wsock32.lib advapi32.lib shell32.lib
    114 GUI_LINK_OPTS_MACOS =
    115 GUI_LINK_OPTS_CARBON = -framework Carbon
    116 GUI_LINK_OPTS_NOGUI =
    117 GUI_LINK_OPTS_TERM = @GUI_LINK_OPTS_TERM@
    118 GUI_LINK_OPTS_WX = @GUI_LINK_OPTS_WX@
    119 GUI_LINK_OPTS = @GUI_LINK_OPTS@  @DEVICE_LINK_OPTS@
    120 RANLIB = @RANLIB@
    121 
    122 CFLAGS_CONSOLE = @CFLAGS@ $(MCH_CFLAGS) $(FLA_FLAGS)
    123 CXXFLAGS_CONSOLE = @CXXFLAGS@ $(MCH_CFLAGS) $(FLA_FLAGS)
    124 BXIMAGE_LINK_OPTS = @BXIMAGE_LINK_OPTS@
    125 
    126 BX_INCDIRS = -I. -I$(srcdir)/. -I@INSTRUMENT_DIR@ -I$(srcdir)/@INSTRUMENT_DIR@
    127 
    128 #SUBDIRS = iodev bx_debug
    129 
    130 #all install uninstall: config.h#
    131 #        for subdir in $(SUBDIRS); do #
    132 #          echo making $@ in $$subdir; #
    133 #          ($(MAKE) -C $$subdir $(MDEFINES) $@) || exit 1; #
    134 #        done#
    135 
    136 
    137 
    138 # gnu flags for clean up
    139 #CFLAGS  = -ansi -O -g -Wunused -Wuninitialized
    140 
    141 
    142 NONINLINE_OBJS = \
    143 	logio.o \
    144 	main.o \
    145 	config.o \
    146 	load32bitOShack.o \
    147 	pc_system.o \
    148 	osdep.o \
    149 	plugin.o \
    150 	crc.o \
    151 	@EXTRA_BX_OBJS@
    152 
    153 EXTERN_ENVIRONMENT_OBJS = \
    154 	main.o \
    155 	config.o \
    156 	load32bitOShack.o \
    157 	pc_system.o
    158 
    159 DEBUGGER_LIB   = bx_debug/libdebug.a
    160 DISASM_LIB     = disasm/libdisasm.a
    161 INSTRUMENT_LIB = @INSTRUMENT_DIR@/libinstrument.a
    162 FPU_LIB        = fpu/libfpu.a
    163 READLINE_LIB   = @READLINE_LIB@
    164 EXTRA_LINK_OPTS = @EXTRA_LINK_OPTS@
    165 
    166 GDBSTUB_OBJS = gdbstub.o
    167 
    168 BX_OBJS = @NONINLINE_VAR@
    169 
    170 BX_INCLUDES = bochs.h config.h osdep.h
    171 
    172 
    173 .@CPP_SUFFIX@.o:
    174 	$(CXX) @DASH@c $(BX_INCDIRS) $(CXXFLAGS) @CXXFP@$< @OFP@$@
    175 .c.o:
    176 	$(CC) @DASH@c $(BX_INCDIRS) $(CFLAGS) $(FPU_FLAGS) $< @OFP@$@
    177 
    178 
    179 all: @PRIMARY_TARGET@ @PLUGIN_TARGET@ bximage@EXE@ bxcommit@EXE@ @BUILD_DOCBOOK_VAR@
    180 
    181 @EXTERNAL_DEPENDENCY@
    182 
    183 bochs@EXE@: @IODEV_LIB_VAR@ @DEBUGGER_VAR@ \
    184            cpu/libcpu.a memory/libmemory.a gui/libgui.a \
    185            @DISASM_VAR@ @INSTRUMENT_VAR@ $(BX_OBJS) \
    186            $(SIMX86_OBJS) @FPU_VAR@ @GDBSTUB_VAR@ @PLUGIN_VAR@
    187 	@LINK@ @EXPORT_DYNAMIC@ $(BX_OBJS) $(SIMX86_OBJS) \
    188 		@IODEV_LIB_VAR@ @DEBUGGER_VAR@ cpu/libcpu.a memory/libmemory.a gui/libgui.a \
    189 		@DISASM_VAR@ @INSTRUMENT_VAR@ @PLUGIN_VAR@ \
    190 		@GDBSTUB_VAR@ @FPU_VAR@ \
    191 		@NONPLUGIN_GUI_LINK_OPTS@ \
    192 		$(MCH_LINK_FLAGS) \
    193 		$(SIMX86_LINK_FLAGS) \
    194 		$(READLINE_LIB) \
    195 		$(EXTRA_LINK_OPTS) \
    196 		$(LIBS)
    197 
    198 # Special make target for cygwin/mingw using dlltool instead of
    199 # libtool.  This creates a .DEF file, and exports file, an import library,
    200 # and then links bochs.exe with the exports file.
    201 .win32_dll_plugin_target: @IODEV_LIB_VAR@ @DEBUGGER_VAR@ \
    202            cpu/libcpu.a memory/libmemory.a gui/libgui.a \
    203            @DISASM_VAR@ @INSTRUMENT_VAR@ $(BX_OBJS) \
    204            $(SIMX86_OBJS) @FPU_VAR@ @GDBSTUB_VAR@ @PLUGIN_VAR@
    205 	$(DLLTOOL) --export-all-symbols --output-def bochs.def \
    206 		$(BX_OBJS) $(SIMX86_OBJS) \
    207 		@IODEV_LIB_VAR@ cpu/libcpu.a memory/libmemory.a gui/libgui.a \
    208 		@DEBUGGER_VAR@ @DISASM_VAR@ @INSTRUMENT_VAR@ @PLUGIN_VAR@ \
    209 		@GDBSTUB_VAR@ @FPU_VAR@
    210 	$(DLLTOOL) --dllname bochs.exe --def bochs.def --output-lib dllexports.a
    211 	$(DLLTOOL) --dllname bochs.exe --output-exp bochs.exp --def bochs.def
    212 	$(CXX) -o bochs.exe $(CXXFLAGS) $(LDFLAGS) -export-dynamic \
    213 	    $(BX_OBJS) bochs.exp $(SIMX86_OBJS) \
    214 		@IODEV_LIB_VAR@ cpu/libcpu.a memory/libmemory.a gui/libgui.a \
    215 		@DEBUGGER_VAR@ @DISASM_VAR@ @INSTRUMENT_VAR@ @PLUGIN_VAR@ \
    216 		@GDBSTUB_VAR@ @FPU_VAR@ \
    217 		$(GUI_LINK_OPTS) \
    218 		$(MCH_LINK_FLAGS) \
    219 		$(SIMX86_LINK_FLAGS) \
    220 		$(READLINE_LIB) \
    221 		$(EXTRA_LINK_OPTS) \
    222 		$(LIBS)
    223 	touch .win32_dll_plugin_target
    224 
    225 bochs_plugins:
    226 	cd gui @COMMAND_SEPARATOR@
    227 	$(MAKE) plugins
    228 	@CD_UP_ONE@
    229 	cd iodev @COMMAND_SEPARATOR@
    230 	$(MAKE) plugins
    231 	@CD_UP_ONE@
    232 
    233 bximage@EXE@: misc/bximage.o
    234 	@LINK_CONSOLE@ $(BXIMAGE_LINK_OPTS) misc/bximage.o
    235 
    236 bxcommit@EXE@: misc/bxcommit.o
    237 	@LINK_CONSOLE@ misc/bxcommit.o
    238 
    239 niclist@EXE@: misc/niclist.o
    240 	@LINK_CONSOLE@ misc/niclist.o
    241 
    242 # compile with console CXXFLAGS, not gui CXXFLAGS
    243 misc/bximage.o: $(srcdir)/misc/bximage.c $(srcdir)/iodev/hdimage.h
    244 	$(CC) @DASH@c $(BX_INCDIRS) $(CFLAGS_CONSOLE) $(srcdir)/misc/bximage.c @OFP@$@
    245 
    246 misc/bxcommit.o: $(srcdir)/misc/bxcommit.c $(srcdir)/iodev/hdimage.h
    247 	$(CC) @DASH@c $(BX_INCDIRS) $(CFLAGS_CONSOLE) $(srcdir)/misc/bxcommit.c @OFP@$@
    248 
    249 misc/niclist.o: $(srcdir)/misc/niclist.c
    250 	$(CC) @DASH@c $(BX_INCDIRS) $(CFLAGS_CONSOLE) $(srcdir)/misc/niclist.c @OFP@$@
    251 
    252 $(BX_OBJS): $(BX_INCLUDES)
    253 
    254 # cannot use -C option to be compatible with Microsoft nmake
    255 iodev/libiodev.a::
    256 	cd iodev @COMMAND_SEPARATOR@
    257 	$(MAKE) $(MDEFINES) libiodev.a
    258 	@CD_UP_ONE@
    259 
    260 bx_debug/libdebug.a::
    261 	cd bx_debug @COMMAND_SEPARATOR@
    262 	$(MAKE) $(MDEFINES) libdebug.a
    263 	@CD_UP_ONE@
    264 
    265 cpu/libcpu.a::
    266 	cd cpu @COMMAND_SEPARATOR@
    267 	$(MAKE) $(MDEFINES) libcpu.a
    268 	@CD_UP_ONE@
    269 
    270 memory/libmemory.a::
    271 	cd memory @COMMAND_SEPARATOR@
    272 	$(MAKE) $(MDEFINES) libmemory.a
    273 	@CD_UP_ONE@
    274 
    275 gui/libgui.a::
    276 	cd gui @COMMAND_SEPARATOR@
    277 	$(MAKE) $(MDEFINES) libgui.a
    278 	@CD_UP_ONE@
    279 
    280 disasm/libdisasm.a::
    281 	cd disasm @COMMAND_SEPARATOR@
    282 	$(MAKE) $(MDEFINES) libdisasm.a
    283 	@CD_UP_ONE@
    284 
    285 @INSTRUMENT_DIR@/libinstrument.a::
    286 	cd @INSTRUMENT_DIR@ @COMMAND_SEPARATOR@
    287 	$(MAKE) $(MDEFINES) libinstrument.a
    288 	@CD_UP_TWO@
    289 
    290 fpu/libfpu.a::
    291 	cd fpu @COMMAND_SEPARATOR@
    292 	$(MAKE) $(MDEFINES) libfpu.a
    293 	@CD_UP_ONE@
    294 
    295 libbochs.a:
    296 	-rm -f libbochs.a
    297 	ar rv libbochs.a $(EXTERN_ENVIRONMENT_OBJS)
    298 	$(RANLIB) libbochs.a
    299 
    300 libbochs_cpu.a: @DEBUGGER_VAR@ $(BX_OBJS)
    301 	-rm -f libbochs_cpu.a
    302 	ar rv libbochs_cpu.a $(BX_OBJS)
    303 	$(RANLIB) libbochs_cpu.a
    304 
    305 # for wxWidgets port, on win32 platform
    306 wxbochs_resources.o: wxbochs.rc
    307 	windres $(srcdir)/wxbochs.rc -o $@ --include-dir=`@WX_CONFIG@ --prefix`/include
    308 
    309 # for win32 gui
    310 win32res.o: win32res.rc bxversion.rc
    311 	$(RC_CMD)$@ $(srcdir)/win32res.rc
    312 
    313 #####################################################################
    314 # Install target for all platforms.
    315 #####################################################################
    316 
    317 install: all @INSTALL_TARGET@
    318 
    319 #####################################################################
    320 # Install target for win32
    321 #
    322 # This is intended to be run in cygwin, since it has better scripting
    323 # tools.
    324 #####################################################################
    325 
    326 install_win32: download_dlx @INSTALL_DOCBOOK_VAR@
    327 	-mkdir -p $(prefix)
    328 	cp obj-release/*.exe .
    329 	for i in $(INSTALL_LIST_WIN32); do if test -f $$i; then cp $$i $(prefix); else cp $(srcdir)/$$i $(prefix); fi; done
    330 	cp $(srcdir)/misc/sb16/sb16ctrl.example $(prefix)/sb16ctrl.txt
    331 	cp $(srcdir)/misc/sb16/sb16ctrl.exe $(prefix)
    332 	#cat $(srcdir)/build/win32/DOC-win32.htm | $(SED) -e 's/@VERSION@/$(VERSION)/g' > $(prefix)/DOC-win32.htm
    333 	cp $(srcdir)/.bochsrc $(prefix)/bochsrc-sample.txt
    334 	-mkdir $(prefix)/keymaps
    335 	cp $(srcdir)/gui/keymaps/*.map $(prefix)/keymaps
    336 	cat $(DLXLINUX_TAR) | (cd $(prefix) && tar xzvf -)
    337 	echo '..\bochs' > $(prefix)/dlxlinux/start.bat
    338 	dlxrc=$(prefix)/dlxlinux/bochsrc.txt; mv $$dlxrc $$dlxrc.orig && sed < $$dlxrc.orig 's/\/usr\/local\/bochs\/latest/../' > $$dlxrc && rm -f $$dlxrc.orig
    339 	mv $(prefix)/README $(prefix)/README.orig
    340 	cat $(srcdir)/build/win32/README.win32-binary $(prefix)/README.orig > $(prefix)/README
    341 	rm -f $(prefix)/README.orig
    342 	for i in $(TEXT_FILE_LIST); do mv $(prefix)/$$i $(prefix)/$$i.txt; done
    343 	cd $(prefix); $(UNIX2DOS) *.txt */*.txt
    344 	cd $(prefix); NAME=`pwd|$(SED) 's/.*\///'`; (cd ..; $(ZIP) $$NAME.zip -r $$NAME); ls -l ../$$NAME.zip
    345 
    346 #####################################################################
    347 # install target for unix
    348 #####################################################################
    349 
    350 install_unix: install_bin @INSTALL_PLUGINS_VAR@ install_man install_share install_doc @INSTALL_DOCBOOK_VAR@
    351 
    352 install_bin::
    353 	for i in $(DESTDIR)$(bindir); do mkdir -p $$i && test -d $$i && test -w $$i; done
    354 	for i in $(INSTALL_LIST_BIN); do if test -f $$i; then install $$i $(DESTDIR)$(bindir); else install $(srcdir)/$$i $(DESTDIR)$(bindir); fi; done
    355 	-for i in $(INSTALL_LIST_BIN_OPTIONAL); do if test -f $$i; then install $$i $(DESTDIR)$(bindir); else install $(srcdir)/$$i $(DESTDIR)$(bindir); fi; done
    356 
    357 install_libtool_plugins::
    358 	for i in $(DESTDIR)$(plugdir); do mkdir -p $$i && test -d $$i && test -w $$i; done
    359 	list=`cd gui && echo *.la`; for i in $$list; do $(LIBTOOL) --mode=install install gui/$$i $(DESTDIR)$(plugdir); done
    360 	list=`cd iodev && echo *.la`; for i in $$list; do $(LIBTOOL) --mode=install install iodev/$$i $(DESTDIR)$(plugdir); done
    361 	$(LIBTOOL) --finish $(DESTDIR)$(plugdir)
    362 
    363 install_dll_plugins::
    364 	for i in $(DESTDIR)$(plugdir); do mkdir -p $$i && test -d $$i && test -w $$i; done
    365 	list=`cd gui && echo *.dll`; for i in $$list; do cp gui/$$i $(DESTDIR)$(plugdir); done
    366 	list=`cd iodev && echo *.dll`; for i in $$list; do cp iodev/$$i $(DESTDIR)$(plugdir); done
    367 
    368 install_share::
    369 	for i in $(DESTDIR)$(sharedir);	do mkdir -p $$i && test -d $$i && test -w $$i; done
    370 	for i in $(INSTALL_LIST_SHARE); do if test -f $$i; then install -m 644 $$i $(DESTDIR)$(sharedir); else install -m 644 $(srcdir)/$$i $(DESTDIR)$(sharedir); fi; done
    371 	-mkdir $(DESTDIR)$(sharedir)/keymaps
    372 	for i in $(srcdir)/gui/keymaps/*.map; do install -m 644 $$i $(DESTDIR)$(sharedir)/keymaps/; done
    373 
    374 install_doc::
    375 	for i in $(DESTDIR)$(docdir); do mkdir -p $$i && test -d $$i && test -w $$i; done
    376 	for i in $(INSTALL_LIST_DOC); do if test -f $$i; then install -m 644 $$i $(DESTDIR)$(docdir); else install -m 644 $(srcdir)/$$i $(DESTDIR)$(docdir); fi; done
    377 	$(RM) -f $(DESTDIR)$(docdir)/README
    378 	$(CAT) $(srcdir)/build/linux/README.linux-binary $(srcdir)/README > $(DESTDIR)$(docdir)/README
    379 	install -m 644 $(srcdir)/.bochsrc $(DESTDIR)$(docdir)/bochsrc-sample.txt
    380 
    381 
    382 build_docbook::
    383 	cd doc/docbook; make
    384 
    385 dl_docbook::
    386 	cd doc/docbook; make dl_docs
    387 
    388 install_docbook: build_docbook
    389 	cd doc/docbook; make install
    390 
    391 install_man::
    392 	-mkdir -p $(DESTDIR)$(man1dir)
    393 	-mkdir -p $(DESTDIR)$(man5dir)
    394 	for i in $(MAN_PAGE_1_LIST); do cat $(srcdir)/doc/man/$$i.1 | $(SED) 's/@version@/$(VERSION)/g' | $(GZIP_BIN) -c >  $(DESTDIR)$(man1dir)/$$i.1.gz; chmod 644 $(DESTDIR)$(man1dir)/$$i.1.gz; done
    395 	for i in $(MAN_PAGE_5_LIST); do cat $(srcdir)/doc/man/$$i.5 | $(GZIP_BIN) -c >  $(DESTDIR)$(man5dir)/$$i.5.gz; chmod 644 $(DESTDIR)$(man5dir)/$$i.5.gz; done
    396 
    397 download_dlx: $(DLXLINUX_TAR)
    398 
    399 $(DLXLINUX_TAR):
    400 	$(RM) -f $(DLXLINUX_TAR)
    401 	$(WGET) $(DLXLINUX_TAR_URL)
    402 	test -f $(DLXLINUX_TAR)
    403 
    404 unpack_dlx: $(DLXLINUX_TAR)
    405 	rm -rf dlxlinux
    406 	$(GUNZIP) -c $(DLXLINUX_TAR) | $(TAR) -xvf -
    407 	test -d dlxlinux
    408 	(cd dlxlinux; $(MV) bochsrc.txt bochsrc.txt.orig; $(SED) -e "s/1\.1\.2/$(VERSION)/g"  -e 's,/usr/local/bochs/latest,$(prefix)/share/bochs,g' < bochsrc.txt.orig > bochsrc.txt; rm -f bochsrc.txt.orig)
    409 
    410 install_dlx:
    411 	$(RM) -rf $(DESTDIR)$(sharedir)/dlxlinux
    412 	cp -r dlxlinux $(DESTDIR)$(sharedir)/dlxlinux
    413 	$(CHMOD) 755 $(DESTDIR)$(sharedir)/dlxlinux
    414 	$(GZIP_BIN) $(DESTDIR)$(sharedir)/dlxlinux/hd10meg.img
    415 	$(CHMOD) 644 $(DESTDIR)$(sharedir)/dlxlinux/*
    416 	for i in bochs-dlx; do cp $(srcdir)/build/linux/$$i $(DESTDIR)$(bindir)/$$i; $(CHMOD) 755 $(DESTDIR)$(bindir)/$$i; done
    417 
    418 uninstall::
    419 	$(RM) -rf $(DESTDIR)$(sharedir)
    420 	$(RM) -rf $(DESTDIR)$(docdir)
    421 	$(RM) -rf $(DESTDIR)$(libdir)/bochs
    422 	for i in bochs bximage bxcommit bochs-dlx; do rm -f $(DESTDIR)$(bindir)/$$i; done
    423 	for i in $(MAN_PAGE_1_LIST); do $(RM) -f $(man1dir)/$$i.1.gz; done
    424 	for i in $(MAN_PAGE_5_LIST); do $(RM) -f $(man5dir)/$$i.5.gz; done
    425 
    426 V6WORKSPACE_ZIP=build/win32/workspace.zip
    427 V6WORKSPACE_FILES=bochs.dsw bochs.dsp bochs.opt cpu/cpu.dsp \
    428 	memory/memory.dsp iodev/iodev.dsp instrument/stubs/stubs.dsp \
    429 	gui/gui.dsp fpu/fpu.dsp disasm/disasm.dsp bx_debug/bx_debug.dsp \
    430 	misc/niclist.dsp bximage.dsp bxcommit.dsp
    431 
    432 v6workspace:
    433 	zip $(V6WORKSPACE_ZIP) $(V6WORKSPACE_FILES)
    434 
    435 ########
    436 # the win32_snap target is used to create a ZIP of bochs sources configured
    437 # for VC++.  This ZIP is stuck on the website every once in a while to make
    438 # it easier for VC++ users to compile bochs.  First, you should
    439 # run "sh .conf.win32-vcpp" to configure the source code, then do
    440 # "make win32_snap" to unzip the workspace files and create the ZIP.
    441 ########
    442 win32_snap:
    443 	unzip $(V6WORKSPACE_ZIP)
    444 	$(SHELL) ./build/win32/cc2cpp
    445 	$(MAKE) zip
    446 	$(SHELL) ./build/win32/cpp2cc
    447 
    448 tar:
    449 	NAME=`pwd|$(SED) 's/.*\///'`; (cd ..; $(RM) -f $$NAME.zip; tar cf - $$NAME | $(GZIP_BIN) > $$NAME.tar.gz); ls -l ../$$NAME.tar.gz
    450 
    451 zip:
    452 	NAME=`pwd|$(SED) 's/.*\///'`; (cd ..; $(RM) -f $$NAME.zip; $(ZIP) $$NAME.zip -r $$NAME -x \*CVS\* -x \*.cvsignore ); ls -l ../$$NAME.zip
    453 
    454 clean:
    455 	@RMCOMMAND@ *.o
    456 	@RMCOMMAND@ *.a
    457 	@RMCOMMAND@ bochs
    458 	@RMCOMMAND@ bochs.exe
    459 	@RMCOMMAND@ bximage
    460 	@RMCOMMAND@ bximage.exe
    461 	@RMCOMMAND@ bxcommit
    462 	@RMCOMMAND@ bxcommit.exe
    463 	@RMCOMMAND@ niclist
    464 	@RMCOMMAND@ niclist.exe
    465 	@RMCOMMAND@ bochs.out
    466 	@RMCOMMAND@ bochsout.txt
    467 	@RMCOMMAND@ bochs.exp
    468 	@RMCOMMAND@ bochs.def
    469 	@RMCOMMAND@ bochs.scpt
    470 	@RMCOMMAND@ -rf bochs.app
    471 	@RMCOMMAND@ -rf .libs
    472 	@RMCOMMAND@ .win32_dll_plugin_target
    473 
    474 local-dist-clean: clean
    475 	@RMCOMMAND@ config.h config.status config.log config.cache
    476 	@RMCOMMAND@ .dummy `find . -name '*.dsp' -o -name '*.dsw' -o -name '*.opt' -o -name '.DS_Store'`
    477 	@RMCOMMAND@ bxversion.h build/linux/bochs-dlx _rpm_top *.rpm
    478 	@RMCOMMAND@ build/win32/nsis/Makefile build/win32/nsis/bochs.nsi
    479 	@RMCOMMAND@ build/macosx/Info.plist build/macosx/script_compiled.rsrc
    480 	@RMCOMMAND@ libtool
    481 	@RMCOMMAND@ ltdlconf.h
    482 
    483 all-clean: clean
    484 	cd iodev @COMMAND_SEPARATOR@
    485 	$(MAKE) clean
    486 	@CD_UP_ONE@
    487 	cd bx_debug @COMMAND_SEPARATOR@
    488 	$(MAKE) clean
    489 	@CD_UP_ONE@
    490 	cd cpu @COMMAND_SEPARATOR@
    491 	$(MAKE) clean
    492 	@CD_UP_ONE@
    493 	cd memory @COMMAND_SEPARATOR@
    494 	$(MAKE) clean
    495 	@CD_UP_ONE@
    496 	cd gui @COMMAND_SEPARATOR@
    497 	$(MAKE) clean
    498 	@CD_UP_ONE@
    499 	cd disasm @COMMAND_SEPARATOR@
    500 	$(MAKE) clean
    501 	@CD_UP_ONE@
    502 	cd @INSTRUMENT_DIR@ @COMMAND_SEPARATOR@
    503 	$(MAKE) clean
    504 	@CD_UP_TWO@
    505 	cd misc @COMMAND_SEPARATOR@
    506 	$(MAKE) clean
    507 	@CD_UP_ONE@
    508 	cd fpu @COMMAND_SEPARATOR@
    509 	$(MAKE) clean
    510 	@CD_UP_ONE@
    511 	cd doc/docbook @COMMAND_SEPARATOR@
    512 	$(MAKE) clean
    513 	@CD_UP_TWO@
    514 	cd host/linux/pcidev @COMMAND_SEPARATOR@
    515 	$(MAKE) clean
    516 	@CD_UP_THREE@
    517 
    518 dist-clean: local-dist-clean
    519 	cd iodev @COMMAND_SEPARATOR@
    520 	$(MAKE) dist-clean
    521 	@CD_UP_ONE@
    522 	cd bx_debug @COMMAND_SEPARATOR@
    523 	$(MAKE) dist-clean
    524 	@CD_UP_ONE@
    525 	cd bios @COMMAND_SEPARATOR@
    526 	$(MAKE) dist-clean
    527 	@CD_UP_ONE@
    528 	cd cpu @COMMAND_SEPARATOR@
    529 	$(MAKE) dist-clean
    530 	@CD_UP_ONE@
    531 	cd memory @COMMAND_SEPARATOR@
    532 	$(MAKE) dist-clean
    533 	@CD_UP_ONE@
    534 	cd gui @COMMAND_SEPARATOR@
    535 	$(MAKE) dist-clean
    536 	@CD_UP_ONE@
    537 	cd disasm @COMMAND_SEPARATOR@
    538 	$(MAKE) dist-clean
    539 	@CD_UP_ONE@
    540 	cd @INSTRUMENT_DIR@ @COMMAND_SEPARATOR@
    541 	$(MAKE) dist-clean
    542 	@CD_UP_TWO@
    543 	cd misc @COMMAND_SEPARATOR@
    544 	$(MAKE) dist-clean
    545 	@CD_UP_ONE@
    546 	cd fpu @COMMAND_SEPARATOR@
    547 	$(MAKE) dist-clean
    548 	@CD_UP_ONE@
    549 	cd doc/docbook @COMMAND_SEPARATOR@
    550 	$(MAKE) dist-clean
    551 	@CD_UP_TWO@
    552 	cd host/linux/pcidev @COMMAND_SEPARATOR@
    553 	$(MAKE) dist-clean
    554 	@CD_UP_THREE@
    555 	@RMCOMMAND@ Makefile
    556 
    557 ###########################################
    558 # Build app on MacOS X
    559 ###########################################
    560 MACOSX_STUFF=build/macosx
    561 MACOSX_STUFF_SRCDIR=$(srcdir)/$(MACOSX_STUFF)
    562 APP=bochs.app
    563 APP_PLATFORM=MacOS
    564 SCRIPT_EXEC=bochs.scpt
    565 SCRIPT_DATA=$(MACOSX_STUFF_SRCDIR)/script.data
    566 SCRIPT_R=$(MACOSX_STUFF_SRCDIR)/script.r
    567 SCRIPT_APPLESCRIPT=$(MACOSX_STUFF_SRCDIR)/bochs.applescript
    568 SCRIPT_COMPILED_RSRC=$(MACOSX_STUFF)/script_compiled.rsrc
    569 REZ=/Developer/Tools/Rez
    570 CPMAC=/Developer/Tools/CpMac
    571 RINCLUDES=/System/Library/Frameworks/Carbon.framework/Libraries/RIncludes
    572 REZ_ARGS=-append -i $RINCLUDES -d SystemSevenOrLater=1 -useDF
    573 STANDALONE_LIBDIR=`pwd`/$(APP)/Contents/$(APP_PLATFORM)/lib
    574 OSACOMPILE=/usr/bin/osacompile
    575 SETFILE=/Developer/Tools/Setfile
    576 
    577 # On a MacOS X machine, you run rez, osacompile, and setfile to
    578 # produce the script executable, which has both a data fork and a
    579 # resource fork.  Ideally, we would just recompile the whole
    580 # executable at build time, but unfortunately this cannot be done on
    581 # the SF compile farm through an ssh connection because osacompile
    582 # needs to be run locally for some reason.  Solution: If the script
    583 # sources are changed, rebuild the executable on a MacOSX machine,
    584 # split it into its data and resource forks and check them into CVS
    585 # as separate files.  Then at release time, all that's left to do is
    586 # put the data and resource forks back together to make a working script.
    587 # (This can be done through ssh.)
    588 #
    589 # Sources:
    590 # 1. script.r: resources for the script
    591 # 2. script.data: binary data for the script
    592 # 3. bochs.applescript: the source of the script
    593 #
    594 # NOTE: All of this will fail if you aren't building on an HFS+
    595 # filesystem!  On the SF compile farm building in your user directory
    596 # will fail, while doing the build in /tmp will work ok.
    597 
    598 # check if this filesystem supports resource forks at all
    599 test_hfsplus:
    600 	$(RM) -rf test_hfsplus
    601 	echo data > test_hfsplus
    602 	# if you get "Not a directory", then this filesystem doesn't support resources
    603 	echo resource > test_hfsplus/rsrc
    604 	# test succeeded
    605 	$(RM) -rf test_hfsplus
    606 
    607 # Step 1 (must be done locally on MacOSX, only when sources change)
    608 # Compile and pull out just the resource fork.  The resource fork is
    609 # checked into CVS as script_compiled.rsrc.  Note that we don't need
    610 # to check in the data fork of tmpscript because it is identical to the
    611 # script.data input file.
    612 $(SCRIPT_COMPILED_RSRC): $(SCRIPT_R) $(SCRIPT_APPLESCRIPT)
    613 	$(RM) -f tmpscript
    614 	$(CP) -f $(SCRIPT_DATA) tmpscript
    615 	$(REZ) -append $(SCRIPT_R) -o tmpscript
    616 	$(OSACOMPILE) -o tmpscript $(SCRIPT_APPLESCRIPT)
    617 	$(CP) tmpscript/rsrc $(SCRIPT_COMPILED_RSRC)
    618 	$(RM) -f tmpscript
    619 
    620 # Step 2 (can be done locally or remotely on MacOSX)
    621 # Combine the data fork and resource fork, and set attributes.
    622 $(SCRIPT_EXEC): $(SCRIPT_DATA) $(SCRIPT_COMPILED_RSRC)
    623 	rm -f $(SCRIPT_EXEC)
    624 	$(CP) $(SCRIPT_DATA) $(SCRIPT_EXEC)
    625 	if test ! -f $(SCRIPT_COMPILED_RSRC); then $(CP) $(srcdir)/$(SCRIPT_COMPILED_RSRC) $(SCRIPT_COMPILED_RSRC); fi
    626 	$(CP) $(SCRIPT_COMPILED_RSRC) $(SCRIPT_EXEC)/rsrc
    627 	$(SETFILE) -t "APPL" -c "aplt" $(SCRIPT_EXEC)
    628 
    629 $(APP)/.build: bochs test_hfsplus $(SCRIPT_EXEC)
    630 	rm -f $(APP)/.build
    631 	$(MKDIR) -p $(APP)
    632 	$(MKDIR) -p $(APP)/Contents
    633 	$(CP) -f $(MACOSX_STUFF)/Info.plist $(APP)/Contents
    634 	$(CP) -f $(MACOSX_STUFF_SRCDIR)/pbdevelopment.plist $(APP)/Contents
    635 	echo -n "APPL????"  > $(APP)/Contents/PkgInfo
    636 	$(MKDIR) -p $(APP)/Contents/$(APP_PLATFORM)
    637 	$(CP) bochs $(APP)/Contents/$(APP_PLATFORM)
    638 	$(MKDIR) -p $(APP)/Contents/Resources
    639 	$(REZ) $(REZ_ARGS) $(MACOSX_STUFF_SRCDIR)/bochs.r -o $(APP)/Contents/Resources/bochs.rsrc
    640 	$(CP) -f $(MACOSX_STUFF_SRCDIR)/bochs-icn.icns $(APP)/Contents/Resources
    641 	ls -ld $(APP) $(SCRIPT_EXEC) $(SCRIPT_EXEC)/rsrc
    642 	touch $(APP)/.build
    643 
    644 $(APP)/.build_plugins: $(APP)/.build bochs_plugins
    645 	rm -f $(APP)/.build_plugins
    646 	$(MKDIR) -p $(STANDALONE_LIBDIR);
    647 	list=`cd gui && echo *.la`; for i in $$list; do $(LIBTOOL) cp gui/$$i $(STANDALONE_LIBDIR); done;
    648 	list=`cd iodev && echo *.la`; for i in $$list; do $(LIBTOOL) cp iodev/$$i $(STANDALONE_LIBDIR); done;
    649 	$(LIBTOOL) --finish $(STANDALONE_LIBDIR);
    650 	touch $(APP)/.build_plugins
    651 
    652 install_macosx: all download_dlx install_man @INSTALL_DOCBOOK_VAR@
    653 	-mkdir -p $(DESTDIR)$(prefix)
    654 	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
    655 	$(CPMAC) $(srcdir)/.bochsrc $(DESTDIR)$(sharedir)/bochsrc-sample.txt
    656 	-mkdir $(DESTDIR)$(sharedir)/keymaps
    657 	$(CPMAC) $(srcdir)/gui/keymaps/*.map $(DESTDIR)$(sharedir)/keymaps
    658 	cat $(DLXLINUX_TAR) | (cd $(DESTDIR)$(sharedir) && tar xzvf -)
    659 	dlxrc=$(DESTDIR)$(sharedir)/dlxlinux/bochsrc.txt; mv "$$dlxrc" "$$dlxrc.orig" && sed < "$$dlxrc.orig" 's/\/usr\/local\/bochs\/latest/../' > "$$dlxrc" && rm -f "$$dlxrc.orig"
    660 	mv $(srcdir)/README $(srcdir)/README.orig
    661 	cat $(srcdir)/build/macosx/README.macosx-binary $(srcdir)/README.orig > $(DESTDIR)$(sharedir)/README
    662 	rm -f $(DESTDIR)$(sharedir)/README.orig
    663 	$(CPMAC) $(SCRIPT_EXEC) $(DESTDIR)$(sharedir)/dlxlinux
    664 #	for i in $(TEXT_FILE_LIST); do mv $(srcdir)/$$i $(DESTDIR)$(sharedir)/$$i.txt; done
    665 
    666 ###########################################
    667 # BeOS make target.
    668 # Build the binary normally, then copy the resource attributes.
    669 ###########################################
    670 .bochs_beos_target: bochs@EXE@
    671 	unzip $(srcdir)/build/beos/resource.zip
    672 	copyattr -t ICON BeBochs.rsrc bochs
    673 	copyattr -t MICN BeBochs.rsrc bochs
    674 
    675 ###########################################
    676 # dependencies generated by
    677 #  gcc -MM -I. -Iinstrument/stubs *.cc | sed -e 's/\.cc/.@CPP_SUFFIX@/g' -e 's,cpu/,cpu/,g'
    678 ###########################################
    679 config.o: config.@CPP_SUFFIX@ bochs.h config.h osdep.h bx_debug/debug.h config.h \
    680   osdep.h bxversion.h gui/siminterface.h memory/memory.h pc_system.h \
    681   plugin.h extplugin.h ltdl.h gui/gui.h gui/textconfig.h gui/keymap.h \
    682   instrument/stubs/instrument.h iodev/iodev.h bochs.h iodev/vga.h \
    683   iodev/svga_cirrus.h iodev/ioapic.h cpu/apic.h iodev/keyboard.h
    684 crc.o: crc.@CPP_SUFFIX@ config.h
    685 gdbstub.o: gdbstub.@CPP_SUFFIX@ bochs.h config.h osdep.h bx_debug/debug.h config.h \
    686   osdep.h bxversion.h gui/siminterface.h memory/memory.h pc_system.h \
    687   plugin.h extplugin.h ltdl.h gui/gui.h gui/textconfig.h gui/keymap.h \
    688   instrument/stubs/instrument.h cpu/cpu.h disasm/disasm.h cpu/crregs.h \
    689   cpu/descriptor.h cpu/instr.h cpu/lazy_flags.h cpu/icache.h cpu/apic.h \
    690   cpu/i387.h fpu/softfloat.h fpu/tag_w.h fpu/status_w.h fpu/control_w.h \
    691   cpu/xmm.h cpu/stack.h iodev/iodev.h bochs.h iodev/vga.h \
    692   iodev/svga_cirrus.h iodev/ioapic.h cpu/apic.h iodev/keyboard.h
    693 load32bitOShack.o: load32bitOShack.@CPP_SUFFIX@ bochs.h config.h osdep.h \
    694   bx_debug/debug.h config.h osdep.h bxversion.h gui/siminterface.h \
    695   memory/memory.h pc_system.h plugin.h extplugin.h ltdl.h gui/gui.h \
    696   gui/textconfig.h gui/keymap.h instrument/stubs/instrument.h cpu/cpu.h \
    697   disasm/disasm.h cpu/crregs.h cpu/descriptor.h cpu/instr.h \
    698   cpu/lazy_flags.h cpu/icache.h cpu/apic.h cpu/i387.h fpu/softfloat.h \
    699   fpu/tag_w.h fpu/status_w.h fpu/control_w.h cpu/xmm.h iodev/iodev.h \
    700   bochs.h iodev/vga.h iodev/svga_cirrus.h iodev/ioapic.h cpu/apic.h \
    701   iodev/keyboard.h
    702 logio.o: logio.@CPP_SUFFIX@ bochs.h config.h osdep.h bx_debug/debug.h config.h \
    703   osdep.h bxversion.h gui/siminterface.h memory/memory.h pc_system.h \
    704   plugin.h extplugin.h ltdl.h gui/gui.h gui/textconfig.h gui/keymap.h \
    705   instrument/stubs/instrument.h cpu/cpu.h disasm/disasm.h cpu/crregs.h \
    706   cpu/descriptor.h cpu/instr.h cpu/lazy_flags.h cpu/icache.h cpu/apic.h \
    707   cpu/i387.h fpu/softfloat.h fpu/tag_w.h fpu/status_w.h fpu/control_w.h \
    708   cpu/xmm.h iodev/iodev.h bochs.h iodev/vga.h iodev/svga_cirrus.h \
    709   iodev/ioapic.h cpu/apic.h iodev/keyboard.h
    710 main.o: main.@CPP_SUFFIX@ bochs.h config.h osdep.h bx_debug/debug.h config.h \
    711   osdep.h bxversion.h gui/siminterface.h memory/memory.h pc_system.h \
    712   plugin.h extplugin.h ltdl.h gui/gui.h gui/textconfig.h gui/keymap.h \
    713   instrument/stubs/instrument.h cpu/cpu.h disasm/disasm.h cpu/crregs.h \
    714   cpu/descriptor.h cpu/instr.h cpu/lazy_flags.h cpu/icache.h cpu/apic.h \
    715   cpu/i387.h fpu/softfloat.h fpu/tag_w.h fpu/status_w.h fpu/control_w.h \
    716   cpu/xmm.h iodev/iodev.h bochs.h iodev/vga.h iodev/svga_cirrus.h \
    717   iodev/ioapic.h cpu/apic.h iodev/keyboard.h
    718 osdep.o: osdep.@CPP_SUFFIX@ bochs.h config.h osdep.h bx_debug/debug.h config.h \
    719   osdep.h bxversion.h gui/siminterface.h memory/memory.h pc_system.h \
    720   plugin.h extplugin.h ltdl.h gui/gui.h gui/textconfig.h gui/keymap.h \
    721   instrument/stubs/instrument.h
    722 pc_system.o: pc_system.@CPP_SUFFIX@ bochs.h config.h osdep.h bx_debug/debug.h \
    723   config.h osdep.h bxversion.h gui/siminterface.h memory/memory.h \
    724   pc_system.h plugin.h extplugin.h ltdl.h gui/gui.h gui/textconfig.h \
    725   gui/keymap.h instrument/stubs/instrument.h cpu/cpu.h disasm/disasm.h \
    726   cpu/crregs.h cpu/descriptor.h cpu/instr.h cpu/lazy_flags.h cpu/icache.h \
    727   cpu/apic.h cpu/i387.h fpu/softfloat.h fpu/tag_w.h fpu/status_w.h \
    728   fpu/control_w.h cpu/xmm.h iodev/iodev.h bochs.h iodev/vga.h \
    729   iodev/svga_cirrus.h iodev/ioapic.h cpu/apic.h iodev/keyboard.h
    730 plex86-interface.o: plex86-interface.@CPP_SUFFIX@ bochs.h config.h osdep.h \
    731   bx_debug/debug.h config.h osdep.h bxversion.h gui/siminterface.h \
    732   memory/memory.h pc_system.h plugin.h extplugin.h ltdl.h gui/gui.h \
    733   gui/textconfig.h gui/keymap.h instrument/stubs/instrument.h \
    734   plex86-interface.h plex86/plex86.h plex86/descriptor.h
    735 plugin.o: plugin.@CPP_SUFFIX@ bochs.h config.h osdep.h bx_debug/debug.h config.h \
    736   osdep.h bxversion.h gui/siminterface.h memory/memory.h pc_system.h \
    737   plugin.h extplugin.h ltdl.h gui/gui.h gui/textconfig.h gui/keymap.h \
    738   instrument/stubs/instrument.h iodev/iodev.h bochs.h iodev/vga.h \
    739   iodev/svga_cirrus.h iodev/ioapic.h cpu/apic.h iodev/keyboard.h
    740