From db1b3ae0e5dd8825f7b1ea08e6639692afbe358e Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Sat, 9 May 2009 08:46:49 +0000 Subject: [PATCH] Make it possible to build for the host. --- Makefile.host | 97 ++++++++++ src/autoconf.c | 2 +- src/main.c | 2 +- src/sysconfig.h.host | 424 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 523 insertions(+), 2 deletions(-) create mode 100644 Makefile.host create mode 100644 src/sysconfig.h.host diff --git a/Makefile.host b/Makefile.host new file mode 100644 index 0000000..18088d2 --- /dev/null +++ b/Makefile.host @@ -0,0 +1,97 @@ +#--------------------------------------------------------------------------------- +# Clear the implicit built in rules +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- + +# Directories. +OBJ_DIR := obj-host +LIB_DIR := lib +BIN_DIR := . +SRC_DIR := src +INCLUDE_DIR := include + +# Tools. +PIPE_TO_SED := 2>&1 | sed "s/:\([0-9]*\):/\(\1\) :/" + +# Source files. +SRCS := $(wildcard $(SRC_DIR)/*.c $(SRC_DIR)/gfxdep/*.c $(SRC_DIR)/joydep/*.c $(SRC_DIR)/sounddep/*.c \ + $(SRC_DIR)/threaddep/*.c $(SRC_DIR)/guidep/*.c $(SRC_DIR)/caps/*.c $(SRC_DIR)/dms/*.c $(SRC_DIR)/machdep/*.c \ + $(SRC_DIR)/osdep/*.c $(SRC_DIR)/keymap/*.c) + +SRCS := $(filter-out src/compemu_raw_x86.c src/compemu_fpp.c src/compemu_support.c src/svgancui.c src/build68k.c src/catweasel.c \ + src/cdrom.c src/blkdev-libscg.c src/blkdev.c src/blitops.c src/akiko.c src/filesys_bootrom.c \ + src/filesys.c src/fsdb.c src/fsdb_unix.c src/hardfile_unix.c src/genblitter.c src/gencomp.c src/gencpu.c \ + src/hardfile.c src/genlinetoscr.c src/compemu.c src/compstbl.c \ + src/readdisk.c src/gengenblitter.c src/scsiemul.c src/tui.c src/linetoscr.c, $(SRCS)) + +# Library object files. +OBJS := $(subst $(SRC_DIR),$(OBJ_DIR),$(SRCS:.c=.o)) + +# Test source files. +# It can be useful to switch this variable around to select individual tests which are problematic. +TEST_SRCS := $(TEST_SRC_DIR)/showfont.c + +# What's a full build? +all: uae-host.elf + +# How to delete the intermediate files. +clean: + @echo Cleaning $(OBJ_DIR) + @rm -f $(OBJS) + +$(OBJ_DIR): + install -d $@ + +src/sysconfig.h: src/sysconfig.h.host + cp $< $@ + +src/machdep: + rm -f $@ + cd src && ln -s md-i386-gcc machdep + +%.h: %.h.wii + cp $< $@ + +%.c: %.c.wii + cp $< $@ + +# How to build a library. +$(LIB_DIR)/libSDL_ttf.a: $(OBJS) + @echo Archiving $@ + @-mkdir -p $(dir $@) + @powerpc-gekko-ar crs $@ $(OBJS) + @echo ---- + +# How to build a DOL. +$(BIN_DIR)/%.dol: %.elf + @echo Creating DOL $@ + @-mkdir -p $(dir $@) + #powerpc-gekko-objcopy -O binary $< $@ + elf2dol $< $@ + @echo ---- + +# Compilation flags. +COMMON_FLAGS := -g -O2 -Wall $(MACHDEP) +INCLUDES := -Isrc/md-generic/ -Isrc/include -Isrc -I/usr/include/SDL +DEFINES := -DGEKKO -DFPUEMU -DCPUEMU_0 -DCPUEMU_5 -DCPUEMU_6 -DAGA \ + -DSUPPORT_THREADS -DUSE_SDL -DFDI2RAW -DDEBUGGER -DSAVESTATE \ + -DENFORCER -DACTION_REPLAY +CFLAGS := $(COMMON_FLAGS) $(INCLUDES) $(DEFINES) + +# Test link flags. +LDFLAGS := $(COMMON_FLAGS) -L$(LIB_DIR) -lz -lSDL_ttf -lSDL -lfreetype -lm + +# How to link an ELF. +uae-host.elf: src/machdep src/sysconfig.h $(OBJS) + @echo Linking $@ + @-mkdir -p $(dir $@) + g++ -o $@ $(OBJS) $(LDFLAGS) + #keep elf for debugging + #cp $@ /tmp/elf + +# How to compile C file (SDL library). +$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c + @echo Compiling $< + @-mkdir -p $(dir $@) + gcc $(CFLAGS) -c $< -o $@ $(PIPE_TO_SED) diff --git a/src/autoconf.c b/src/autoconf.c index a537418..54c35a6 100644 --- a/src/autoconf.c +++ b/src/autoconf.c @@ -184,7 +184,7 @@ static uae_u32 REGPARAM2 uae_puts (TrapContext *context) static void rtarea_init_mem (void) { - rtarea = mapped_malloc (0x10000, "rtarea"); + rtarea = mapped_malloc (0x100000, "rtarea"); if (!rtarea) { write_log ("virtual memory exhausted (rtarea)!\n"); abort (); diff --git a/src/main.c b/src/main.c index 50697ac..e499880 100644 --- a/src/main.c +++ b/src/main.c @@ -568,8 +568,8 @@ static int do_preinit_machine (int argc, char **argv) init_shm (); #endif -#ifdef FILESYS rtarea_init (); +#ifdef FILESYS hardfile_install (); #endif diff --git a/src/sysconfig.h.host b/src/sysconfig.h.host new file mode 100644 index 0000000..994200a --- /dev/null +++ b/src/sysconfig.h.host @@ -0,0 +1,424 @@ +/* src/sysconfig.h. Generated from sysconfig.h.in by configure. */ +/* src/sysconfig.h.in. Generated from configure.in by autoheader. */ + +/* Define to 1 if you have the `alarm' function. */ +#define HAVE_ALARM 1 + +/* Define to 1 if you have the 'bswap_16' function. */ +/*#define HAVE_BSWAP_16 1 */ +#undef HAVE_BSWAP_16 + +/* Define to 1 if you have the 'bswap_32' function. */ +/*#define HAVE_BSWAP_32 1*/ +#undef HAVE_BSWAP_32 + +/* Define to 1 if you have the header file. */ +/*#define HAVE_BYTESWAP_H 1*/ +#undef HAVE_BYTESWAP_H + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CAPS_CAPSIMAGE_H */ + +/* Define to 1 if you have the `cfmakeraw' function. */ +#define HAVE_CFMAKERAW 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_CURSES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CYBERGRAPHX_CYBERGRAPHICS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DEVICES_AHI_H */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#define HAVE_DIRENT_H 1 + +/* "Define to 1 if you have 'dlopen' function */ +#define HAVE_DLOPEN 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DUSTAT_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `getcwd' function. */ +#define HAVE_GETCWD 1 + +/* Define to 1 if you have the `getopt' function. */ +#define HAVE_GETOPT 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the `gmtime_r' function. */ +#define HAVE_GMTIME_R 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define if exists, doesn't clash with , and + declares uintmax_t. */ +#define HAVE_INTTYPES_H_WITH_UINTMAX 1 + +/* Define to 1 if you have the `isinf' function. */ +#define HAVE_ISINF 1 + +/* Define to 1 if you have the `isnan' function. */ +#define HAVE_ISNAN 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LIBRARIES_CYBERGRAPHICS_H */ + +/* Define to 1 if you have the `z' library (-lz). */ +#define HAVE_LIBZ 1 + +/* Define to 1 if you have the `localtime_r' function. */ +#define HAVE_LOCALTIME_R 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MACHINE_JOYSTICK_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MACHINE_SOUNDCARD_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mkdir' function. */ +#define HAVE_MKDIR 1 + +/* Define to 1 if you have the `nanosleep' function. */ +#define HAVE_NANOSLEEP 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NCURSES_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +/* #undef HAVE_NDIR_H */ + +/* Define if you have POSIX threads libraries and header files. */ +/* #undef HAVE_PTHREAD */ + +/* Define to 1 if you have the `readdir_r' function. */ +#define HAVE_READDIR_R 1 + +/* Define to 1 if you have the `rmdir' function. */ +#define HAVE_RMDIR 1 + +/* Define to 1 if you have the `select' function. */ +#define HAVE_SELECT 1 + +/* Define to 1 if you have the `setitimer' function. */ +#define HAVE_SETITIMER 1 + +/* Define to 1 if you have the `sigaction' function. */ +#define HAVE_SIGACTION 1 + +/* Define to 1 if you have the `sleep' function. */ +#define HAVE_SLEEP 1 + +/* Define to 1 if stdbool.h conforms to C99. */ +#define HAVE_STDBOOL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define if exists, doesn't clash with , and declares + uintmax_t. */ +#define HAVE_STDINT_H_WITH_UINTMAX 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the `strcmpi' function. */ +/* #undef HAVE_STRCMPI */ + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the `stricmp' function. */ +/* #undef HAVE_STRICMP */ + +/* Define to 1 if you have the header file. */ +/*#define HAVE_STRINGS_H 1*/ +#undef HAVE_STRINGS_H + + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strstr' function. */ +#define HAVE_STRSTR 1 + +/* Define to 1 if `st_blocks' is member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_BLOCKS 1 + +/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use + `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ +#define HAVE_ST_BLOCKS 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SUN_AUDIOIO_H */ + +/* Define to 1 if you have the `sync' function. */ +/*#define HAVE_SYNC 1*/ +#undef HAVE_SYNC + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_AUDIOIO_H */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_FILIO_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_FILSYS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_FS_S5PARAM_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_FS_TYPES_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IPC_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_MMAN_H 1 + +/* Define to 1 if you have the header file. */ +/*#define HAVE_SYS_MOUNT_H 1 */ +#undef HAVE_SYS_MOUNT_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SHM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOUNDCARD_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STATFS_H 1 + +/* Define to 1 if you have the header file. */ +/*#define HAVE_SYS_STATVFS_H 1*/ +#undef HAVE_SYS_STATVFS_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TERMIOS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #define HAVE_SYS_VFS_H 1 */ +#undef HAVE_SYS_VFS_H + +/* Define to 1 if you have the `tcgetattr' function. */ +#define HAVE_TCGETATTR 1 + +/* Define to 1 if you have the `timegm' function. */ +#define HAVE_TIMEGM 1 + +/* Define if you have the 'uintmax_t' type in or . */ +#define HAVE_UINTMAX_T 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define if you have the 'unsigned long long' type. */ +#define HAVE_UNSIGNED_LONG_LONG 1 + +/* Define to 1 if you have the `usleep' function. */ +#define HAVE_USLEEP 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UTIME_H 1 + +/* Define to 1 if `utime(file, NULL)' sets file's timestamp to the present. */ +#define HAVE_UTIME_NULL 1 + +/* Define to 1 if you have the header file. */ +/*#define HAVE_VALUES_H 1 */ +#undef HAVE_VALUES_H + +/* Define to 1 if you have the `vfprintf' function. */ +#define HAVE_VFPRINTF 1 + +/* Define to 1 if you have the `vprintf' function. */ +#define HAVE_VPRINTF 1 + +/* Define to 1 if you have the `vsprintf' function. */ +#define HAVE_VSPRINTF 1 + +/* Define to 1 if the system has the type `_Bool'. */ +#define HAVE__BOOL 1 + +/* Define to 1 if your CPU profitably supports multiplication. */ +#define MULTIPLICATION_PROFITABLE 1 + +/* Name of package */ +#define PACKAGE "e-uae" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "E-UAE" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "E-UAE 0.8.29-WIP4" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "e-uae" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "0.8.29-WIP4" + +/* Define to the necessary symbol if this constant uses a non-standard name on + your system. */ +/* #undef PTHREAD_CREATE_JOINABLE */ + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE void + +/* The size of `char', as computed by sizeof. */ +#define SIZEOF_CHAR 1 + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 4 + +/* The size of `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `void *', as computed by sizeof. */ +#define SIZEOF_VOID_P 4 + +/* The size of `__int64', as computed by sizeof. */ +#define SIZEOF___INT64 0 + +/* Define if the block counts reported by statfs may be truncated to 2GB and + the correct values may be stored in the f_spare array. (SunOS 4.1.2, 4.1.3, + and 4.1.3_U1 are reported to have this problem. SunOS 4.1.1 seems not to be + affected.) */ +/* #undef STATFS_TRUNCATES_BLOCK_COUNTS */ + +/* Define if there is no specific function for reading filesystems usage + information and you have the header file. (SVR2) */ +/* #undef STAT_READ_FILSYS */ + +/* Define if statfs takes 2 args and struct statfs has a field named f_bsize. + (4.3BSD, SunOS 4, HP-UX, AIX PS/2) */ +#define STAT_STATFS2_BSIZE 1 + +/* Define if statfs takes 2 args and struct statfs has a field named f_fsize. + (4.4BSD, NetBSD) */ +/* #undef STAT_STATFS2_FSIZE */ + +/* Define if statfs takes 2 args and the second argument has type struct + fs_data. (Ultrix) */ +/* #undef STAT_STATFS2_FS_DATA */ + +/* Define if statfs takes 3 args. (DEC Alpha running OSF/1) */ +/* #undef STAT_STATFS3_OSF1 */ + +/* Define if statfs takes 4 args. (SVR3, Dynix, Irix, Dolphin) */ +/* #undef STAT_STATFS4 */ + +/* Define if there is a function named statvfs. (SVR4) */ +/* #undef STAT_STATVFS */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Define to 1 if your declares `struct tm'. */ +/* #undef TM_IN_SYS_TIME */ + +/* Version number of package */ +#define VERSION "0.8.29-WIP4" + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +/*#define WORDS_BIGENDIAN 1*/ +#undef WORDS_BIGENDIAN + +/* Define to 1 if the X Window System is missing or not being used. */ +/* #undef X_DISPLAY_MISSING */ + +/* Define to 1 if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ +#ifndef _ALL_SOURCE +/* # undef _ALL_SOURCE */ +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#define _FILE_OFFSET_BITS 64 + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `int' if does not define. */ +/* #undef mode_t */ + +/* Define to `long int' if does not define. */ +/* #undef off_t */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +/* Substitute for socklen_t */ +/* #undef socklen_t */ + +/* Define to unsigned long or unsigned long long if and + don't define. */ +/* #undef uintmax_t */ + +/* Define to empty if the keyword `volatile' does not work. Warning: valid + code using `volatile' can become incorrect without. Disable with care. */ +/* #undef volatile */