2006-02-22 14:24:54 +00:00
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
|
2006-07-27 13:27:31 +00:00
|
|
|
INCLUDES = -I$(APPSDIR) -I.. -I. $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
|
2006-02-22 14:24:54 +00:00
|
|
|
-I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR)
|
2006-10-23 14:09:28 +00:00
|
|
|
CFLAGS = $(INCLUDES) $(GCCOPTS) -O2 $(TARGET) $(EXTRA_DEFINES) \
|
2006-02-22 14:24:54 +00:00
|
|
|
-DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
|
|
|
|
|
|
|
|
ifdef APPEXTRA
|
|
|
|
INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
|
|
|
|
endif
|
|
|
|
|
|
|
|
LINKFILE := $(OBJDIR)/link.lds
|
|
|
|
DEPFILE = $(OBJDIR)/dep-chessbox
|
2007-05-29 16:33:16 +00:00
|
|
|
SRC = chessbox.c gnuchess.c opening.c chessbox_pgn.c
|
2006-02-22 14:24:54 +00:00
|
|
|
|
|
|
|
SOURCES = $(SRC)
|
|
|
|
OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
|
|
|
|
DIRS = .
|
|
|
|
|
2006-02-24 00:51:37 +00:00
|
|
|
ifndef SIMVER
|
|
|
|
ifneq (,$(strip $(foreach tgt,RECORDER ONDIO,$(findstring $(tgt),$(TARGET)))))
|
|
|
|
LDS := archos.lds
|
|
|
|
OUTPUT = $(OUTDIR)/chessbox.ovl
|
|
|
|
else ## iRiver target
|
|
|
|
LDS := ../plugin.lds
|
|
|
|
OUTPUT = $(OUTDIR)/chessbox.rock
|
|
|
|
endif
|
|
|
|
else ## simulators
|
|
|
|
OUTPUT = $(OUTDIR)/chessbox.rock
|
|
|
|
endif
|
2006-02-22 14:24:54 +00:00
|
|
|
|
|
|
|
all: $(OUTPUT)
|
|
|
|
|
|
|
|
ifndef SIMVER
|
2006-02-23 10:02:48 +00:00
|
|
|
$(OBJDIR)/chessbox.elf: $(OBJS) $(LINKFILE) $(BITMAPLIBS)
|
2007-02-15 20:28:08 +00:00
|
|
|
$(call PRINTS,LD $(@F))$(CC) $(CFLAGS) -o $@ $(OBJS) -L$(BUILDDIR) -lplugin -lgcc \
|
2006-02-23 10:02:48 +00:00
|
|
|
$(LINKBITMAPS) -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/chessbox.map
|
2006-02-22 14:24:54 +00:00
|
|
|
|
|
|
|
$(OUTPUT): $(OBJDIR)/chessbox.elf
|
2006-10-27 21:48:06 +00:00
|
|
|
$(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
|
2006-02-22 14:24:54 +00:00
|
|
|
else
|
|
|
|
|
|
|
|
ifeq ($(SIMVER), x11)
|
|
|
|
###################################################
|
|
|
|
# This is the X11 simulator version
|
|
|
|
|
|
|
|
$(OUTPUT): $(OBJS)
|
2006-10-27 21:48:06 +00:00
|
|
|
$(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin $(LINKBITMAPS) -o $@
|
2006-02-22 14:24:54 +00:00
|
|
|
ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
|
|
|
|
# 'x' must be kept or you'll have "Win32 error 5"
|
|
|
|
# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
|
|
|
|
# #define ERROR_ACCESS_DENIED 5L
|
|
|
|
else
|
|
|
|
@chmod -x $@
|
|
|
|
endif
|
|
|
|
|
|
|
|
else # end of x11-simulator
|
|
|
|
ifeq ($(SIMVER), sdl)
|
|
|
|
###################################################
|
|
|
|
# This is the SDL simulator version
|
|
|
|
|
|
|
|
$(OUTPUT): $(OBJS)
|
2006-10-27 21:48:06 +00:00
|
|
|
$(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin $(LINKBITMAPS) -o $@
|
2006-02-22 14:24:54 +00:00
|
|
|
ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
|
|
|
|
# 'x' must be kept or you'll have "Win32 error 5"
|
|
|
|
# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
|
|
|
|
# #define ERROR_ACCESS_DENIED 5L
|
|
|
|
else
|
|
|
|
@chmod -x $@
|
|
|
|
endif
|
|
|
|
|
|
|
|
else # end of sdl-simulator
|
|
|
|
###################################################
|
|
|
|
# This is the win32 simulator version
|
|
|
|
DLLTOOLFLAGS = --export-all
|
|
|
|
DLLWRAPFLAGS = -s --entry _DllMain@12 --target=i386-mingw32 -mno-cygwin
|
|
|
|
|
|
|
|
$(OUTPUT): $(OBJS)
|
2006-10-27 21:48:06 +00:00
|
|
|
$(call PRINTS,DLL $(@F))$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $(OBJS)
|
|
|
|
$(SILENT)$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $(OBJS) \
|
2006-02-23 10:02:48 +00:00
|
|
|
$(BUILDDIR)/libplugin.a $(BITMAPLIBS) -o $@
|
2006-02-22 14:24:54 +00:00
|
|
|
ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
|
|
|
|
# 'x' must be kept or you'll have "Win32 error 5"
|
|
|
|
# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
|
|
|
|
# #define ERROR_ACCESS_DENIED 5L
|
|
|
|
else
|
|
|
|
@chmod -x $@
|
|
|
|
endif
|
|
|
|
endif # end of win32-simulator
|
|
|
|
endif
|
|
|
|
endif # end of simulator section
|
|
|
|
|
|
|
|
|
|
|
|
include $(TOOLSDIR)/make.inc
|
|
|
|
|
|
|
|
# MEMORYSIZE should be passed on to this makefile with the chosen memory size
|
|
|
|
# given in number of MB
|
|
|
|
$(LINKFILE): $(LDS)
|
2006-10-27 21:48:06 +00:00
|
|
|
$(call PRINTS,build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) \
|
2006-02-22 14:24:54 +00:00
|
|
|
$(DEFINES) -E -P - >$@
|
|
|
|
|
|
|
|
clean:
|
2006-10-27 21:48:06 +00:00
|
|
|
$(call PRINTS,cleaning chessbox)rm -rf $(OBJDIR)/chessbox
|
|
|
|
$(SILENT)rm -f $(OBJDIR)/chessbox.* $(DEPFILE)
|
2006-02-22 14:24:54 +00:00
|
|
|
|
|
|
|
-include $(DEPFILE)
|