From 8527742b73a5e87565ca80df8d34d6fd16ef1c14 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 26 Jan 2016 09:34:43 +0100 Subject: [PATCH] Create Makefile.lua --- libretro-db/Makefile | 42 ++----------------- libretro-db/Makefile.lua | 87 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+), 38 deletions(-) create mode 100644 libretro-db/Makefile.lua diff --git a/libretro-db/Makefile b/libretro-db/Makefile index 07bf8c6c31..06bf8ac4a6 100644 --- a/libretro-db/Makefile +++ b/libretro-db/Makefile @@ -2,7 +2,7 @@ DEBUG = 0 LIBRETRO_COMMON_DIR := ../libretro-common INCFLAGS = -I. -I$(LIBRETRO_COMMON_DIR)/include -TARGETS = rmsgpack_test libretrodb_tool lua_converter c_converter +TARGETS = rmsgpack_test libretrodb_tool c_converter ifeq ($(DEBUG), 1) CFLAGS = -g -O0 -Wall @@ -10,20 +10,6 @@ else CFLAGS = -g -O2 -Wall -DNDEBUG endif -LUA_CONVERTER_C = \ - rmsgpack.c \ - rmsgpack_dom.c \ - lua/lua_common.c \ - libretrodb.c \ - bintree.c \ - query.c \ - lua/lua_converter.c \ - $(LIBRETRO_COMMON_DIR)/compat/compat_fnmatch.c \ - $(LIBRETRO_COMMON_DIR)/file/retro_file.c \ - $(LIBRETRO_COMMON_DIR)/compat/compat_strl.c - -LUA_CONVERTER_OBJS := $(LUA_CONVERTER_C:.c=.o) - C_CONVERTER_C = \ rmsgpack.c \ rmsgpack_dom.c \ @@ -51,19 +37,6 @@ RARCHDB_TOOL_C = \ RARCHDB_TOOL_OBJS := $(RARCHDB_TOOL_C:.c=.o) -TESTLIB_C = \ - lua/testlib.c \ - query.c \ - libretrodb.c \ - bintree.c \ - rmsgpack.c \ - rmsgpack_dom.c \ - $(LIBRETRO_COMMON_DIR)/compat/compat_fnmatch.c \ - $(LIBRETRO_COMMON_DIR)/file/retro_file.c \ - $(LIBRETRO_COMMON_DIR)/compat/compat_strl.c - -TESTLIB_OBJS := $(TESTLIB_C:.c=.o) - RMSGPACK_C = \ rmsgpack.c \ rmsgpack_test.c \ @@ -71,19 +44,15 @@ RMSGPACK_C = \ RMSGPACK_OBJS := $(RMSGPACK_C:.c=.o) -LUA_FLAGS = `pkg-config lua --libs` -TESTLIB_FLAGS = $(CFLAGS) $(LUA_FLAGS) -shared -fpic +TESTLIB_FLAGS = $(CFLAGS) -shared -fpic -.PHONY: all clean check +.PHONY: all clean all: $(TARGETS) %.o: %.c $(CC) $(INCFLAGS) $< -c $(CFLAGS) -o $@ -lua_converter: $(LUA_CONVERTER_OBJS) - $(CC) $(INCFLAGS) $(LUA_CONVERTER_OBJS) $(LUA_FLAGS) -o $@ - c_converter: $(C_CONVERTER_OBJS) $(CC) $(INCFLAGS) $(C_CONVERTER_OBJS) $(CFLAGS) -o $@ @@ -97,8 +66,5 @@ testlib.so: CFLAGS += -fPIC testlib.so: clean $(TESTLIB_OBJS) $(CC) $(INCFLAGS) $(TESTLIB_FLAGS) $(TESTLIB_OBJS) -o $@ -check: testlib.so lua/tests.lua - lua ./lua/tests.lua - clean: - rm -rf $(TARGETS) $(LUA_CONVERTER_OBJS) $(C_CONVERTER_OBJS) $(RARCHDB_TOOL_OBJS) $(RMSGPACK_OBJS) $(TESTLIB_OBJS) testlib.so + rm -rf $(TARGETS) $(C_CONVERTER_OBJS) $(RARCHDB_TOOL_OBJS) $(RMSGPACK_OBJS) $(TESTLIB_OBJS) testlib.so diff --git a/libretro-db/Makefile.lua b/libretro-db/Makefile.lua new file mode 100644 index 0000000000..40c6785a62 --- /dev/null +++ b/libretro-db/Makefile.lua @@ -0,0 +1,87 @@ +DEBUG = 0 +LIBRETRO_COMMON_DIR := ../libretro-common +INCFLAGS = -I. -I$(LIBRETRO_COMMON_DIR)/include + +TARGETS = rmsgpack_test libretrodb_tool lua_converter + +ifeq ($(DEBUG), 1) +CFLAGS = -g -O0 -Wall +else +CFLAGS = -g -O2 -Wall -DNDEBUG +endif + +LUA_CONVERTER_C = \ + rmsgpack.c \ + rmsgpack_dom.c \ + lua/lua_common.c \ + libretrodb.c \ + bintree.c \ + query.c \ + lua/lua_converter.c \ + $(LIBRETRO_COMMON_DIR)/compat/compat_fnmatch.c \ + $(LIBRETRO_COMMON_DIR)/file/retro_file.c \ + $(LIBRETRO_COMMON_DIR)/compat/compat_strl.c + +LUA_CONVERTER_OBJS := $(LUA_CONVERTER_C:.c=.o) + +RARCHDB_TOOL_C = \ + rmsgpack.c \ + rmsgpack_dom.c \ + libretrodb_tool.c \ + bintree.c \ + query.c \ + libretrodb.c \ + $(LIBRETRO_COMMON_DIR)/compat/compat_fnmatch.c \ + $(LIBRETRO_COMMON_DIR)/file/retro_file.c \ + $(LIBRETRO_COMMON_DIR)/compat/compat_strl.c + +RARCHDB_TOOL_OBJS := $(RARCHDB_TOOL_C:.c=.o) + +TESTLIB_C = \ + lua/testlib.c \ + query.c \ + libretrodb.c \ + bintree.c \ + rmsgpack.c \ + rmsgpack_dom.c \ + $(LIBRETRO_COMMON_DIR)/compat/compat_fnmatch.c \ + $(LIBRETRO_COMMON_DIR)/file/retro_file.c \ + $(LIBRETRO_COMMON_DIR)/compat/compat_strl.c + +TESTLIB_OBJS := $(TESTLIB_C:.c=.o) + +RMSGPACK_C = \ + rmsgpack.c \ + rmsgpack_test.c \ + $(LIBRETRO_COMMON_DIR)/file/retro_file.c + +RMSGPACK_OBJS := $(RMSGPACK_C:.c=.o) + +LUA_FLAGS = `pkg-config lua --libs` +TESTLIB_FLAGS = $(CFLAGS) $(LUA_FLAGS) -shared -fpic + +.PHONY: all clean check + +all: $(TARGETS) + +%.o: %.c + $(CC) $(INCFLAGS) $< -c $(CFLAGS) -o $@ + +lua_converter: $(LUA_CONVERTER_OBJS) + $(CC) $(INCFLAGS) $(LUA_CONVERTER_OBJS) $(LUA_FLAGS) -o $@ + +libretrodb_tool: $(RARCHDB_TOOL_OBJS) + $(CC) $(INCFLAGS) $(RARCHDB_TOOL_OBJS) -o $@ + +rmsgpack_test: $(RMSGPACK_OBJS) + $(CC) $(INCFLAGS) $(RMSGPACK_OBJS) -g -o $@ + +testlib.so: CFLAGS += -fPIC +testlib.so: clean $(TESTLIB_OBJS) + $(CC) $(INCFLAGS) $(TESTLIB_FLAGS) $(TESTLIB_OBJS) -o $@ + +check: testlib.so lua/tests.lua + lua ./lua/tests.lua + +clean: + rm -rf $(TARGETS) $(LUA_CONVERTER_OBJS) $(C_CONVERTER_OBJS) $(RARCHDB_TOOL_OBJS) $(RMSGPACK_OBJS) $(TESTLIB_OBJS) testlib.so