Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide
translations



Rockbox mail archive

Subject: As Promised, win32 xcompile patch

As Promised, win32 xcompile patch

From: Bill Napier <napier_at_pobox.com>
Date: 02 Jul 2002 12:04:03 -0400

Basically, I started with the X11 sim makefile and changed it to call
the mingw32 toolchain. There were a couple of other changes that had
to be made in it as well (had to add the resource compling stuff that
the X11 didn't need). I also had to modify some source, but whenever
I did that I tried to #ifdef stuff to not mess with other builds too
much.

So basically, I'm compiling the simulators for win32 on my Linux box
with the gnu (MINGW32) toolchain.

Things that suck: I think there are now at least 3 different ways of
building the win32 simulator. From what I've seen, all of them
incompatiable with the rest. :) There has to be some way of getting
them all to play nicely with each other. By far the simplest method
is to name each of the makefiles "makefile-mingw32" and
"makefile-msvc", etc. and you symlink in the right makefile for your
toolchain. It would be better to just have a single makefile, but I
don't know how to accomplish all that.

Bill
napier_at_pobox.com

----- Begin uisimulator/win32/Makefile ------
############################################################################
# __________ __ ___.
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
# \/ \/ \/ \/ \/
# $Id: Makefile,v 1.45 2002/06/27 00:25:19 zagor Exp $
#
# Copyright (C) 2002 by Daniel Stenberg <daniel_at_haxx.se>
#
# All files in this archive are subject to the GNU General Public License.
# See the file COPYING in the source tree root for full license agreement.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
############################################################################

APPDIR = ../../apps
RECDIR = $(APPDIR)/recorder

PREVAPPDIR= ..
FIRMWAREDIR = ../../firmware
DRIVERS = $(FIRMWAREDIR)/drivers
COMMON = $(FIRMWAREDIR)/common
LIBMADDIR = $(PREVAPPDIR)/common/libmad

CC = i586-mingw32msvc-gcc
WINDRES = i586-mingw32msvc-windres
RM = rm -f
DEBUG = -g

# where to put all output files
OBJDIR = .

TARGET = $(OBJDIR)/rockboxui

#DISPLAY = -DHAVE_LCD_CHARCELLS
DISPLAY = -DHAVE_LCD_BITMAP

#KEYPAD = -DHAVE_PLAYER_KEYPAD
KEYPAD = -DHAVE_RECORDER_KEYPAD

DEFINES = -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR \
$(KEYPAD) $(DISPLAY)

LDFLAGS = -lgdi32 -luser32

# Use this for simulator-only files
INCLUDES = -I. -I$(DRIVERS) -I$(COMMON) -I$(FIRMWAREDIR) -I$(APPDIR) -I$(RECDIR)

# The true Rockbox Applications should use this include path:
APPINCLUDES = -I$(FIRMWAREDIR)/include $(INCLUDES)

UNAME := $(shell uname)
ifeq ($(UNAME),Linux)
# INCLUDES += -I/usr/X11R6/include
# LIBDIRS = -L/usr/X11R6/lib
# DEFINES += -DLINUX
#MPEG_PLAY = 1
else
  DEFINES += -DBIG_ENDIAN
  LIBDIRS =
endif

ifdef MPEG_PLAY
  INCLUDES += -I$(PREVAPPDIR)/common
endif

CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) -W -Wall

APPCFLAGS = $(DEBUG) $(DEFINES) $(APPINCLUDES) -W -Wall

FIRMSRCS = chartables.c lcd.c sprintf.c id3.c backlight.c

APPS = main.c tree.c menu.c credits.c main_menu.c\
        playlist.c showtext.c wps.c settings.c

MENUS = games_menu.c screensavers_menu.c settings_menu.c sound_menu.c

ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP)
   APPS += tetris.c sokoban.c bounce.c boxes.c icons.c bmp.c
endif

SRCS = button.c dir-win32.c lcd-win32.c panic-win32.c thread-win32.c \
        debug-win32.c kernel.c mpeg.c string-win32.c uisw32.c \
        $(APPS) $(MENUS) $(FIRMSRCS) strtok.c

ifdef MPEG_PLAY
  SRCS += mpegplay.c oss_sound.c bit.c decoder.c fixed.c frame.c huffman.c layer12.c layer3.c stream.c synth.c timer.c version.c
  DEFINES += -DMPEG_PLAY -DFPM_DEFAULT -DHAVE_CONFIG_H
  INCLUDES += -I$(LIBMADDIR)
endif

OBJS := $(SRCS:%.c=$(OBJDIR)/%.o)

all: $(OBJDIR)/uisw32.exe

$(OBJDIR)/uisw32.exe: $(OBJS) $(OBJDIR)/uisw32-res.o
        $(CC) $(OBJS) $(OBJDIR)/uisw32-res.o -o $(OBJDIR)/uisw32.exe $(LDFLAGS)

