mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
improve linux makefile
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@641 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
0403eead1f
commit
19e1d02745
3 changed files with 57 additions and 34 deletions
|
@ -94,12 +94,15 @@ void text_out16(int x, int y, const char *texto, ...)
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
int maxw = (SCREEN_WIDTH - x) / 8;
|
int maxw = (SCREEN_WIDTH - x) / 8;
|
||||||
|
|
||||||
|
if (maxw < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
va_start(args, texto);
|
va_start(args, texto);
|
||||||
vsnprintf(buffer, sizeof(buffer), texto, args);
|
vsnprintf(buffer, sizeof(buffer), texto, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
if (maxw > 255)
|
if (maxw > sizeof(buffer) - 1)
|
||||||
maxw = 255;
|
maxw = sizeof(buffer) - 1;
|
||||||
buffer[maxw] = 0;
|
buffer[maxw] = 0;
|
||||||
|
|
||||||
text_out16_(x,y,buffer,menu_text_color);
|
text_out16_(x,y,buffer,menu_text_color);
|
||||||
|
@ -141,9 +144,15 @@ static void smalltext_out16_(int x, int y, const char *texto, int color)
|
||||||
void smalltext_out16(int x, int y, const char *texto, int color)
|
void smalltext_out16(int x, int y, const char *texto, int color)
|
||||||
{
|
{
|
||||||
char buffer[SCREEN_WIDTH/6+1];
|
char buffer[SCREEN_WIDTH/6+1];
|
||||||
|
int maxw = (SCREEN_WIDTH - x) / 6;
|
||||||
|
|
||||||
|
if (maxw < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
strncpy(buffer, texto, sizeof(buffer));
|
strncpy(buffer, texto, sizeof(buffer));
|
||||||
buffer[sizeof(buffer) - 1] = 0;
|
if (maxw > sizeof(buffer) - 1)
|
||||||
|
maxw = sizeof(buffer) - 1;
|
||||||
|
buffer[maxw] = 0;
|
||||||
|
|
||||||
smalltext_out16_(x, y, buffer, color);
|
smalltext_out16_(x, y, buffer, color);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,45 +1,41 @@
|
||||||
|
|
||||||
# settings
|
# settings
|
||||||
use_musashi = 1
|
use_musashi = 1
|
||||||
#use_fame = 1
|
#use_fame = 1
|
||||||
#use_mz80 = 1
|
#use_mz80 = 1
|
||||||
#profile = 1
|
#profile = 1
|
||||||
fake_in_gp2x = 1
|
#fake_in_gp2x = 1
|
||||||
|
|
||||||
|
-include Makefile.local
|
||||||
DEFINC = -I../.. -I. -D__GP2X__ -D_UNZIP_SUPPORT -DIO_STATS -DIN_EVDEV # -DBENCHMARK
|
|
||||||
GCC = gcc
|
|
||||||
STRIP = strip
|
|
||||||
AS = gcc
|
|
||||||
|
|
||||||
ifeq "$(profile)" "1"
|
ifeq "$(profile)" "1"
|
||||||
COPT_COMMON = -s -O3 -ftracer -fstrength-reduce -Wall -funroll-loops -fomit-frame-pointer -fstrict-aliasing -ffast-math -fprofile-generate
|
CFLAGS += -O3 -Wall
|
||||||
COPT = $(COPT_COMMON)
|
CFLAGS += -ftracer -fstrength-reduce -funroll-loops -fomit-frame-pointer -fstrict-aliasing -ffast-math
|
||||||
|
CFLAGS += -fprofile-generate
|
||||||
else
|
else
|
||||||
COPT = -ggdb -Wall -fno-strict-aliasing # -pg -O3 -ftracer -fstrength-reduce -funroll-loops -fomit-frame-pointer -ffast-math
|
CFLAGS = -ggdb -Wall
|
||||||
COPT_COMMON = $(COPT)
|
|
||||||
endif
|
endif
|
||||||
|
DEFINES = __GP2X__ _UNZIP_SUPPORT IO_STATS IN_EVDEV
|
||||||
|
CFLAGS += -I../.. -I.
|
||||||
|
|
||||||
# gtk
|
# gtk
|
||||||
COPT += `pkg-config --cflags gtk+-2.0`
|
CFLAGS += `pkg-config --cflags gtk+-2.0`
|
||||||
LDFLAGS += `pkg-config --libs gtk+-2.0`
|
LDFLAGS += `pkg-config --libs gtk+-2.0`
|
||||||
COPT += `pkg-config --cflags gthread-2.0`
|
CFLAGS += `pkg-config --cflags gthread-2.0`
|
||||||
LDFLAGS += `pkg-config --libs gthread-2.0`
|
LDFLAGS += `pkg-config --libs gthread-2.0`
|
||||||
|
|
||||||
# frontend
|
# frontend
|
||||||
OBJS += platform/gp2x/main.o platform/gp2x/emu.o platform/gp2x/plat.o usbjoy.o blit.o \
|
OBJS += platform/gp2x/main.o platform/gp2x/emu.o platform/gp2x/plat.o usbjoy.o blit.o \
|
||||||
in_evdev.o plat.o sndout_oss.o gp2x.o 940ctl_ym2612.o log_io.o
|
in_evdev.o plat.o sndout_oss.o gp2x.o 940ctl_ym2612.o log_io.o
|
||||||
# platform/gp2x/menu.o
|
|
||||||
|
|
||||||
ifeq "$(fake_in_gp2x)" "1"
|
|
||||||
DEFINC += -DIN_GP2X -DFAKE_IN_GP2X
|
|
||||||
OBJS += platform/gp2x/in_gp2x.o
|
|
||||||
endif
|
|
||||||
|
|
||||||
# common
|
# common
|
||||||
OBJS += platform/common/emu.o platform/common/menu.o platform/common/config.o platform/common/fonts.o \
|
OBJS += platform/common/emu.o platform/common/menu.o platform/common/config.o platform/common/fonts.o \
|
||||||
platform/common/readpng.o platform/common/input.o platform/common/mp3_helix.o
|
platform/common/readpng.o platform/common/input.o platform/common/mp3_helix.o
|
||||||
|
|
||||||
|
ifeq "$(fake_in_gp2x)" "1"
|
||||||
|
DEFINES += IN_GP2X FAKE_IN_GP2X
|
||||||
|
OBJS += platform/gp2x/in_gp2x.o
|
||||||
|
endif
|
||||||
|
|
||||||
# Pico
|
# Pico
|
||||||
OBJS += pico/area.o pico/cart.o pico/memory.o pico/misc.o pico/pico.o pico/sek.o \
|
OBJS += pico/area.o pico/cart.o pico/memory.o pico/misc.o pico/pico.o pico/sek.o \
|
||||||
pico/videoport.o pico/draw2.o pico/draw.o pico/patch.o pico/debug.o
|
pico/videoport.o pico/draw2.o pico/draw.o pico/patch.o pico/debug.o
|
||||||
|
@ -61,19 +57,19 @@ OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \
|
||||||
OBJS += unzip/unzip.o unzip/unzip_stream.o
|
OBJS += unzip/unzip.o unzip/unzip_stream.o
|
||||||
# CPU cores
|
# CPU cores
|
||||||
ifeq "$(use_musashi)" "1"
|
ifeq "$(use_musashi)" "1"
|
||||||
DEFINC += -DEMU_M68K
|
DEFINES += EMU_M68K
|
||||||
OBJS += cpu/musashi/m68kops.o cpu/musashi/m68kcpu.o
|
OBJS += cpu/musashi/m68kops.o cpu/musashi/m68kcpu.o
|
||||||
endif
|
endif
|
||||||
ifeq "$(use_fame)" "1"
|
ifeq "$(use_fame)" "1"
|
||||||
DEFINC += -DEMU_F68K
|
DEFINES += EMU_F68K
|
||||||
OBJS += cpu/fame/famec.o
|
OBJS += cpu/fame/famec.o
|
||||||
endif
|
endif
|
||||||
# z80
|
# z80
|
||||||
ifeq "$(use_mz80)" "1"
|
ifeq "$(use_mz80)" "1"
|
||||||
DEFINC += -D_USE_MZ80
|
DEFINES += _USE_MZ80
|
||||||
OBJS += cpu/mz80/mz80.o
|
OBJS += cpu/mz80/mz80.o
|
||||||
else
|
else
|
||||||
DEFINC += -D_USE_CZ80
|
DEFINES += _USE_CZ80
|
||||||
OBJS += cpu/cz80/cz80.o
|
OBJS += cpu/cz80/cz80.o
|
||||||
endif
|
endif
|
||||||
# misc
|
# misc
|
||||||
|
@ -85,7 +81,10 @@ endif
|
||||||
endif
|
endif
|
||||||
OBJS += cpu/musashi/m68kdasm.o
|
OBJS += cpu/musashi/m68kdasm.o
|
||||||
|
|
||||||
|
CFLAGS += $(addprefix -D,$(DEFINES))
|
||||||
|
|
||||||
vpath %.c = ../..
|
vpath %.c = ../..
|
||||||
|
|
||||||
DIRS = platform platform/gp2x platform/common pico pico/cd pico/pico pico/sound pico/carthw/svp \
|
DIRS = platform platform/gp2x platform/common pico pico/cd pico/pico pico/sound pico/carthw/svp \
|
||||||
zlib unzip cpu cpu/musashi cpu/fame cpu/mz80 cpu/cz80
|
zlib unzip cpu cpu/musashi cpu/fame cpu/mz80 cpu/cz80
|
||||||
|
|
||||||
|
@ -100,7 +99,7 @@ tidy:
|
||||||
|
|
||||||
PicoDrive : $(OBJS) ../common/helix/helix_mp3_x86.a
|
PicoDrive : $(OBJS) ../common/helix/helix_mp3_x86.a
|
||||||
@echo ">>>" $@
|
@echo ">>>" $@
|
||||||
$(GCC) $(COPT) $^ $(LDFLAGS) -lm -lpng -Wl,-Map=PicoDrive.map -o $@
|
$(CC) $(CFLAGS) $^ $(LDFLAGS) -lm -lpng -Wl,-Map=PicoDrive.map -o $@
|
||||||
|
|
||||||
mkdirs:
|
mkdirs:
|
||||||
mkdir -p $(DIRS)
|
mkdir -p $(DIRS)
|
||||||
|
@ -124,18 +123,17 @@ cpu/mz80/mz80.o : ../../cpu/mz80/mz80.asm
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
@echo ">>>" $<
|
@echo ">>>" $<
|
||||||
$(GCC) $(COPT) $(DEFINC) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
.s.o:
|
.s.o:
|
||||||
@echo ">>>" $<
|
@echo ">>>" $<
|
||||||
$(GCC) $(COPT) $(DEFINC) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
|
||||||
pico/sound/ym2612.o : ../../pico/sound/ym2612.c
|
#pico/sound/ym2612.o : ../../pico/sound/ym2612.c
|
||||||
@echo ">>>" $@
|
# @echo ">>>" $@
|
||||||
$(GCC) $(COPT_COMMON) $(DEFINC) -c $< -o $@
|
# $(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
cpu/fame/famec.o : ../../cpu/fame/famec.c ../../cpu/fame/famec_opcodes.h
|
cpu/fame/famec.o : ../../cpu/fame/famec.c ../../cpu/fame/famec_opcodes.h
|
||||||
@echo ">>>" $<
|
@echo ">>>" $<
|
||||||
$(GCC) $(COPT) $(DEFINC) -Wno-unused -c $< -o $@
|
$(CC) $(CFLAGS) -Wno-unused -c $< -o $@
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,19 @@ static gint key_release_event (GtkWidget *widget, GdkEventKey *event)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
void gdk_drawable_get_size (GdkDrawable *drawable,
|
||||||
|
gint *width,
|
||||||
|
gint *height);
|
||||||
|
**/
|
||||||
|
|
||||||
|
static void size_allocate_event(GtkWidget *widget, GtkAllocation *allocation, gpointer user_data)
|
||||||
|
{
|
||||||
|
gint w, h;
|
||||||
|
gdk_drawable_get_size(gtk_items.window, &w, &h);
|
||||||
|
printf("%dx%d %dx%d\n", allocation->width, allocation->height, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
static void *gtk_threadf(void *targ)
|
static void *gtk_threadf(void *targ)
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
|
@ -137,6 +150,9 @@ static void *gtk_threadf(void *targ)
|
||||||
g_signal_connect (G_OBJECT (gtk_items.window), "key_release_event",
|
g_signal_connect (G_OBJECT (gtk_items.window), "key_release_event",
|
||||||
G_CALLBACK (key_release_event), NULL);
|
G_CALLBACK (key_release_event), NULL);
|
||||||
|
|
||||||
|
g_signal_connect (G_OBJECT (gtk_items.window), "size_allocate",
|
||||||
|
G_CALLBACK (size_allocate_event), NULL);
|
||||||
|
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (gtk_items.window), 2);
|
gtk_container_set_border_width (GTK_CONTAINER (gtk_items.window), 2);
|
||||||
gtk_window_set_title ((GtkWindow *) gtk_items.window, verstring);
|
gtk_window_set_title ((GtkWindow *) gtk_items.window, verstring);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue