diff options
Diffstat (limited to 'apps/plugins/chessbox/Makefile')
-rw-r--r-- | apps/plugins/chessbox/Makefile | 112 |
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 | |||
10 | INCLUDES = -I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \ | ||
11 | -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR) | ||
12 | CFLAGS = $(GCCOPTS) -O3 $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \ | ||
13 | -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN | ||
14 | |||
15 | ifdef APPEXTRA | ||
16 | INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA))) | ||
17 | endif | ||
18 | |||
19 | LINKFILE := $(OBJDIR)/link.lds | ||
20 | DEPFILE = $(OBJDIR)/dep-chessbox | ||
21 | SRC = chessbox.c gnuchess.c | ||
22 | |||
23 | SOURCES = $(SRC) | ||
24 | OBJS := $(SRC:%.c=$(OBJDIR)/%.o) | ||
25 | DIRS = . | ||
26 | |||
27 | LDS := ../plugin.lds | ||
28 | OUTPUT = $(OUTDIR)/chessbox.rock | ||
29 | |||
30 | all: $(OUTPUT) | ||
31 | |||
32 | ifndef 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 $< $@ | ||
41 | else | ||
42 | |||
43 | ifeq ($(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 $@ | ||
50 | ifeq ($(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 | ||
54 | else | ||
55 | @chmod -x $@ | ||
56 | endif | ||
57 | |||
58 | else # end of x11-simulator | ||
59 | ifeq ($(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 $@ | ||
66 | ifeq ($(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 | ||
70 | else | ||
71 | @chmod -x $@ | ||
72 | endif | ||
73 | |||
74 | else # end of sdl-simulator | ||
75 | ################################################### | ||
76 | # This is the win32 simulator version | ||
77 | DLLTOOLFLAGS = --export-all | ||
78 | DLLWRAPFLAGS = -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 $@ | ||
85 | ifeq ($(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 | ||
89 | else | ||
90 | @chmod -x $@ | ||
91 | endif | ||
92 | endif # end of win32-simulator | ||
93 | endif | ||
94 | endif # end of simulator section | ||
95 | |||
96 | |||
97 | include $(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 | |||
106 | clean: | ||
107 | @echo "cleaning chessbox" | ||
108 | @rm -rf $(OBJDIR)/chessbox | ||
109 | @rm -f $(OBJDIR)/chessbox.* $(DEPFILE) | ||
110 | |||
111 | -include $(DEPFILE) | ||
112 | |||