forked from Miroirs/x49gp
refactoring of Makefile + fixes
This commit is contained in:
parent
285051ed86
commit
cb7c9f6e37
3 changed files with 132 additions and 144 deletions
266
Makefile
266
Makefile
|
@ -5,15 +5,44 @@ TARGET = x49gpng
|
||||||
TARGET_ALLCAPS = X49GPNG
|
TARGET_ALLCAPS = X49GPNG
|
||||||
|
|
||||||
VERSION_MAJOR = 1
|
VERSION_MAJOR = 1
|
||||||
VERSION_MINOR = 0
|
VERSION_MINOR = 1
|
||||||
PATCHLEVEL = 0
|
PATCHLEVEL = 0
|
||||||
|
|
||||||
CC = gcc
|
#
|
||||||
LD = $(CC)
|
DEBUG_CFLAGS = -g # -pg
|
||||||
AR = ar
|
OPTIM = 2
|
||||||
RANLIB = ranlib
|
|
||||||
|
|
||||||
CC += $(shell if [ "`uname -m`" = "sparc64" -o "`uname -m`" = "sun4u" ]; then echo "-mcpu=ultrasparc -m32"; fi)
|
# GTK
|
||||||
|
GTK_CFLAGS = $(shell pkg-config --cflags gtk+-2.0)
|
||||||
|
GTK_LDLIBS = $(shell pkg-config --libs gtk+-2.0) -lz -lm
|
||||||
|
|
||||||
|
# Embedded qemu
|
||||||
|
QEMU_DIR = src/qemu-git
|
||||||
|
QEMU_DEFINES = -DTARGET_ARM -DX49GP \
|
||||||
|
-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 \
|
||||||
|
-D_LARGEFILE_SOURCE \
|
||||||
|
-DNEED_CPU_H \
|
||||||
|
-fno-strict-aliasing
|
||||||
|
QEMU_OBJS = $(QEMU_DIR)/arm-softmmu/exec.o \
|
||||||
|
$(QEMU_DIR)/arm-softmmu/translate-all.o \
|
||||||
|
$(QEMU_DIR)/arm-softmmu/cpu-exec.o \
|
||||||
|
$(QEMU_DIR)/arm-softmmu/translate.o \
|
||||||
|
$(QEMU_DIR)/arm-softmmu/fpu/softfloat.o \
|
||||||
|
$(QEMU_DIR)/arm-softmmu/op_helper.o \
|
||||||
|
$(QEMU_DIR)/arm-softmmu/helper.o \
|
||||||
|
$(QEMU_DIR)/arm-softmmu/disas.o \
|
||||||
|
$(QEMU_DIR)/arm-softmmu/i386-dis.o \
|
||||||
|
$(QEMU_DIR)/arm-softmmu/arm-dis.o \
|
||||||
|
$(QEMU_DIR)/arm-softmmu/tcg/tcg.o \
|
||||||
|
$(QEMU_DIR)/arm-softmmu/iwmmxt_helper.o \
|
||||||
|
$(QEMU_DIR)/arm-softmmu/neon_helper.o
|
||||||
|
QEMU_INCLUDES=-I$(QEMU_DIR)/target-arm \
|
||||||
|
-I$(QEMU_DIR) \
|
||||||
|
-I$(QEMU_DIR)/fpu \
|
||||||
|
-I$(QEMU_DIR)/arm-softmmu
|
||||||
|
|
||||||
|
# What if this is MacOSX
|
||||||
|
COCOA_LIBS=$(shell if [ "`uname -s`" = "Darwin" ]; then echo "-F/System/Library/Frameworks -framework Cocoa -framework IOKit"; fi)
|
||||||
|
|
||||||
X49GP_DEBUG = \
|
X49GP_DEBUG = \
|
||||||
-DDEBUG_X49GP_MODULES \
|
-DDEBUG_X49GP_MODULES \
|
||||||
|
@ -47,75 +76,31 @@ X49GP_DEBUG = \
|
||||||
-DDEBUG_X49GP_MAIN \
|
-DDEBUG_X49GP_MAIN \
|
||||||
-DDEBUG_X49GP_UI
|
-DDEBUG_X49GP_UI
|
||||||
|
|
||||||
DEBUG = -g # -pg
|
|
||||||
|
|
||||||
QEMU_DEFINES = -DTARGET_ARM -DX49GP \
|
|
||||||
-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 \
|
|
||||||
-D_LARGEFILE_SOURCE \
|
|
||||||
-fno-strict-aliasing
|
|
||||||
|
|
||||||
# Use this to debug
|
|
||||||
# DEFINES = $(X49GP_DEBUG) $(QEMU_DEFINES)
|
|
||||||
# Use this for speed
|
|
||||||
DEFINES = $(QEMU_DEFINES)
|
|
||||||
|
|
||||||
QEMU=src/qemu-git
|
|
||||||
|
|
||||||
QEMUMAKE = $(shell if [ "`uname -s`" = "Linux" -a "`uname -m`" = "sun4u" ]; then echo "sparc32 $(MAKE)"; else echo "$(MAKE)"; fi)
|
|
||||||
|
|
||||||
QEMU_DIR=$(QEMU)
|
|
||||||
QEMU_DIR_BUILD=$(QEMU_DIR)/arm-softmmu
|
|
||||||
QEMU_DEFINES+=-DNEED_CPU_H
|
|
||||||
QEMU_OBJS = $(QEMU_DIR_BUILD)/exec.o \
|
|
||||||
$(QEMU_DIR_BUILD)/translate-all.o \
|
|
||||||
$(QEMU_DIR_BUILD)/cpu-exec.o \
|
|
||||||
$(QEMU_DIR_BUILD)/translate.o \
|
|
||||||
$(QEMU_DIR_BUILD)/fpu/softfloat.o \
|
|
||||||
$(QEMU_DIR_BUILD)/op_helper.o \
|
|
||||||
$(QEMU_DIR_BUILD)/helper.o \
|
|
||||||
$(QEMU_DIR_BUILD)/disas.o \
|
|
||||||
$(QEMU_DIR_BUILD)/i386-dis.o \
|
|
||||||
$(QEMU_DIR_BUILD)/arm-dis.o \
|
|
||||||
$(QEMU_DIR_BUILD)/tcg/tcg.o \
|
|
||||||
$(QEMU_DIR_BUILD)/iwmmxt_helper.o \
|
|
||||||
$(QEMU_DIR_BUILD)/neon_helper.o
|
|
||||||
X49GP_LDFLAGS =
|
|
||||||
X49GP_LIBS = $(QEMU_OBJS)
|
|
||||||
QEMU_INCDIR=$(QEMU_DIR)
|
|
||||||
QEMU_INC=-I$(QEMU_INCDIR)/target-arm \
|
|
||||||
-I$(QEMU_INCDIR) \
|
|
||||||
-I$(QEMU_INCDIR)/fpu \
|
|
||||||
-I$(QEMU_INCDIR)/arm-softmmu
|
|
||||||
|
|
||||||
X49GP_INCLUDES = -I./src \
|
X49GP_INCLUDES = -I./src \
|
||||||
-I./src/bitmaps $(QEMU_INC)
|
-I./src/bitmaps \
|
||||||
|
$(QEMU_INCLUDES)
|
||||||
|
|
||||||
INCLUDES = $(GDB_INCLUDES) $(X49GP_INCLUDES)
|
X49GP_CFLAGS = $(CFLAGS) \
|
||||||
|
-O$(OPTIM) \
|
||||||
DEFINES += -DX49GP_DATADIR=\"$(INSTALL_DATA_DIR)\"
|
|
||||||
|
|
||||||
COCOA_LIBS=$(shell if [ "`uname -s`" = "Darwin" ]; then echo "-F/System/Library/Frameworks -framework Cocoa -framework IOKit"; fi)
|
|
||||||
|
|
||||||
X49GP_CFLAGS = -O2 \
|
|
||||||
-Wall \
|
-Wall \
|
||||||
-Werror \
|
-Werror \
|
||||||
$(DEBUG) \
|
$(DEBUG_CFLAGS) \
|
||||||
$(INCLUDES) \
|
$(X49GP_INCLUDES) \
|
||||||
$(DEFINES) \
|
$(QEMU_DEFINES) \
|
||||||
|
$(GTK_CFLAGS) \
|
||||||
-D_GNU_SOURCE=1 \
|
-D_GNU_SOURCE=1 \
|
||||||
-DVERSION_MAJOR=$(VERSION_MAJOR) \
|
-DVERSION_MAJOR=$(VERSION_MAJOR) \
|
||||||
-DVERSION_MINOR=$(VERSION_MINOR) \
|
-DVERSION_MINOR=$(VERSION_MINOR) \
|
||||||
-DPATCHLEVEL=$(PATCHLEVEL) \
|
-DPATCHLEVEL=$(PATCHLEVEL) \
|
||||||
|
-DX49GP_DATADIR=\"$(INSTALL_DATA_DIR)\" \
|
||||||
-Wno-error=deprecated-declarations
|
-Wno-error=deprecated-declarations
|
||||||
X49GP_LDFLAGS += $(DEBUG) $(GDB_LDFLAGS)
|
|
||||||
X49GP_LDLIBS = $(X49GP_LIBS) $(GDB_LIBS) $(COCOA_LIBS)
|
|
||||||
|
|
||||||
MAKEDEPEND = $(CC) -MM
|
ifeq ($(DEBUG), yes)
|
||||||
|
X49GP_CFLAGS += $(X49GP_DEBUG)
|
||||||
|
endif
|
||||||
|
|
||||||
X49GP_CFLAGS += $(shell pkg-config --cflags gtk+-2.0)
|
X49GP_LDFLAGS = $(DEBUG_CFLAGS) $(LDFLAGS)
|
||||||
X49GP_LDLIBS += $(shell pkg-config --libs gtk+-2.0) -lz -lm
|
X49GP_LDLIBS = $(QEMU_OBJS) $(GDB_LIBS) $(COCOA_LIBS) $(GTK_LDLIBS)
|
||||||
|
|
||||||
LIBS = $(QEMU)
|
|
||||||
|
|
||||||
SRCS = ./src/main.c \
|
SRCS = ./src/main.c \
|
||||||
./src/module.c \
|
./src/module.c \
|
||||||
|
@ -151,10 +136,86 @@ OBJS = $(SRCS:.c=.o)
|
||||||
# TEMPO hack
|
# TEMPO hack
|
||||||
VVFATOBJS = ./src/block-vvfat.o \
|
VVFATOBJS = ./src/block-vvfat.o \
|
||||||
./src/block-qcow.o \
|
./src/block-qcow.o \
|
||||||
./src/block-raw.o
|
./src/block-raw.o \
|
||||||
|
$(QEMU_DIR)/cutils.o
|
||||||
|
|
||||||
VVFATOBJS += $(QEMU_DIR)/cutils.o
|
all: do-it-all
|
||||||
|
|
||||||
|
ifeq (.depend,$(wildcard .depend))
|
||||||
|
include .depend
|
||||||
|
do-it-all: $(QEMU_DIR) dist/$(TARGET)
|
||||||
|
else
|
||||||
|
do-it-all: depend-and-build
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Compilation
|
||||||
|
dist/$(TARGET): $(OBJS) $(VVFATOBJS) $(QEMU_OBJS)
|
||||||
|
$(CC) $(X49GP_LDFLAGS) -o $@ $(OBJS) $(VVFATOBJS) $(LDLIBS) $(X49GP_LDLIBS)
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
$(CC) $(X49GP_CFLAGS) -o $@ -c $<
|
||||||
|
|
||||||
|
./src/block-vvfat.o: ./src/block-vvfat.c
|
||||||
|
$(CC) $(X49GP_CFLAGS) -fno-aggressive-loop-optimizations -o $@ -c $<
|
||||||
|
|
||||||
|
# Compilation of qemu-git
|
||||||
|
$(QEMU_DIR)/config-host.h:
|
||||||
|
+( cd $(QEMU_DIR); \
|
||||||
|
./configure-small --extra-cflags=-DX49GP; \
|
||||||
|
$(MAKE) -f Makefile-small )
|
||||||
|
|
||||||
|
$(QEMU_OBJS): dummy
|
||||||
|
+$(MAKE) -C $(QEMU_DIR) -f Makefile-small
|
||||||
|
|
||||||
|
# Depend
|
||||||
|
MAKEDEPEND = $(CC) -MM
|
||||||
|
|
||||||
|
depend-libs: $(QEMU_DIR)/config-host.h
|
||||||
|
|
||||||
|
depend-and-build: depend
|
||||||
|
$(MAKE) -C . all
|
||||||
|
|
||||||
|
depend: depend-libs
|
||||||
|
$(MAKEDEPEND) $(X49GP_CFLAGS) $(SRCS) >.depend
|
||||||
|
|
||||||
|
# Cleaning
|
||||||
|
clean-qemu:
|
||||||
|
$(MAKE) -C $(QEMU_DIR) -f Makefile-small clean
|
||||||
|
|
||||||
|
clean: clean-qemu
|
||||||
|
rm -f ./src/*.o core *~ .depend
|
||||||
|
|
||||||
|
distclean: clean
|
||||||
|
$(MAKE) -C $(QEMU_DIR) -f Makefile-small distclean
|
||||||
|
rm -f dist/$(TARGET) dist/$(TARGET).desktop dist/$(TARGET).man
|
||||||
|
|
||||||
|
mrproper: clean-qemu distclean
|
||||||
|
make -C dist/firmware/ mrproper
|
||||||
|
|
||||||
|
# auto-format code
|
||||||
|
pretty-code:
|
||||||
|
clang-format -i ./src/*.c ./src/*.h
|
||||||
|
|
||||||
|
# Populate dist/firmware/ from hpcalc.org
|
||||||
|
pull-firmware:
|
||||||
|
make -C dist/firmware/
|
||||||
|
|
||||||
|
# Create an sdcard file
|
||||||
|
sdcard:
|
||||||
|
ifeq ($(shell uname),Darwin)
|
||||||
|
rm -f sdcard.dmg
|
||||||
|
hdiutil create $@ -megabytes 64 -fs MS-DOS -volname $(TARGET)
|
||||||
|
else
|
||||||
|
/sbin/mkdosfs -v -C -S 512 -f 2 -F 16 -r 512 -R 2 -n "$(TARGET)" $@ 65536
|
||||||
|
endif
|
||||||
|
|
||||||
|
dist/$(TARGET).desktop: dist/$(TARGET).desktop.in
|
||||||
|
perl -p -e "s!TARGET!$(TARGET)!" < dist/$(TARGET).desktop.in >$@
|
||||||
|
|
||||||
|
dist/$(TARGET).man: dist/$(TARGET).man.in
|
||||||
|
perl -p -e "s!TARGET_ALLCAPS!$(TARGET_ALLCAPS)!;" -e "s!TARGET!$(TARGET)!" < dist/$(TARGET).man.in >$@
|
||||||
|
|
||||||
|
# Installation
|
||||||
INSTALL_PREFIX = /usr/local
|
INSTALL_PREFIX = /usr/local
|
||||||
INSTALL_BINARY_DIR = "$(INSTALL_PREFIX)"/bin
|
INSTALL_BINARY_DIR = "$(INSTALL_PREFIX)"/bin
|
||||||
INSTALL_DATA_DIR = "$(INSTALL_PREFIX)"/share/$(TARGET)
|
INSTALL_DATA_DIR = "$(INSTALL_PREFIX)"/share/$(TARGET)
|
||||||
|
@ -162,18 +223,6 @@ INSTALL_DOC_DIR = "$(INSTALL_PREFIX)"/doc/$(TARGET)
|
||||||
INSTALL_MENU_DIR = "$(INSTALL_PREFIX)"/share/applications
|
INSTALL_MENU_DIR = "$(INSTALL_PREFIX)"/share/applications
|
||||||
INSTALL_MAN_DIR = "$(INSTALL_PREFIX)/share/man/man1"
|
INSTALL_MAN_DIR = "$(INSTALL_PREFIX)/share/man/man1"
|
||||||
|
|
||||||
all: do-it-all
|
|
||||||
|
|
||||||
ifeq (.depend,$(wildcard .depend))
|
|
||||||
include .depend
|
|
||||||
do-it-all: $(QEMU) dist/$(TARGET)
|
|
||||||
else
|
|
||||||
do-it-all: depend-and-build
|
|
||||||
endif
|
|
||||||
|
|
||||||
dist/$(TARGET): $(OBJS) $(VVFATOBJS) $(QEMU_OBJS)
|
|
||||||
$(CC) $(LDFLAGS) $(X49GP_LDFLAGS) -o $@ $(OBJS) $(VVFATOBJS) $(LDLIBS) $(X49GP_LDLIBS)
|
|
||||||
|
|
||||||
install: all dist/$(TARGET).desktop dist/$(TARGET).man
|
install: all dist/$(TARGET).desktop dist/$(TARGET).man
|
||||||
install -D -m 755 dist/$(TARGET) "$(DESTDIR)$(INSTALL_BINARY_DIR)/$(TARGET)"
|
install -D -m 755 dist/$(TARGET) "$(DESTDIR)$(INSTALL_BINARY_DIR)/$(TARGET)"
|
||||||
mkdir -p "$(DESTDIR)$(INSTALL_DATA_DIR)/"
|
mkdir -p "$(DESTDIR)$(INSTALL_DATA_DIR)/"
|
||||||
|
@ -182,65 +231,4 @@ install: all dist/$(TARGET).desktop dist/$(TARGET).man
|
||||||
install -D -m 644 dist/$(TARGET).man "$(DESTDIR)$(INSTALL_MAN_DIR)/$(TARGET).1"
|
install -D -m 644 dist/$(TARGET).man "$(DESTDIR)$(INSTALL_MAN_DIR)/$(TARGET).1"
|
||||||
cp -R dist/firmware/ "$(DESTDIR)$(INSTALL_DATA_DIR)/firmware"
|
cp -R dist/firmware/ "$(DESTDIR)$(INSTALL_DATA_DIR)/firmware"
|
||||||
|
|
||||||
dist/$(TARGET).desktop: dist/$(TARGET).desktop.in
|
|
||||||
perl -p -e "s!TARGET!$(TARGET)!" < dist/$(TARGET).desktop.in >$@
|
|
||||||
|
|
||||||
dist/$(TARGET).man: dist/$(TARGET).man.in
|
|
||||||
perl -p -e "s!TARGET_ALLCAPS!$(TARGET_ALLCAPS)!;" -e "s!TARGET!$(TARGET)!" < dist/$(TARGET).man.in >$@
|
|
||||||
|
|
||||||
sdcard:
|
|
||||||
ifeq ($(shell uname),Darwin)
|
|
||||||
rm -f sdcard.dmg
|
|
||||||
hdiutil create $@ -megabytes 64 -fs MS-DOS -volname $(TARGET)
|
|
||||||
else
|
|
||||||
/sbin/mkdosfs -v -C -S 512 -f 2 -F 16 -r 512 -R 2 -n "$(TARGET)" $@ 65536
|
|
||||||
endif
|
|
||||||
|
|
||||||
sim: dummy
|
|
||||||
$(MAKE) -C $@
|
|
||||||
|
|
||||||
$(QEMU)/config-host.h:
|
|
||||||
+( cd $(QEMU); \
|
|
||||||
./configure-small --extra-cflags=-DX49GP; \
|
|
||||||
$(QEMUMAKE) -f Makefile-small )
|
|
||||||
|
|
||||||
$(QEMU_OBJS): _dir_qemu
|
|
||||||
|
|
||||||
_dir_qemu: dummy
|
|
||||||
+$(QEMUMAKE) -C $(QEMU) -f Makefile-small
|
|
||||||
|
|
||||||
%.o: %.c
|
|
||||||
$(CC) $(CFLAGS) $(X49GP_CFLAGS) -o $@ -c $<
|
|
||||||
|
|
||||||
./src/block-vvfat.o: ./src/block-vvfat.c
|
|
||||||
$(CC) $(CFLAGS) $(X49GP_CFLAGS) -fno-aggressive-loop-optimizations -o $@ -c $<
|
|
||||||
|
|
||||||
clean-qemu:
|
|
||||||
$(MAKE) -C $(QEMU) -f Makefile-small clean
|
|
||||||
|
|
||||||
clean: clean-qemu
|
|
||||||
rm -f ./src/*.o core *~ .depend
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
$(MAKE) -C $(QEMU) -f Makefile-small distclean
|
|
||||||
rm -f dist/$(TARGET) dist/$(TARGET).desktop dist/$(TARGET).man
|
|
||||||
|
|
||||||
depend-libs: $(QEMU)/config-host.h
|
|
||||||
|
|
||||||
depend-and-build: depend
|
|
||||||
$(MAKE) -C . all
|
|
||||||
|
|
||||||
depend: depend-libs
|
|
||||||
$(MAKEDEPEND) $(CFLAGS) $(X49GP_CFLAGS) $(SRCS) >.depend
|
|
||||||
|
|
||||||
mrproper: clean-qemu distclean
|
|
||||||
make -C dist/firmware/ mrproper
|
|
||||||
|
|
||||||
|
|
||||||
pretty-code:
|
|
||||||
clang-format -i ./src/*.c ./src/*.h
|
|
||||||
|
|
||||||
pull-firmware:
|
|
||||||
make -C dist/firmware/
|
|
||||||
|
|
||||||
dummy:
|
dummy:
|
||||||
|
|
|
@ -300,7 +300,7 @@ int bdrv_open( BlockDriverState* bs, const char* filename, int flags )
|
||||||
drv = find_protocol( filename );
|
drv = find_protocol( filename );
|
||||||
if ( !drv ) {
|
if ( !drv ) {
|
||||||
#ifdef DEBUG_X49GP_BLOCK
|
#ifdef DEBUG_X49GP_BLOCK
|
||||||
f printf( stderr, "%s:%u: drv: %p\n", __FUNCTION__, __LINE__, drv );
|
fprintf( stderr, "%s:%u: drv: %p\n", __FUNCTION__, __LINE__, drv );
|
||||||
#endif
|
#endif
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
8
src/ui.c
8
src/ui.c
|
@ -2414,10 +2414,10 @@ static void x49gp_release_single_button( x49gp_ui_button_t* button, x49gp_ui_but
|
||||||
const x49gp_ui_key_t* key;
|
const x49gp_ui_key_t* key;
|
||||||
GtkButton* gtkbutton;
|
GtkButton* gtkbutton;
|
||||||
|
|
||||||
#ifdef DEBUG_X49GP_UI
|
/* #ifdef DEBUG_X49GP_UI */
|
||||||
printf( "%s: button %u: col %u, row %u, eint %u\n", __FUNCTION__, event->button, button->key->column, button->key->row,
|
/* printf( "%s: button %u: col %u, row %u, eint %u\n", __FUNCTION__, event->button, button->key->column, button->key->row, */
|
||||||
button->key->eint );
|
/* button->key->eint ); */
|
||||||
#endif
|
/* #endif */
|
||||||
|
|
||||||
button->down = false;
|
button->down = false;
|
||||||
button->hold = false;
|
button->hold = false;
|
||||||
|
|
Loading…
Reference in a new issue