Maurus Cuelenaere | cf87597 | 2009-05-21 19:01:41 +0000 | [diff] [blame] | 1 | # __________ __ ___. |
| 2 | # Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 3 | # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 4 | # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 5 | # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 6 | # \/ \/ \/ \/ \/ |
| 7 | # $Id$ |
| 8 | # |
| 9 | |
| 10 | LUA_SRCDIR := $(APPSDIR)/plugins/lua |
| 11 | LUA_BUILDDIR := $(BUILDDIR)/apps/plugins/lua |
| 12 | |
| 13 | LUA_SRC := $(call preprocess, $(LUA_SRCDIR)/SOURCES) |
| 14 | LUA_OBJ := $(call c2obj, $(LUA_SRC)) |
| 15 | |
| 16 | OTHER_SRC += $(LUA_SRC) |
| 17 | |
William Wilgus | af35d19 | 2018-07-23 02:50:22 +0200 | [diff] [blame] | 18 | LUA_INCLUDEDIR := $(LUA_SRCDIR)/include_lua |
William Wilgus | 74fe520 | 2018-10-30 13:56:36 -0400 | [diff] [blame] | 19 | LUA_INCLUDELIST := $(addprefix $(LUA_BUILDDIR)/,audio.lua blit.lua color.lua draw.lua \ |
William Wilgus | 6e32e06 | 2019-07-25 10:17:40 -0500 | [diff] [blame^] | 20 | image.lua lcd.lua math_ex.lua print.lua \ |
| 21 | timer.lua playlist.lua pcm.lua sound.lua \ |
| 22 | rbcompat.lua ) |
William Wilgus | e4c5f5d | 2018-10-24 21:40:01 -0400 | [diff] [blame] | 23 | |
William Wilgus | af35d19 | 2018-07-23 02:50:22 +0200 | [diff] [blame] | 24 | |
Thomas Martitz | 57613ea | 2010-07-10 13:49:49 +0000 | [diff] [blame] | 25 | ifndef APP_TYPE |
Maurus Cuelenaere | cf87597 | 2009-05-21 19:01:41 +0000 | [diff] [blame] | 26 | ifneq (,$(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 |
| 31 | else |
| 32 | ### all other targets |
| 33 | ROCKS += $(LUA_BUILDDIR)/lua.rock |
| 34 | endif |
| 35 | else |
| 36 | ### simulator |
| 37 | ROCKS += $(LUA_BUILDDIR)/lua.rock |
| 38 | endif |
| 39 | |
William Wilgus | 6e32e06 | 2019-07-25 10:17:40 -0500 | [diff] [blame^] | 40 | $(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 Cuelenaere | bcfba08 | 2009-05-21 21:58:18 +0000 | [diff] [blame] | 43 | |
Maurus Cuelenaere | 952d9bc | 2010-06-18 12:28:30 +0000 | [diff] [blame] | 44 | $(LUA_BUILDDIR)/actions.lua: $(LUA_OBJ) $(LUA_SRCDIR)/action_helper.pl |
William Wilgus | a71af17 | 2018-12-24 14:24:03 -0600 | [diff] [blame] | 45 | $(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 Cuelenaere | af980d8 | 2009-06-24 21:46:17 +0000 | [diff] [blame] | 46 | |
William Wilgus | 9d66b54 | 2018-12-15 13:50:00 -0600 | [diff] [blame] | 47 | $(LUA_BUILDDIR)/settings.lua: $(LUA_OBJ) $(LUA_SRCDIR)/settings_helper.pl |
William Wilgus | 28f91ff | 2018-12-17 09:36:52 -0600 | [diff] [blame] | 48 | $(SILENT)$(CC) $(INCLUDES) -E -P $(TARGET) $(CFLAGS) -include plugin.h -include cuesheet.h - < /dev/null | $(LUA_SRCDIR)/settings_helper.pl | \ |
William Wilgus | 9d66b54 | 2018-12-15 13:50:00 -0600 | [diff] [blame] | 49 | $(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 Gevaerts | 8d50cdc | 2016-03-18 15:50:53 +0100 | [diff] [blame] | 52 | HOST_INCLUDES := $(filter-out %/libc/include,$(INCLUDES)) |
Maurus Cuelenaere | 952d9bc | 2010-06-18 12:28:30 +0000 | [diff] [blame] | 53 | $(LUA_BUILDDIR)/buttons.lua: $(LUA_OBJ) $(LUA_SRCDIR)/button_helper.pl |
William Wilgus | a71af17 | 2018-12-24 14:24:03 -0600 | [diff] [blame] | 54 | $(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 Cuelenaere | af980d8 | 2009-06-24 21:46:17 +0000 | [diff] [blame] | 55 | $(call PRINTS,GEN $(@F))$(LUA_BUILDDIR)/button_helper > $(LUA_BUILDDIR)/buttons.lua |
Maurus Cuelenaere | cf87597 | 2009-05-21 19:01:41 +0000 | [diff] [blame] | 56 | |
William Wilgus | 6e32e06 | 2019-07-25 10:17:40 -0500 | [diff] [blame^] | 57 | $(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 Cuelenaere | 952d9bc | 2010-06-18 12:28:30 +0000 | [diff] [blame] | 67 | $(LUA_BUILDDIR)/rocklib_aux.c: $(APPSDIR)/plugin.h $(LUA_OBJ) $(LUA_SRCDIR)/rocklib_aux.pl |
William Wilgus | a71af17 | 2018-12-24 14:24:03 -0600 | [diff] [blame] | 68 | $(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 Cuelenaere | d755a5a | 2009-07-05 15:33:08 +0000 | [diff] [blame] | 69 | |
| 70 | $(LUA_BUILDDIR)/rocklib_aux.o: $(LUA_BUILDDIR)/rocklib_aux.c |
Thomas Martitz | 8855b0c | 2009-10-11 21:30:37 +0000 | [diff] [blame] | 71 | $(call PRINTS,CC $(<F))$(CC) $(INCLUDES) $(PLUGINFLAGS) -I $(LUA_SRCDIR) -c $< -o $@ |
Maurus Cuelenaere | d755a5a | 2009-07-05 15:33:08 +0000 | [diff] [blame] | 72 | |
William Wilgus | 1b68aea | 2018-07-24 08:31:19 +0200 | [diff] [blame] | 73 | $(LUA_BUILDDIR)/%.lua: $(LUA_INCLUDEDIR)/%.lua | $(LUA_BUILDDIR) |
| 74 | $(call PRINTS,CP $(subst $(LUA_INCLUDEDIR)/,,$<))cp $< $@ |
William Wilgus | af35d19 | 2018-07-23 02:50:22 +0200 | [diff] [blame] | 75 | |
Marcin Bukat | a2a2e14 | 2013-08-22 12:12:47 +0200 | [diff] [blame] | 76 | $(LUA_BUILDDIR)/lua.refmap: $(LUA_OBJ) $(TLSFLIB) |
Maurus Cuelenaere | cf87597 | 2009-05-21 19:01:41 +0000 | [diff] [blame] | 77 | |
| 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 Bukat | a2a2e14 | 2013-08-22 12:12:47 +0200 | [diff] [blame] | 82 | $(LUA_BUILDDIR)/lua.ovl: $(LUA_OBJ) $(TLSFLIB) $(LUA_OUTLDS) |
Maurus Cuelenaere | cf87597 | 2009-05-21 19:01:41 +0000 | [diff] [blame] | 83 | $(SILENT)$(CC) $(PLUGINFLAGS) -o $(basename $@).elf \ |
| 84 | $(filter %.o, $^) \ |
| 85 | $(filter %.a, $+) \ |
| 86 | -lgcc $(LUA_OVLFLAGS) |
Thomas Martitz | 4b56ee0 | 2012-04-04 21:43:22 +0200 | [diff] [blame] | 87 | $(call PRINTS,LD $(@F))$(call objcopy,$(basename $@).elf,$@) |
William Wilgus | af35d19 | 2018-07-23 02:50:22 +0200 | [diff] [blame] | 88 | |
William Wilgus | 1b68aea | 2018-07-24 08:31:19 +0200 | [diff] [blame] | 89 | $(LUA_BUILDDIR): |
| 90 | $(call PRINTS,MKDIR $@)mkdir -p $(LUA_BUILDDIR)/ |
| 91 | |