Commit 06924859 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner

Some support for LUA

parent 884d93a0
......@@ -2,15 +2,21 @@
# Generate lists of targets and other things
$(eval $(foreach BINARY,$(BINARIES),$(call REGISTER_BIN,$(BINARY))))
$(eval $(foreach LIB,$(LIBRARIES),$(call REGISTER_LIB,$(LIB))))
$(eval $(foreach LUA_FILE,$(LUA),$(call REGISTER_LUA,$(LUA_FILE))))
$(eval $(foreach LUA_FILE,$(LUA_PLUGINS),$(call REGISTER_LUA_PLUGIN,$(LUA_FILE))))
ifndef NO_DOC
$(eval $(foreach DOC,$(DOCS),$(call REGISTER_DOC,$(DOC))))
endif
$(eval $(foreach SCRIPT,$(SCRIPTS),$(call REGISTER_SCRIPT,$(SCRIPT))))
ifeq ($(LUA_COMPILE),yes)
TARGETS += $(TARGETS_LUA)
endif
# Top-level targets to be called by user
all: $(TARGETS)
clean:
rm -rf $(O)/bin $(O)/lib $(O)/docs $(O)/.objs $(O)/.deps $(TARGETS)
rm -rf $(O)/bin $(O)/lib $(O)/docs $(O)/.objs $(O)/.deps $(O)/lua_lib $(O)/lua_plugins $(TARGETS)
.PHONY: all clean
......@@ -39,6 +39,9 @@ endif
ifeq ($(ENABLE_PYTHON), 1)
CFLAGS_ALL += $(shell python2.7-config --includes)
endif
ifeq ($(LUA_COMPILE),1)
CFLAGS_ALL += -DLUA_COMPILE
endif
# Magic to track dependencies on header files. They are stored in the .d files
# by the compiler, then we load them on the next run and use them.
......@@ -55,6 +58,8 @@ endif
define COMMON_REGISTER
$(1): $$(patsubst %,$(O)/.objs/$(3)%.o,$$($(2)_MODULES))
$(1): CFLAGS_ALL += $$($(2)_CFLAGS) $$(foreach CONFIG,$$($(2)_PKG_CONFIGS),$$(shell pkg-config --cflags $$(CONFIG))) $$(foreach CONFIG,$$($(2)_EXE_CONFIGS),$$(shell $$(CONFIG)-config --cflags))
$(1): LDFLAGS_ALL += $$($(2)_LDFLAGS) $$(foreach CONFIG,$$($(2)_PKG_CONFIGS),$$(shell pkg-config --libs $$(CONFIG))) $$(foreach CONFIG,$$($(2)_EXE_CONFIGS),$$(shell $$(CONFIG)-config --libs))
$(1): CFLAGS_ALL += $$($(2)_CFLAGS)
$(1): LDFLAGS_ALL += $$($(2)_LDFLAGS)
ifdef STATIC
......@@ -118,6 +123,15 @@ $(O)/$(1).html: $(O)/docs/$$(notdir $(1)).html
endef
# For lua
define REGISTER_LUA
ifneq (,$(findstring ^$(RESTRICT),^$(1)))
TARGETS_LUA += $(O)/lua_lib/$(notdir $(1)).luac
endif
$(O)/lua_lib/$$(notdir $(1)).luac: $(S)/$$(addsuffix .lua,$(1))
endef
define REGISTER_SCRIPT
ifneq (,$(findstring ^$(RESTRICT),^$(1)))
......@@ -163,3 +177,8 @@ $(O)/docs/%:
$(M) DOC-HTML $@
$(Q)mkdir -p $(dir $@)
$(Q)$(ASCIIDOC) -o $@ $<
$(O)/lua_lib/%:
$(M) LUAC $@
$(Q)mkdir -p $(dir $@)
$(Q)$(LUAC) -o $@ $<
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment