blob: 16e25c30288292826226d1130b5e48b9bc6506d4 [file] [log] [blame]
Maurus Cuelenaerecf875972009-05-21 19:01:41 +00001# __________ __ ___.
2# Open \______ \ ____ ____ | | _\_ |__ _______ ___
3# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/
7# $Id$
8#
9
10LUA_SRCDIR := $(APPSDIR)/plugins/lua
11LUA_BUILDDIR := $(BUILDDIR)/apps/plugins/lua
12
13LUA_SRC := $(call preprocess, $(LUA_SRCDIR)/SOURCES)
14LUA_OBJ := $(call c2obj, $(LUA_SRC))
15
16OTHER_SRC += $(LUA_SRC)
17
William Wilgusaf35d192018-07-23 02:50:22 +020018LUA_INCLUDEDIR := $(LUA_SRCDIR)/include_lua
William Wilgus74fe5202018-10-30 13:56:36 -040019LUA_INCLUDELIST := $(addprefix $(LUA_BUILDDIR)/,audio.lua blit.lua color.lua draw.lua \
William Wilgus6e32e062019-07-25 10:17:40 -050020 image.lua lcd.lua math_ex.lua print.lua \
21 timer.lua playlist.lua pcm.lua sound.lua \
22 rbcompat.lua )
William Wilguse4c5f5d2018-10-24 21:40:01 -040023
William Wilgusaf35d192018-07-23 02:50:22 +020024
Thomas Martitz57613ea2010-07-10 13:49:49 +000025ifndef APP_TYPE
Maurus Cuelenaerecf875972009-05-21 19:01:41 +000026ifneq (,$(strip $(foreach tgt,RECORDER ONDIO,$(findstring $(tgt),$(TARGET)))))
27 ### lowmem targets
28 ROCKS += $(LUA_BUILDDIR)/lua.ovl
29 LUA_OUTLDS = $(LUA_BUILDDIR)/lua.link
30 LUA_OVLFLAGS = -T$(LUA_OUTLDS) -Wl,--gc-sections -Wl,-Map,$(basename $@).map
31else
32 ### all other targets
33 ROCKS += $(LUA_BUILDDIR)/lua.rock
34endif
35else
36 ### simulator
37 ROCKS += $(LUA_BUILDDIR)/lua.rock
38endif
39
William Wilgus6e32e062019-07-25 10:17:40 -050040$(LUA_BUILDDIR)/lua.rock: $(LUA_OBJ) $(TLSFLIB) $(LUA_BUILDDIR)/actions.lua $(LUA_BUILDDIR)/buttons.lua $(LUA_BUILDDIR)/settings.lua \
41 $(LUA_BUILDDIR)/rocklib_aux.o $(LUA_BUILDDIR)/rb_defines.lua $(LUA_BUILDDIR)/sound_defines.lua \
42 $(LUA_INCLUDELIST)
Maurus Cuelenaerebcfba082009-05-21 21:58:18 +000043
Maurus Cuelenaere952d9bc2010-06-18 12:28:30 +000044$(LUA_BUILDDIR)/actions.lua: $(LUA_OBJ) $(LUA_SRCDIR)/action_helper.pl
William Wilgusa71af172018-12-24 14:24:03 -060045 $(call PRINTS,GEN $(@F))$(CC) $(PLUGINFLAGS) $(INCLUDES) -E -P $(APPSDIR)/plugins/lib/pluginlib_actions.h | $(LUA_SRCDIR)/action_helper.pl > $(LUA_BUILDDIR)/actions.lua
Maurus Cuelenaereaf980d82009-06-24 21:46:17 +000046
William Wilgus9d66b542018-12-15 13:50:00 -060047$(LUA_BUILDDIR)/settings.lua: $(LUA_OBJ) $(LUA_SRCDIR)/settings_helper.pl
William Wilgus28f91ff2018-12-17 09:36:52 -060048 $(SILENT)$(CC) $(INCLUDES) -E -P $(TARGET) $(CFLAGS) -include plugin.h -include cuesheet.h - < /dev/null | $(LUA_SRCDIR)/settings_helper.pl | \
William Wilgus9d66b542018-12-15 13:50:00 -060049 $(CC) $(INCLUDES) $(TARGET) $(CFLAGS) -S -x c -include config.h -include plugin.h -o $(LUA_BUILDDIR)/settings_helper.s -
50 $(call PRINTS,GEN $(@F))$(LUA_SRCDIR)/settings_helper.pl < $(LUA_BUILDDIR)/settings_helper.s > $(LUA_BUILDDIR)/settings.lua
51
Frank Gevaerts8d50cdc2016-03-18 15:50:53 +010052HOST_INCLUDES := $(filter-out %/libc/include,$(INCLUDES))
Maurus Cuelenaere952d9bc2010-06-18 12:28:30 +000053$(LUA_BUILDDIR)/buttons.lua: $(LUA_OBJ) $(LUA_SRCDIR)/button_helper.pl
William Wilgusa71af172018-12-24 14:24:03 -060054 $(SILENT)$(CC) $(INCLUDES) -dM -E -P -include button-target.h - < /dev/null | $(LUA_SRCDIR)/button_helper.pl | $(HOSTCC) -fno-builtin $(HOST_INCLUDES) -x c -o $(LUA_BUILDDIR)/button_helper -
Maurus Cuelenaereaf980d82009-06-24 21:46:17 +000055 $(call PRINTS,GEN $(@F))$(LUA_BUILDDIR)/button_helper > $(LUA_BUILDDIR)/buttons.lua
Maurus Cuelenaerecf875972009-05-21 19:01:41 +000056
William Wilgus6e32e062019-07-25 10:17:40 -050057$(LUA_BUILDDIR)/rb_defines.lua: $(LUA_OBJ) $(LUA_SRCDIR)/rbdefines_helper.pl
58 $(SILENT)$(CC) $(INCLUDES) -dD -E -P $(TARGET) $(CFLAGS) -include plugin.h - < /dev/null | $(LUA_SRCDIR)/rbdefines_helper.pl "rb_defines" | \
59 $(HOSTCC) -fno-builtin $(HOST_INCLUDES) -x c -o $(LUA_BUILDDIR)/rbdefines_helper -
60 $(call PRINTS,GEN $(@F))$(LUA_BUILDDIR)/rbdefines_helper > $(LUA_BUILDDIR)/rb_defines.lua
61
62$(LUA_BUILDDIR)/sound_defines.lua: $(LUA_OBJ) $(LUA_SRCDIR)/rbdefines_helper.pl
63 $(SILENT)$(CC) $(INCLUDES) -dD -E -P $(TARGET) $(CFLAGS) -include config.h -include audiohw_settings.h - < /dev/null | $(LUA_SRCDIR)/rbdefines_helper.pl "sound_defines" | \
64 $(HOSTCC) -fno-builtin $(HOST_INCLUDES) -x c -o $(LUA_BUILDDIR)/sounddefines_helper -
65 $(call PRINTS,GEN $(@F))$(LUA_BUILDDIR)/sounddefines_helper > $(LUA_BUILDDIR)/sound_defines.lua
66
Maurus Cuelenaere952d9bc2010-06-18 12:28:30 +000067$(LUA_BUILDDIR)/rocklib_aux.c: $(APPSDIR)/plugin.h $(LUA_OBJ) $(LUA_SRCDIR)/rocklib_aux.pl
William Wilgusa71af172018-12-24 14:24:03 -060068 $(call PRINTS,GEN $(@F))$(CC) $(PLUGINFLAGS) $(INCLUDES) -E -P -include plugin.h - < /dev/null | $(LUA_SRCDIR)/rocklib_aux.pl $(LUA_SRCDIR) > $(LUA_BUILDDIR)/rocklib_aux.c
Maurus Cuelenaered755a5a2009-07-05 15:33:08 +000069
70$(LUA_BUILDDIR)/rocklib_aux.o: $(LUA_BUILDDIR)/rocklib_aux.c
Thomas Martitz8855b0c2009-10-11 21:30:37 +000071 $(call PRINTS,CC $(<F))$(CC) $(INCLUDES) $(PLUGINFLAGS) -I $(LUA_SRCDIR) -c $< -o $@
Maurus Cuelenaered755a5a2009-07-05 15:33:08 +000072
William Wilgus1b68aea2018-07-24 08:31:19 +020073$(LUA_BUILDDIR)/%.lua: $(LUA_INCLUDEDIR)/%.lua | $(LUA_BUILDDIR)
74 $(call PRINTS,CP $(subst $(LUA_INCLUDEDIR)/,,$<))cp $< $@
William Wilgusaf35d192018-07-23 02:50:22 +020075
Marcin Bukata2a2e142013-08-22 12:12:47 +020076$(LUA_BUILDDIR)/lua.refmap: $(LUA_OBJ) $(TLSFLIB)
Maurus Cuelenaerecf875972009-05-21 19:01:41 +000077
78$(LUA_OUTLDS): $(PLUGIN_LDS) $(LUA_BUILDDIR)/lua.refmap
79 $(call PRINTS,PP $(@F))$(call preprocess2file,$<,$@,-DOVERLAY_OFFSET=$(shell \
80 $(TOOLSDIR)/ovl_offset.pl $(LUA_BUILDDIR)/lua.refmap))
81
Marcin Bukata2a2e142013-08-22 12:12:47 +020082$(LUA_BUILDDIR)/lua.ovl: $(LUA_OBJ) $(TLSFLIB) $(LUA_OUTLDS)
Maurus Cuelenaerecf875972009-05-21 19:01:41 +000083 $(SILENT)$(CC) $(PLUGINFLAGS) -o $(basename $@).elf \
84 $(filter %.o, $^) \
85 $(filter %.a, $+) \
86 -lgcc $(LUA_OVLFLAGS)
Thomas Martitz4b56ee02012-04-04 21:43:22 +020087 $(call PRINTS,LD $(@F))$(call objcopy,$(basename $@).elf,$@)
William Wilgusaf35d192018-07-23 02:50:22 +020088
William Wilgus1b68aea2018-07-24 08:31:19 +020089$(LUA_BUILDDIR):
90 $(call PRINTS,MKDIR $@)mkdir -p $(LUA_BUILDDIR)/
91