summaryrefslogtreecommitdiff
path: root/apps/plugins/sudoku/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/sudoku/Makefile')
-rw-r--r--apps/plugins/sudoku/Makefile117
1 files changed, 117 insertions, 0 deletions
diff --git a/apps/plugins/sudoku/Makefile b/apps/plugins/sudoku/Makefile
new file mode 100644
index 0000000000..9b9c1c6b2e
--- /dev/null
+++ b/apps/plugins/sudoku/Makefile
@@ -0,0 +1,117 @@
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) $(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-sudoku
21
22# This sets up 'SRC' based on the files mentioned in SOURCES
23include $(TOOLSDIR)/makesrc.inc
24
25SOURCES = $(SRC)
26OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
27DIRS = .
28
29ifndef SIMVER
30 LDS := ../plugin.lds
31 OUTPUT = $(OUTDIR)/sudoku.rock
32else ## simulators
33 OUTPUT = $(OUTDIR)/sudoku.rock
34endif
35
36all: $(OUTPUT)
37
38ifndef SIMVER
39$(OBJDIR)/sudoku.elf: $(OBJS) $(LINKFILE) $(BITMAPLIBS)
40 @echo "LD "`basename $@`
41 @$(CC) $(GCCOPTS) -O -nostdlib -o $@ $(OBJS) -L$(BUILDDIR) -lplugin -lgcc \
42 $(LINKBITMAPS) -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/sudoku.map
43
44$(OUTPUT): $(OBJDIR)/sudoku.elf
45 @echo "OBJCOPY "`basename $@`
46 @$(OC) -O binary $< $@
47else
48
49ifeq ($(SIMVER), x11)
50###################################################
51# This is the X11 simulator version
52
53$(OUTPUT): $(OBJS)
54 @echo "LD $<"
55 @$(CC) $(CFLAGS) -shared $(OBJS) -L$(BUILDDIR) -lplugin $(LINKBITMAPS) -o $@
56ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
57# 'x' must be kept or you'll have "Win32 error 5"
58# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
59# #define ERROR_ACCESS_DENIED 5L
60else
61 @chmod -x $@
62endif
63
64else # end of x11-simulator
65ifeq ($(SIMVER), sdl)
66###################################################
67# This is the SDL simulator version
68
69$(OUTPUT): $(OBJS)
70 @echo "LD $<"
71 @$(CC) $(CFLAGS) -shared $(OBJS) -L$(BUILDDIR) -lplugin $(LINKBITMAPS) -o $@
72ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
73# 'x' must be kept or you'll have "Win32 error 5"
74# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
75# #define ERROR_ACCESS_DENIED 5L
76else
77 @chmod -x $@
78endif
79
80else # end of sdl-simulator
81###################################################
82# This is the win32 simulator version
83DLLTOOLFLAGS = --export-all
84DLLWRAPFLAGS = -s --entry _DllMain@12 --target=i386-mingw32 -mno-cygwin
85
86$(OUTPUT): $(OBJS)
87 @echo "DLL "`basename $@`
88 @$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $(OBJS)
89 @$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $(OBJS) \
90 $(BUILDDIR)/libplugin.a $(BITMAPLIBS) -o $@
91ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
92# 'x' must be kept or you'll have "Win32 error 5"
93# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
94# #define ERROR_ACCESS_DENIED 5L
95else
96 @chmod -x $@
97endif
98endif # end of win32-simulator
99endif
100endif # end of simulator section
101
102
103include $(TOOLSDIR)/make.inc
104
105# MEMORYSIZE should be passed on to this makefile with the chosen memory size
106# given in number of MB
107$(LINKFILE): $(LDS)
108 @echo "build "`basename $@`
109 @cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) \
110 $(DEFINES) -E -P - >$@
111
112clean:
113 @echo "cleaning sudoku"
114 @rm -rf $(OBJDIR)/sudoku
115 @rm -f $(OBJDIR)/sudoku.* $(DEPFILE)
116
117-include $(DEPFILE)