$(OBJDIR)/uisw32-res.o: uisw32.rc
        $(WINDRES) -i $< -o $_at_

clean:
        $(RM) $(OBJS) *~ core $(TARGET) $(CLIENTS)
        $(RM) -r $(DEPS)

distclean: clean
        $(RM) config.cache

ifdef MPEG_PLAY
$(OBJDIR)/bit.o: $(LIBMADDIR)/bit.c
        $(CC) $(CFLAGS) -c $< -o $_at_

$(OBJDIR)/decoder.o: $(LIBMADDIR)/decoder.c
        $(CC) $(CFLAGS) -c $< -o $_at_

$(OBJDIR)/fixed.o: $(LIBMADDIR)/fixed.c
        $(CC) $(CFLAGS) -c $< -o $_at_

$(OBJDIR)/frame.o: $(LIBMADDIR)/frame.c
        $(CC) $(CFLAGS) -c $< -o $_at_

$(OBJDIR)/huffman.o: $(LIBMADDIR)/huffman.c
        $(CC) $(CFLAGS) -c $< -o $_at_

$(OBJDIR)/layer12.o: $(LIBMADDIR)/layer12.c
        $(CC) $(CFLAGS) -c $< -o $_at_

$(OBJDIR)/layer3.o: $(LIBMADDIR)/layer3.c
        $(CC) $(CFLAGS) -c $< -o $_at_

$(OBJDIR)/stream.o: $(LIBMADDIR)/stream.c
        $(CC) $(CFLAGS) -c $< -o $_at_

$(OBJDIR)/synth.o: $(LIBMADDIR)/synth.c
        $(CC) $(CFLAGS) -c $< -o $_at_

$(OBJDIR)/timer.o: $(LIBMADDIR)/timer.c
        $(CC) $(CFLAGS) -c $< -o $_at_

$(OBJDIR)/version.o: $(LIBMADDIR)/version.c
        $(CC) $(CFLAGS) -c $< -o $_at_

$(OBJDIR)/mpegplay.o: $(PREVAPPDIR)/common/mpegplay.c
        $(CC) $(CFLAGS) -c $< -o $_at_

endif

$(OBJDIR)/credits.o: $(APPDIR)/credits.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_

$(OBJDIR)/menu.o: $(APPDIR)/menu.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_

$(OBJDIR)/main_menu.o: $(APPDIR)/main_menu.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_

$(OBJDIR)/sound_menu.o: $(APPDIR)/sound_menu.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_

$(OBJDIR)/games_menu.o: $(APPDIR)/games_menu.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_

$(OBJDIR)/screensavers_menu.o: $(APPDIR)/screensavers_menu.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_

$(OBJDIR)/settings_menu.o: $(APPDIR)/settings_menu.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_

$(OBJDIR)/icons.o: $(RECDIR)/icons.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_

$(OBJDIR)/tetris.o: $(RECDIR)/tetris.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_

$(OBJDIR)/sokoban.o: $(RECDIR)/sokoban.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_

$(OBJDIR)/bounce.o: $(RECDIR)/bounce.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_

$(OBJDIR)/boxes.o: $(RECDIR)/boxes.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_

$(OBJDIR)/main.o: $(APPDIR)/main.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_

$(OBJDIR)/wps.o: $(APPDIR)/wps.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_

$(OBJDIR)/bmp.o: $(RECDIR)/bmp.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_

$(OBJDIR)/tree.o: $(APPDIR)/tree.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_

$(OBJDIR)/playlist.o: $(APPDIR)/playlist.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_

$(OBJDIR)/showtext.o: $(APPDIR)/showtext.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_

$(OBJDIR)/lcd.o: $(DRIVERS)/lcd.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_

$(OBJDIR)/chartables.o: $(FIRMWAREDIR)/chartables.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_

$(OBJDIR)/settings.o: $(APPDIR)/settings.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_

$(OBJDIR)/id3.o: $(FIRMWAREDIR)/id3.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_

$(OBJDIR)/debug.o: $(FIRMWAREDIR)/debug.c
        $(CC) $(CFLAGS) -c $< -o $_at_

$(OBJDIR)/sprintf.o: $(COMMON)/sprintf.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_

$(OBJDIR)/strtok.o: $(COMMON)/strtok.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_

$(OBJDIR)/backlight.o: $(FIRMWAREDIR)/backlight.c
        $(CC) $(APPCFLAGS) -c $< -o $_at_


# these ones are simulator-specific

$(OBJDIR)/%.o: %.c
        $(CC) $(CFLAGS) -c $< -o $_at_

$(TARGET): $(OBJS)
        $(CC) -g -o $(TARGET) $(LIBDIRS) $(LDFLAGS) $(OBJS) $(LIBS)

DEPS:=$(OBJDIR)/.deps

