Use PLUGINFLAGS in lua.make, instead of only CFLAGS.
[kugel-rb.git] / apps / plugins / lua / lua.make
blob2890521f598303f4e9a5140c60349b734068039c
1 # __________ __ ___.
2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6 # \/ \/ \/ \/ \/
7 # $Id$
10 LUA_SRCDIR := $(APPSDIR)/plugins/lua
11 LUA_BUILDDIR := $(BUILDDIR)/apps/plugins/lua
13 LUA_SRC := $(call preprocess, $(LUA_SRCDIR)/SOURCES)
14 LUA_OBJ := $(call c2obj, $(LUA_SRC))
16 OTHER_SRC += $(LUA_SRC)
18 ifndef SIMVER
19 ifneq (,$(strip $(foreach tgt,RECORDER ONDIO,$(findstring $(tgt),$(TARGET)))))
20 ### lowmem targets
21 ROCKS += $(LUA_BUILDDIR)/lua.ovl
22 LUA_OUTLDS = $(LUA_BUILDDIR)/lua.link
23 LUA_OVLFLAGS = -T$(LUA_OUTLDS) -Wl,--gc-sections -Wl,-Map,$(basename $@).map
24 else
25 ### all other targets
26 ROCKS += $(LUA_BUILDDIR)/lua.rock
27 endif
28 else
29 ### simulator
30 ROCKS += $(LUA_BUILDDIR)/lua.rock
31 endif
33 $(LUA_BUILDDIR)/lua.rock: $(LUA_OBJ) $(LUA_BUILDDIR)/actions.lua $(LUA_BUILDDIR)/buttons.lua $(LUA_BUILDDIR)/rocklib_aux.o
35 $(LUA_BUILDDIR)/actions.lua: $(LUA_OBJ)
36 $(call PRINTS,GEN $(@F))$(CC) $(PLUGINFLAGS) $(INCLUDES) -E $(APPSDIR)/action.h | $(LUA_SRCDIR)/action_helper.pl > $(LUA_BUILDDIR)/actions.lua
38 $(LUA_BUILDDIR)/buttons.lua: $(LUA_OBJ)
39 $(SILENT)$(CC) $(INCLUDES) -dM -E -include button-target.h - < /dev/null | $(LUA_SRCDIR)/button_helper.pl | $(HOSTCC) -fno-builtin $(INCLUDES) -x c -o $(LUA_BUILDDIR)/button_helper -
40 $(call PRINTS,GEN $(@F))$(LUA_BUILDDIR)/button_helper > $(LUA_BUILDDIR)/buttons.lua
42 $(LUA_BUILDDIR)/rocklib_aux.c: $(APPSDIR)/plugin.h $(LUA_OBJ)
43 $(call PRINTS,GEN $(@F))$(CC) $(PLUGINFLAGS) $(INCLUDES) -E -include plugin.h - < /dev/null | $(LUA_SRCDIR)/rocklib_aux.pl $(LUA_SRCDIR) > $(LUA_BUILDDIR)/rocklib_aux.c
45 $(LUA_BUILDDIR)/rocklib_aux.o: $(LUA_BUILDDIR)/rocklib_aux.c
46 $(call PRINTS,CC $(<F))$(CC) $(INCLUDES) $(PLUGINFLAGS) -I $(LUA_SRCDIR) -c $< -o $@
48 $(LUA_BUILDDIR)/lua.refmap: $(LUA_OBJ)
50 $(LUA_OUTLDS): $(PLUGIN_LDS) $(LUA_BUILDDIR)/lua.refmap
51 $(call PRINTS,PP $(@F))$(call preprocess2file,$<,$@,-DOVERLAY_OFFSET=$(shell \
52 $(TOOLSDIR)/ovl_offset.pl $(LUA_BUILDDIR)/lua.refmap))
54 $(LUA_BUILDDIR)/lua.ovl: $(LUA_OBJ) $(LUA_OUTLDS)
55 $(SILENT)$(CC) $(PLUGINFLAGS) -o $(basename $@).elf \
56 $(filter %.o, $^) \
57 $(filter %.a, $+) \
58 -lgcc $(LUA_OVLFLAGS)
59 $(call PRINTS,LD $(@F))$(OC) -O binary $(basename $@).elf $@