summaryrefslogtreecommitdiff
path: root/apps/plugins/lua/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lua/Makefile')
-rw-r--r--apps/plugins/lua/Makefile86
1 files changed, 86 insertions, 0 deletions
diff --git a/apps/plugins/lua/Makefile b/apps/plugins/lua/Makefile
new file mode 100644
index 0000000000..d2a40d38ad
--- /dev/null
+++ b/apps/plugins/lua/Makefile
@@ -0,0 +1,86 @@
1# __________ __ ___.
2# Open \______ \ ____ ____ | | _\_ |__ _______ ___
3# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/
7#
8OPT_FLAGS=-O0
9
10INCLUDES = -I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
11 -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR) -I. $(TARGET_INC)
12CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET) $(EXTRA_DEFINES) \
13 -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN $(OPT_FLAGS) $(PROFILE_OPTS)
14
15ifdef APPEXTRA
16 INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
17endif
18
19LINKFILE := $(OBJDIR)/link.lds
20DEPFILE = $(OBJDIR)/dep-lua
21
22# This sets up 'SRC' based on the files mentioned in SOURCES
23include $(TOOLSDIR)/makesrc.inc
24
25SOURCES = $(SRC)
26OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
27OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
28DIRS = .
29
30ifndef SIMVER
31ifneq (,$(strip $(foreach tgt,RECORDER ONDIO,$(findstring $(tgt),$(TARGET)))))
32 LDS := archos.lds
33 OUTPUT = $(OUTDIR)/lua.ovl
34else ## iRiver/iPod/... targets
35 LDS := ../plugin.lds
36 OUTPUT = $(OUTDIR)/lua.rock
37endif
38else ## simulators
39 OUTPUT = $(OUTDIR)/lua.rock
40endif
41
42all: $(OUTPUT)
43
44ifndef SIMVER
45$(OBJDIR)/lua.elf: $(OBJS) $(LINKFILE)
46 $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) -o $@ $(OBJS) -L$(BUILDDIR) -lplugin -lgcc \
47 -T$(LINKFILE) -Wl,--gc-sections -Wl,-Map,$(OBJDIR)/lua.map
48
49$(OUTPUT): $(OBJDIR)/lua.elf
50 $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
51else
52
53ifeq ($(SIMVER), sdl)
54###################################################
55# This is the SDL simulator version
56
57$(OUTPUT): $(OBJS)
58 $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin -o $@
59ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
60# 'x' must be kept or you'll have "Win32 error 5"
61# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
62# #define ERROR_ACCESS_DENIED 5L
63else
64 @chmod -x $@
65endif
66
67endif
68endif # end of simulator section
69
70
71include $(TOOLSDIR)/make.inc
72
73# MEMORYSIZE should be passed on to this makefile with the chosen memory size
74# given in number of MB
75$(LINKFILE): $(LDS)
76 $(call PRINTS,build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) \
77 $(DEFINES) -E -P - >$@
78 ./action_helper.pl > actions.lua
79 echo $(pwd)
80
81clean:
82 $(call PRINTS,cleaning lua)rm -rf $(OBJDIR)/lua
83 $(SILENT)rm -f $(OBJDIR)/lua.* $(DEPFILE)
84
85-include $(DEPFILE)
86