$(DEPS)/%.d: %.c
                _at_$(SHELL) -c 'if [ ! -d $(DEPS) ]; then \
                        echo Creating the dependency directory: $(DEPS); \
                        mkdir -p $(DEPS); fi'
                _at_echo "Updating Dependencies for $<"
                _at_$(SHELL) -ec '$(CC) -MM $(CFLAGS) $< \
        |sed '\''s|\($*\)\.o[ :]*|$(OBJDIR)/\1.o $(<:%.c=%.d) : |g'\'' > $_at_; \
        [ -s $_at_ ] || rm -f $_at_'

-include $(SRCS:%.c=$(DEPS)/%.d)

----- End uisimulator/win32/Makefile ------

? uisimulator/win32/Makefile
? uisimulator/win32/makefile-msvc
Index: firmware/common/dir.h
===================================================================
RCS file: /cvsroot/rockbox/firmware/common/dir.h,v
retrieving revision 1.13
diff -d -u -r1.13 dir.h
--- firmware/common/dir.h 12 Jun 2002 15:41:45 -0000 1.13
+++ firmware/common/dir.h 2 Jul 2002 14:41:07 -0000
_at__at_ -53,13 +53,15 _at__at_
 #else // SIMULATOR
 
 #ifdef WIN32
+#ifndef __MINGW32__
 #include <io.h>
+#endif // __MINGW32__
 typedef struct DIRtag
 {
     struct dirent fd;
     int handle;
 } DIR;
 #endif // WIN32
 #endif // SIMULATOR
 
 #ifndef DIRFUNCTIONS_DEFINED
Index: firmware/common/file.h
===================================================================
RCS file: /cvsroot/rockbox/firmware/common/file.h,v
retrieving revision 1.7
diff -d -u -r1.7 file.h
--- firmware/common/file.h 7 May 2002 16:01:52 -0000 1.7
+++ firmware/common/file.h 2 Jul 2002 14:41:07 -0000
_at__at_ -44,8 +44,10 _at__at_
 
 #else
 #ifdef WIN32
+#ifndef __MINGW32__
 #include <io.h>
 #include <stdio.h>
+#endif // __MINGW32__
 #endif // WIN32
 #endif // SIMULATOR
 
Index: uisimulator/win32/stdbool.h
===================================================================
RCS file: /cvsroot/rockbox/uisimulator/win32/stdbool.h,v
retrieving revision 1.2
diff -d -u -r1.2 stdbool.h
--- uisimulator/win32/stdbool.h 19 Jun 2002 20:10:52 -0000 1.2
+++ uisimulator/win32/stdbool.h 2 Jul 2002 14:41:07 -0000
_at__at_ -17,6 +17,11 _at__at_
  *
  ****************************************************************************/
 
+#ifndef __STDBOOL_H__
+#define __STDBOOL_H__ 1
+
 typedef unsigned int bool;
 #define true 1
-#define false 0
\ No newline at end of file
+#define false 0
+
+#endif
Index: uisimulator/win32/uisw32.c
===================================================================
RCS file: /cvsroot/rockbox/uisimulator/win32/uisw32.c,v
retrieving revision 1.6
diff -d -u -r1.6 uisw32.c
--- uisimulator/win32/uisw32.c 15 Jun 2002 10:58:14 -0000 1.6
+++ uisimulator/win32/uisw32.c 2 Jul 2002 14:41:07 -0000
_at__at_ -26,6 +26,10 _at__at_
 #include "thread-win32.h"
 #include "kernel.h"
 
+#ifndef LR_VGACOLOR /* Should be under MINGW32 builds? */
+#define LR_VGACOLOR LR_COLOR
+#endif
+
 // extern functions
 extern void app_main (void *); // mod entry point
 extern void new_key(int key);
_at__at_ -298,4 +302,4 _at__at_
     GUIMessageLoop ();
 
     return GUIDown ();
-}
\ No newline at end of file
+}
Index: uisimulator/win32/uisw32.rc
===================================================================
RCS file: /cvsroot/rockbox/uisimulator/win32/uisw32.rc,v
retrieving revision 1.2
diff -d -u -r1.2 uisw32.rc
--- uisimulator/win32/uisw32.rc 29 May 2002 16:34:39 -0000 1.2
+++ uisimulator/win32/uisw32.rc 2 Jul 2002 14:41:07 -0000
_at__at_ -7,7 +7,9 _at__at_
 //
 // Generated from the TEXTINCLUDE 2 resource.
 //
+#ifndef __MINGW32__
 #include "afxres.h"
+#endif // __MINGW32__
 
 /////////////////////////////////////////////////////////////////////////////
 #undef APSTUDIO_READONLY_SYMBOLS
_at__at_ -17,7 +19,9 _at__at_
 
 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
 #ifdef _WIN32
+#ifndef __MINGW32__
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#endif // __MINGW32__
 #pragma code_page(1252)
 #endif //_WIN32
 
Received on 2002-07-02

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy