summaryrefslogtreecommitdiff
path: root/apps/plugins/chessbox/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/chessbox/Makefile')
-rw-r--r--apps/plugins/chessbox/Makefile112
1 files changed, 112 insertions, 0 deletions
diff --git a/apps/plugins/chessbox/Makefile b/apps/plugins/chessbox/Makefile
new file mode 100644
index 0000000000..3d9f024ba3
--- /dev/null
+++ b/apps/plugins/chessbox/Makefile
@@ -0,0 +1,112 @@
1# __________ __ ___.
2# Open \______ \ ____ ____ | | _\_ |__ _______ ___
3# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/
7# $Id$
8#
9
10INCLUDES = -I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
11 -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR)
12CFLAGS = $(GCCOPTS) -O3 $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \
13 -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
14
15ifdef APPEXTRA
16 INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
17endif
18
19LINKFILE := $(OBJDIR)/link.lds
20DEPFILE = $(OBJDIR)/dep-chessbox
21SRC = chessbox.c gnuchess.c
22
23SOURCES = $(SRC)
24OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
25DIRS = .
26
27LDS := ../plugin.lds
28OUTPUT = $(OUTDIR)/chessbox.rock
29
30all: $(OUTPUT)
31
32ifndef SIMVER
33$(OBJDIR)/chessbox.elf: $(OBJS) $(LINKFILE)
34 @echo "LD "`basename $@`
35 @$(CC) $(GCCOPTS) -O -nostdlib -o $@ $(OBJS) -L$(BUILDDIR) -lplugin -lgcc \
36 -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/chessbox.map
37
38$(OUTPUT): $(OBJDIR)/chessbox.elf
39 @echo "OBJCOPY "`basename $@`
40 @$(OC) -O binary $< $@
41else
42
43ifeq ($(SIMVER), x11)
44###################################################
45# This is the X11 simulator version
46
47$(OUTPUT): $(OBJS)
48 @echo "LD $<"
49 @$(CC) $(CFLAGS) -shared $(OBJS) -L$(BUILDDIR) -lplugin -o $@
50ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
51# 'x' must be kept or you'll have "Win32 error 5"
52# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
53# #define ERROR_ACCESS_DENIED 5L
54else
55 @chmod -x $@
56endif
57
58else # end of x11-simulator
59ifeq ($(SIMVER), sdl)
60###################################################
61# This is the SDL simulator version
62
63$(OUTPUT): $(OBJS)
64 @echo "LD $<"
65 @$(CC) $(CFLAGS) -shared $(OBJS) -L$(BUILDDIR) -lplugin -o $@
66ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
67# 'x' must be kept or you'll have "Win32 error 5"
68# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
69# #define ERROR_ACCESS_DENIED 5L
70else
71 @chmod -x $@
72endif
73
74else # end of sdl-simulator
75###################################################
76# This is the win32 simulator version
77DLLTOOLFLAGS = --export-all
78DLLWRAPFLAGS = -s --entry _DllMain@12 --target=i386-mingw32 -mno-cygwin
79
80$(OUTPUT): $(OBJS)
81 @echo "DLL "`basename $@`
82 @$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $(OBJS)
83 @$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $(OBJS) \
84 $(BUILDDIR)/libplugin.a -o $@
85ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
86# 'x' must be kept or you'll have "Win32 error 5"
87# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
88# #define ERROR_ACCESS_DENIED 5L
89else
90 @chmod -x $@
91endif
92endif # end of win32-simulator
93endif
94endif # end of simulator section
95
96
97include $(TOOLSDIR)/make.inc
98
99# MEMORYSIZE should be passed on to this makefile with the chosen memory size
100# given in number of MB
101$(LINKFILE): $(LDS)
102 @echo "build "`basename $@`
103 @cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) \
104 $(DEFINES) -E -P - >$@
105
106clean:
107 @echo "cleaning chessbox"
108 @rm -rf $(OBJDIR)/chessbox
109 @rm -f $(OBJDIR)/chessbox.* $(DEPFILE)
110
111-include $(DEPFILE)
112