From 057a223b389efa869a3fd76ee7a7c678bd805727 Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Thu, 24 Apr 2014 22:16:30 +0200 Subject: [PATCH] Integrate luabins into Aegisub's build system Make it build as C++ so it links properly against the C++-built version of Lua used in Aegisub too. --- Makefile | 1 + vendor/luabins/Makefile | 509 ++---------------- vendor/luabins/etc/Makefile.luabins.template | 242 --------- vendor/luabins/etc/genmakefile.sh | 2 - vendor/luabins/src/{fwrite.c => fwrite.cpp} | 0 vendor/luabins/src/{load.c => load.cpp} | 0 vendor/luabins/src/{luabins.c => luabins.cpp} | 0 .../src/{luainternals.c => luainternals.cpp} | 0 vendor/luabins/src/{save.c => save.cpp} | 0 .../src/{savebuffer.c => savebuffer.cpp} | 0 vendor/luabins/src/{write.c => write.cpp} | 0 11 files changed, 41 insertions(+), 713 deletions(-) delete mode 100644 vendor/luabins/etc/Makefile.luabins.template delete mode 100755 vendor/luabins/etc/genmakefile.sh rename vendor/luabins/src/{fwrite.c => fwrite.cpp} (100%) rename vendor/luabins/src/{load.c => load.cpp} (100%) rename vendor/luabins/src/{luabins.c => luabins.cpp} (100%) rename vendor/luabins/src/{luainternals.c => luainternals.cpp} (100%) rename vendor/luabins/src/{save.c => save.cpp} (100%) rename vendor/luabins/src/{savebuffer.c => savebuffer.cpp} (100%) rename vendor/luabins/src/{write.c => write.cpp} (100%) diff --git a/Makefile b/Makefile index 828f49666..e4fa04a6b 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ include Makefile.inc SUBDIRS += \ vendor/lua \ vendor/universalchardet \ + vendor/luabins \ libaegisub \ tools \ src \ diff --git a/vendor/luabins/Makefile b/vendor/luabins/Makefile index 386738da1..6713d3759 100644 --- a/vendor/luabins/Makefile +++ b/vendor/luabins/Makefile @@ -1,469 +1,40 @@ -## CONFIGURATION ############################################################## - -ifeq ($(shell uname),Darwin) - LUA_DIR := /usr/local - LUA_LIBDIR := $(LUA_DIR)/lib/lua/5.1 - LUA_INCDIR := $(LUA_DIR)/include - LUALIB := lua -else - # Assuming Ubuntu - LUA_LIBDIR := /usr/lib - LUA_INCDIR := /usr/include/lua5.1 - LUALIB := lua5.1 -endif - -PROJECTNAME := luabins - -SONAME := $(PROJECTNAME).so -ANAME := lib$(PROJECTNAME).a -HNAME := $(PROJECTNAME).h -TESTNAME := $(PROJECTNAME)-test -TESTLUA := test.lua - -LUA := lua -CP := cp -RM := rm -f -RMDIR := rm -df -MKDIR := mkdir -p -CC := gcc -LD := gcc -AR := ar rcu -RANLIB := ranlib -ECHO := @echo -TOUCH := touch - -# Needed for tests only -CXX := g++ -LDXX := g++ - -OBJDIR := ./obj -TMPDIR := ./tmp -INCDIR := ./include -LIBDIR := ./lib - -HFILE := $(INCDIR)/$(HNAME) - -CFLAGS += -O2 -Wall -I$(LUA_INCDIR) -LDFLAGS += -L$(LUA_LIBDIR) - -# Tested on OS X and Ubuntu -SOFLAGS := -ifeq ($(shell uname),Darwin) - SOFLAGS += -dynamiclib -undefined dynamic_lookup -else - CFLAGS += -fPIC - SOFLAGS += -shared - LDFLAGS += -ldl - RMDIR := rm -rf -endif - -CFLAGS += $(MYCFLAGS) -LDFLAGS += $(MYLDFLAGS) - -## MAIN TARGETS ############################################################### - -all: $(LIBDIR)/$(SONAME) $(LIBDIR)/$(ANAME) $(HFILE) - -clean: cleanlibs cleantest - $(RM) $(HFILE) - -install: $(LIBDIR)/$(SONAME) - # Note header and static library are not copied anywhere - $(CP) $(LIBDIR)/$(SONAME) $(LUA_LIBDIR)/$(SONAME) - -$(HFILE): - $(CP) src/$(HNAME) $(HFILE) - -## GENERATED RELEASE TARGETS ################################################## - -cleanlibs: cleanobjects - $(RM) $(LIBDIR)/$(SONAME) - $(RM) $(LIBDIR)/$(ANAME) - -$(LIBDIR)/$(SONAME): $(OBJDIR)/fwrite.o $(OBJDIR)/load.o $(OBJDIR)/luabins.o $(OBJDIR)/luainternals.o $(OBJDIR)/lualess.o $(OBJDIR)/save.o $(OBJDIR)/savebuffer.o $(OBJDIR)/write.o - $(MKDIR) $(LIBDIR) - $(LD) -o $@ $(OBJDIR)/fwrite.o $(OBJDIR)/load.o $(OBJDIR)/luabins.o $(OBJDIR)/luainternals.o $(OBJDIR)/lualess.o $(OBJDIR)/save.o $(OBJDIR)/savebuffer.o $(OBJDIR)/write.o $(LDFLAGS) $(SOFLAGS) - -$(LIBDIR)/$(ANAME): $(OBJDIR)/fwrite.o $(OBJDIR)/load.o $(OBJDIR)/luabins.o $(OBJDIR)/luainternals.o $(OBJDIR)/lualess.o $(OBJDIR)/save.o $(OBJDIR)/savebuffer.o $(OBJDIR)/write.o - $(MKDIR) $(LIBDIR) - $(AR) $@ $(OBJDIR)/fwrite.o $(OBJDIR)/load.o $(OBJDIR)/luabins.o $(OBJDIR)/luainternals.o $(OBJDIR)/lualess.o $(OBJDIR)/save.o $(OBJDIR)/savebuffer.o $(OBJDIR)/write.o - $(RANLIB) $@ - -# objects: - -cleanobjects: - $(RM) $(OBJDIR)/fwrite.o $(OBJDIR)/load.o $(OBJDIR)/luabins.o $(OBJDIR)/luainternals.o $(OBJDIR)/lualess.o $(OBJDIR)/save.o $(OBJDIR)/savebuffer.o $(OBJDIR)/write.o - -$(OBJDIR)/fwrite.o: src/fwrite.c src/luaheaders.h src/fwrite.h \ - src/saveload.h - $(CC) $(CFLAGS) -o $@ -c src/fwrite.c - -$(OBJDIR)/load.o: src/load.c src/luaheaders.h src/luabins.h \ - src/saveload.h src/luainternals.h - $(CC) $(CFLAGS) -o $@ -c src/load.c - -$(OBJDIR)/luabins.o: src/luabins.c src/luaheaders.h src/luabins.h - $(CC) $(CFLAGS) -o $@ -c src/luabins.c - -$(OBJDIR)/luainternals.o: src/luainternals.c src/luainternals.h - $(CC) $(CFLAGS) -o $@ -c src/luainternals.c - -$(OBJDIR)/lualess.o: src/lualess.c - $(CC) $(CFLAGS) -o $@ -c src/lualess.c - -$(OBJDIR)/save.o: src/save.c src/luaheaders.h src/luabins.h \ - src/saveload.h src/savebuffer.h src/write.h - $(CC) $(CFLAGS) -o $@ -c src/save.c - -$(OBJDIR)/savebuffer.o: src/savebuffer.c src/luaheaders.h \ - src/saveload.h src/savebuffer.h - $(CC) $(CFLAGS) -o $@ -c src/savebuffer.c - -$(OBJDIR)/write.o: src/write.c src/luaheaders.h src/write.h \ - src/saveload.h src/savebuffer.h - $(CC) $(CFLAGS) -o $@ -c src/write.c - -## TEST TARGETS ############################################################### - -test: testc89 testc99 testc++98 - $(ECHO) "===== TESTS PASSED =====" - -resettest: resettestc89 resettestc99 resettestc++98 - -cleantest: cleantestc89 cleantestc99 cleantestc++98 - -## GENERATED TEST TARGETS ##################################################### - -## ----- Begin c89 ----- - -testc89: lua-testsc89 c-testsc89 - -lua-testsc89: $(TMPDIR)/c89/.luatestspassed - -c-testsc89: $(TMPDIR)/c89/.ctestspassed - -$(TMPDIR)/c89/.luatestspassed: $(TMPDIR)/c89/$(SONAME) test/$(TESTLUA) - $(ECHO) "===== Running Lua tests for c89 =====" - @$(LUA) \ - -e "package.cpath='$(TMPDIR)/c89/$(SONAME);'..package.cpath" \ - test/$(TESTLUA) - $(TOUCH) $(TMPDIR)/c89/.luatestspassed - $(ECHO) "===== Lua tests for c89 PASSED =====" - -$(TMPDIR)/c89/.ctestspassed: $(TMPDIR)/c89/$(TESTNAME) test/$(TESTLUA) - $(ECHO) "===== Running C tests for c89 =====" - $(TMPDIR)/c89/$(TESTNAME) - $(TOUCH) $(TMPDIR)/c89/.ctestspassed - $(ECHO) "===== C tests for c89 PASSED =====" - -$(TMPDIR)/c89/$(TESTNAME): $(OBJDIR)/c89-test.o $(OBJDIR)/c89-test_api.o $(OBJDIR)/c89-test_fwrite_api.o $(OBJDIR)/c89-test_savebuffer.o $(OBJDIR)/c89-test_write_api.o $(OBJDIR)/c89-util.o $(TMPDIR)/c89/$(ANAME) - $(MKDIR) $(TMPDIR)/c89 - $(LD) -o $@ $(OBJDIR)/c89-test.o $(OBJDIR)/c89-test_api.o $(OBJDIR)/c89-test_fwrite_api.o $(OBJDIR)/c89-test_savebuffer.o $(OBJDIR)/c89-test_write_api.o $(OBJDIR)/c89-util.o $(LDFLAGS) -lm -l$(LUALIB) -l$(PROJECTNAME) -L$(TMPDIR)/c89 - -resettestc89: - $(RM) $(TMPDIR)/c89/.luatestspassed - $(RM) $(TMPDIR)/c89/.ctestspassed - -cleantestc89: cleanlibsc89 resettestc89 \ - cleantestobjectsc89 - $(RM) $(TMPDIR)/c89/$(TESTNAME) - $(RMDIR) $(TMPDIR)/c89 - -# testobjectsc89: - -cleantestobjectsc89: - $(RM) $(OBJDIR)/c89-test.o $(OBJDIR)/c89-test_api.o $(OBJDIR)/c89-test_fwrite_api.o $(OBJDIR)/c89-test_savebuffer.o $(OBJDIR)/c89-test_write_api.o $(OBJDIR)/c89-util.o - -$(OBJDIR)/c89-test.o: test/test.c test/test.h - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c89 -Isrc/ -o $@ -c test/test.c - -$(OBJDIR)/c89-test_api.o: test/test_api.c src/luabins.h - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c89 -Isrc/ -o $@ -c test/test_api.c - -$(OBJDIR)/c89-test_fwrite_api.o: test/test_fwrite_api.c src/lualess.h \ - src/fwrite.h src/saveload.h test/test.h test/util.h \ - test/write_tests.inc - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c89 -Isrc/ -o $@ -c test/test_fwrite_api.c - -$(OBJDIR)/c89-test_savebuffer.o: test/test_savebuffer.c src/lualess.h \ - src/savebuffer.h test/test.h - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c89 -Isrc/ -o $@ -c test/test_savebuffer.c - -$(OBJDIR)/c89-test_write_api.o: test/test_write_api.c src/lualess.h \ - src/write.h src/saveload.h src/savebuffer.h test/test.h test/util.h \ - test/write_tests.inc - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c89 -Isrc/ -o $@ -c test/test_write_api.c - -$(OBJDIR)/c89-util.o: test/util.c test/util.h - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c89 -Isrc/ -o $@ -c test/util.c - -cleanlibsc89: cleanobjectsc89 - $(RM) $(TMPDIR)/c89/$(SONAME) - $(RM) $(TMPDIR)/c89/$(ANAME) - -$(TMPDIR)/c89/$(SONAME): $(OBJDIR)/c89-fwrite.o $(OBJDIR)/c89-load.o $(OBJDIR)/c89-luabins.o $(OBJDIR)/c89-luainternals.o $(OBJDIR)/c89-lualess.o $(OBJDIR)/c89-save.o $(OBJDIR)/c89-savebuffer.o $(OBJDIR)/c89-write.o - $(MKDIR) $(TMPDIR)/c89 - $(LD) -o $@ $(OBJDIR)/c89-fwrite.o $(OBJDIR)/c89-load.o $(OBJDIR)/c89-luabins.o $(OBJDIR)/c89-luainternals.o $(OBJDIR)/c89-lualess.o $(OBJDIR)/c89-save.o $(OBJDIR)/c89-savebuffer.o $(OBJDIR)/c89-write.o $(LDFLAGS) $(SOFLAGS) - -$(TMPDIR)/c89/$(ANAME): $(OBJDIR)/c89-fwrite.o $(OBJDIR)/c89-load.o $(OBJDIR)/c89-luabins.o $(OBJDIR)/c89-luainternals.o $(OBJDIR)/c89-lualess.o $(OBJDIR)/c89-save.o $(OBJDIR)/c89-savebuffer.o $(OBJDIR)/c89-write.o - $(MKDIR) $(TMPDIR)/c89 - $(AR) $@ $(OBJDIR)/c89-fwrite.o $(OBJDIR)/c89-load.o $(OBJDIR)/c89-luabins.o $(OBJDIR)/c89-luainternals.o $(OBJDIR)/c89-lualess.o $(OBJDIR)/c89-save.o $(OBJDIR)/c89-savebuffer.o $(OBJDIR)/c89-write.o - $(RANLIB) $@ - -# objectsc89: - -cleanobjectsc89: - $(RM) $(OBJDIR)/c89-fwrite.o $(OBJDIR)/c89-load.o $(OBJDIR)/c89-luabins.o $(OBJDIR)/c89-luainternals.o $(OBJDIR)/c89-lualess.o $(OBJDIR)/c89-save.o $(OBJDIR)/c89-savebuffer.o $(OBJDIR)/c89-write.o - -$(OBJDIR)/c89-fwrite.o: src/fwrite.c src/luaheaders.h src/fwrite.h \ - src/saveload.h - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c89 -o $@ -c src/fwrite.c - -$(OBJDIR)/c89-load.o: src/load.c src/luaheaders.h src/luabins.h \ - src/saveload.h src/luainternals.h - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c89 -o $@ -c src/load.c - -$(OBJDIR)/c89-luabins.o: src/luabins.c src/luaheaders.h src/luabins.h - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c89 -o $@ -c src/luabins.c - -$(OBJDIR)/c89-luainternals.o: src/luainternals.c src/luainternals.h - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c89 -o $@ -c src/luainternals.c - -$(OBJDIR)/c89-lualess.o: src/lualess.c - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c89 -o $@ -c src/lualess.c - -$(OBJDIR)/c89-save.o: src/save.c src/luaheaders.h src/luabins.h \ - src/saveload.h src/savebuffer.h src/write.h - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c89 -o $@ -c src/save.c - -$(OBJDIR)/c89-savebuffer.o: src/savebuffer.c src/luaheaders.h \ - src/saveload.h src/savebuffer.h - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c89 -o $@ -c src/savebuffer.c - -$(OBJDIR)/c89-write.o: src/write.c src/luaheaders.h src/write.h \ - src/saveload.h src/savebuffer.h - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c89 -o $@ -c src/write.c - -## ----- Begin c99 ----- - -testc99: lua-testsc99 c-testsc99 - -lua-testsc99: $(TMPDIR)/c99/.luatestspassed - -c-testsc99: $(TMPDIR)/c99/.ctestspassed - -$(TMPDIR)/c99/.luatestspassed: $(TMPDIR)/c99/$(SONAME) test/$(TESTLUA) - $(ECHO) "===== Running Lua tests for c99 =====" - @$(LUA) \ - -e "package.cpath='$(TMPDIR)/c99/$(SONAME);'..package.cpath" \ - test/$(TESTLUA) - $(TOUCH) $(TMPDIR)/c99/.luatestspassed - $(ECHO) "===== Lua tests for c99 PASSED =====" - -$(TMPDIR)/c99/.ctestspassed: $(TMPDIR)/c99/$(TESTNAME) test/$(TESTLUA) - $(ECHO) "===== Running C tests for c99 =====" - $(TMPDIR)/c99/$(TESTNAME) - $(TOUCH) $(TMPDIR)/c99/.ctestspassed - $(ECHO) "===== C tests for c99 PASSED =====" - -$(TMPDIR)/c99/$(TESTNAME): $(OBJDIR)/c99-test.o $(OBJDIR)/c99-test_api.o $(OBJDIR)/c99-test_fwrite_api.o $(OBJDIR)/c99-test_savebuffer.o $(OBJDIR)/c99-test_write_api.o $(OBJDIR)/c99-util.o $(TMPDIR)/c99/$(ANAME) - $(MKDIR) $(TMPDIR)/c99 - $(LD) -o $@ $(OBJDIR)/c99-test.o $(OBJDIR)/c99-test_api.o $(OBJDIR)/c99-test_fwrite_api.o $(OBJDIR)/c99-test_savebuffer.o $(OBJDIR)/c99-test_write_api.o $(OBJDIR)/c99-util.o $(LDFLAGS) -lm -l$(LUALIB) -l$(PROJECTNAME) -L$(TMPDIR)/c99 - -resettestc99: - $(RM) $(TMPDIR)/c99/.luatestspassed - $(RM) $(TMPDIR)/c99/.ctestspassed - -cleantestc99: cleanlibsc99 resettestc99 \ - cleantestobjectsc99 - $(RM) $(TMPDIR)/c99/$(TESTNAME) - $(RMDIR) $(TMPDIR)/c99 - -# testobjectsc99: - -cleantestobjectsc99: - $(RM) $(OBJDIR)/c99-test.o $(OBJDIR)/c99-test_api.o $(OBJDIR)/c99-test_fwrite_api.o $(OBJDIR)/c99-test_savebuffer.o $(OBJDIR)/c99-test_write_api.o $(OBJDIR)/c99-util.o - -$(OBJDIR)/c99-test.o: test/test.c test/test.h - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c99 -Isrc/ -o $@ -c test/test.c - -$(OBJDIR)/c99-test_api.o: test/test_api.c src/luabins.h - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c99 -Isrc/ -o $@ -c test/test_api.c - -$(OBJDIR)/c99-test_fwrite_api.o: test/test_fwrite_api.c src/lualess.h \ - src/fwrite.h src/saveload.h test/test.h test/util.h \ - test/write_tests.inc - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c99 -Isrc/ -o $@ -c test/test_fwrite_api.c - -$(OBJDIR)/c99-test_savebuffer.o: test/test_savebuffer.c src/lualess.h \ - src/savebuffer.h test/test.h - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c99 -Isrc/ -o $@ -c test/test_savebuffer.c - -$(OBJDIR)/c99-test_write_api.o: test/test_write_api.c src/lualess.h \ - src/write.h src/saveload.h src/savebuffer.h test/test.h test/util.h \ - test/write_tests.inc - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c99 -Isrc/ -o $@ -c test/test_write_api.c - -$(OBJDIR)/c99-util.o: test/util.c test/util.h - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c99 -Isrc/ -o $@ -c test/util.c - -cleanlibsc99: cleanobjectsc99 - $(RM) $(TMPDIR)/c99/$(SONAME) - $(RM) $(TMPDIR)/c99/$(ANAME) - -$(TMPDIR)/c99/$(SONAME): $(OBJDIR)/c99-fwrite.o $(OBJDIR)/c99-load.o $(OBJDIR)/c99-luabins.o $(OBJDIR)/c99-luainternals.o $(OBJDIR)/c99-lualess.o $(OBJDIR)/c99-save.o $(OBJDIR)/c99-savebuffer.o $(OBJDIR)/c99-write.o - $(MKDIR) $(TMPDIR)/c99 - $(LD) -o $@ $(OBJDIR)/c99-fwrite.o $(OBJDIR)/c99-load.o $(OBJDIR)/c99-luabins.o $(OBJDIR)/c99-luainternals.o $(OBJDIR)/c99-lualess.o $(OBJDIR)/c99-save.o $(OBJDIR)/c99-savebuffer.o $(OBJDIR)/c99-write.o $(LDFLAGS) $(SOFLAGS) - -$(TMPDIR)/c99/$(ANAME): $(OBJDIR)/c99-fwrite.o $(OBJDIR)/c99-load.o $(OBJDIR)/c99-luabins.o $(OBJDIR)/c99-luainternals.o $(OBJDIR)/c99-lualess.o $(OBJDIR)/c99-save.o $(OBJDIR)/c99-savebuffer.o $(OBJDIR)/c99-write.o - $(MKDIR) $(TMPDIR)/c99 - $(AR) $@ $(OBJDIR)/c99-fwrite.o $(OBJDIR)/c99-load.o $(OBJDIR)/c99-luabins.o $(OBJDIR)/c99-luainternals.o $(OBJDIR)/c99-lualess.o $(OBJDIR)/c99-save.o $(OBJDIR)/c99-savebuffer.o $(OBJDIR)/c99-write.o - $(RANLIB) $@ - -# objectsc99: - -cleanobjectsc99: - $(RM) $(OBJDIR)/c99-fwrite.o $(OBJDIR)/c99-load.o $(OBJDIR)/c99-luabins.o $(OBJDIR)/c99-luainternals.o $(OBJDIR)/c99-lualess.o $(OBJDIR)/c99-save.o $(OBJDIR)/c99-savebuffer.o $(OBJDIR)/c99-write.o - -$(OBJDIR)/c99-fwrite.o: src/fwrite.c src/luaheaders.h src/fwrite.h \ - src/saveload.h - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c99 -o $@ -c src/fwrite.c - -$(OBJDIR)/c99-load.o: src/load.c src/luaheaders.h src/luabins.h \ - src/saveload.h src/luainternals.h - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c99 -o $@ -c src/load.c - -$(OBJDIR)/c99-luabins.o: src/luabins.c src/luaheaders.h src/luabins.h - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c99 -o $@ -c src/luabins.c - -$(OBJDIR)/c99-luainternals.o: src/luainternals.c src/luainternals.h - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c99 -o $@ -c src/luainternals.c - -$(OBJDIR)/c99-lualess.o: src/lualess.c - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c99 -o $@ -c src/lualess.c - -$(OBJDIR)/c99-save.o: src/save.c src/luaheaders.h src/luabins.h \ - src/saveload.h src/savebuffer.h src/write.h - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c99 -o $@ -c src/save.c - -$(OBJDIR)/c99-savebuffer.o: src/savebuffer.c src/luaheaders.h \ - src/saveload.h src/savebuffer.h - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c99 -o $@ -c src/savebuffer.c - -$(OBJDIR)/c99-write.o: src/write.c src/luaheaders.h src/write.h \ - src/saveload.h src/savebuffer.h - $(CC) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c -std=c99 -o $@ -c src/write.c - -## ----- Begin c++98 ----- - -testc++98: lua-testsc++98 c-testsc++98 - -lua-testsc++98: $(TMPDIR)/c++98/.luatestspassed - -c-testsc++98: $(TMPDIR)/c++98/.ctestspassed - -$(TMPDIR)/c++98/.luatestspassed: $(TMPDIR)/c++98/$(SONAME) test/$(TESTLUA) - $(ECHO) "===== Running Lua tests for c++98 =====" - @$(LUA) \ - -e "package.cpath='$(TMPDIR)/c++98/$(SONAME);'..package.cpath" \ - test/$(TESTLUA) - $(TOUCH) $(TMPDIR)/c++98/.luatestspassed - $(ECHO) "===== Lua tests for c++98 PASSED =====" - -$(TMPDIR)/c++98/.ctestspassed: $(TMPDIR)/c++98/$(TESTNAME) test/$(TESTLUA) - $(ECHO) "===== Running C tests for c++98 =====" - $(TMPDIR)/c++98/$(TESTNAME) - $(TOUCH) $(TMPDIR)/c++98/.ctestspassed - $(ECHO) "===== C tests for c++98 PASSED =====" - -$(TMPDIR)/c++98/$(TESTNAME): $(OBJDIR)/c++98-test.o $(OBJDIR)/c++98-test_api.o $(OBJDIR)/c++98-test_fwrite_api.o $(OBJDIR)/c++98-test_savebuffer.o $(OBJDIR)/c++98-test_write_api.o $(OBJDIR)/c++98-util.o $(TMPDIR)/c++98/$(ANAME) - $(MKDIR) $(TMPDIR)/c++98 - $(LDXX) -o $@ $(OBJDIR)/c++98-test.o $(OBJDIR)/c++98-test_api.o $(OBJDIR)/c++98-test_fwrite_api.o $(OBJDIR)/c++98-test_savebuffer.o $(OBJDIR)/c++98-test_write_api.o $(OBJDIR)/c++98-util.o $(LDFLAGS) -lm -l$(LUALIB) -l$(PROJECTNAME) -L$(TMPDIR)/c++98 - -resettestc++98: - $(RM) $(TMPDIR)/c++98/.luatestspassed - $(RM) $(TMPDIR)/c++98/.ctestspassed - -cleantestc++98: cleanlibsc++98 resettestc++98 \ - cleantestobjectsc++98 - $(RM) $(TMPDIR)/c++98/$(TESTNAME) - $(RMDIR) $(TMPDIR)/c++98 - -# testobjectsc++98: - -cleantestobjectsc++98: - $(RM) $(OBJDIR)/c++98-test.o $(OBJDIR)/c++98-test_api.o $(OBJDIR)/c++98-test_fwrite_api.o $(OBJDIR)/c++98-test_savebuffer.o $(OBJDIR)/c++98-test_write_api.o $(OBJDIR)/c++98-util.o - -$(OBJDIR)/c++98-test.o: test/test.c test/test.h - $(CXX) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c++ -std=c++98 -Isrc/ -o $@ -c test/test.c - -$(OBJDIR)/c++98-test_api.o: test/test_api.c src/luabins.h - $(CXX) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c++ -std=c++98 -Isrc/ -o $@ -c test/test_api.c - -$(OBJDIR)/c++98-test_fwrite_api.o: test/test_fwrite_api.c src/lualess.h \ - src/fwrite.h src/saveload.h test/test.h test/util.h \ - test/write_tests.inc - $(CXX) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c++ -std=c++98 -Isrc/ -o $@ -c test/test_fwrite_api.c - -$(OBJDIR)/c++98-test_savebuffer.o: test/test_savebuffer.c src/lualess.h \ - src/savebuffer.h test/test.h - $(CXX) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c++ -std=c++98 -Isrc/ -o $@ -c test/test_savebuffer.c - -$(OBJDIR)/c++98-test_write_api.o: test/test_write_api.c src/lualess.h \ - src/write.h src/saveload.h src/savebuffer.h test/test.h test/util.h \ - test/write_tests.inc - $(CXX) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c++ -std=c++98 -Isrc/ -o $@ -c test/test_write_api.c - -$(OBJDIR)/c++98-util.o: test/util.c test/util.h - $(CXX) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c++ -std=c++98 -Isrc/ -o $@ -c test/util.c - -cleanlibsc++98: cleanobjectsc++98 - $(RM) $(TMPDIR)/c++98/$(SONAME) - $(RM) $(TMPDIR)/c++98/$(ANAME) - -$(TMPDIR)/c++98/$(SONAME): $(OBJDIR)/c++98-fwrite.o $(OBJDIR)/c++98-load.o $(OBJDIR)/c++98-luabins.o $(OBJDIR)/c++98-luainternals.o $(OBJDIR)/c++98-lualess.o $(OBJDIR)/c++98-save.o $(OBJDIR)/c++98-savebuffer.o $(OBJDIR)/c++98-write.o - $(MKDIR) $(TMPDIR)/c++98 - $(LDXX) -o $@ $(OBJDIR)/c++98-fwrite.o $(OBJDIR)/c++98-load.o $(OBJDIR)/c++98-luabins.o $(OBJDIR)/c++98-luainternals.o $(OBJDIR)/c++98-lualess.o $(OBJDIR)/c++98-save.o $(OBJDIR)/c++98-savebuffer.o $(OBJDIR)/c++98-write.o $(LDFLAGS) $(SOFLAGS) - -$(TMPDIR)/c++98/$(ANAME): $(OBJDIR)/c++98-fwrite.o $(OBJDIR)/c++98-load.o $(OBJDIR)/c++98-luabins.o $(OBJDIR)/c++98-luainternals.o $(OBJDIR)/c++98-lualess.o $(OBJDIR)/c++98-save.o $(OBJDIR)/c++98-savebuffer.o $(OBJDIR)/c++98-write.o - $(MKDIR) $(TMPDIR)/c++98 - $(AR) $@ $(OBJDIR)/c++98-fwrite.o $(OBJDIR)/c++98-load.o $(OBJDIR)/c++98-luabins.o $(OBJDIR)/c++98-luainternals.o $(OBJDIR)/c++98-lualess.o $(OBJDIR)/c++98-save.o $(OBJDIR)/c++98-savebuffer.o $(OBJDIR)/c++98-write.o - $(RANLIB) $@ - -# objectsc++98: - -cleanobjectsc++98: - $(RM) $(OBJDIR)/c++98-fwrite.o $(OBJDIR)/c++98-load.o $(OBJDIR)/c++98-luabins.o $(OBJDIR)/c++98-luainternals.o $(OBJDIR)/c++98-lualess.o $(OBJDIR)/c++98-save.o $(OBJDIR)/c++98-savebuffer.o $(OBJDIR)/c++98-write.o - -$(OBJDIR)/c++98-fwrite.o: src/fwrite.c src/luaheaders.h src/fwrite.h \ - src/saveload.h - $(CXX) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c++ -std=c++98 -o $@ -c src/fwrite.c - -$(OBJDIR)/c++98-load.o: src/load.c src/luaheaders.h src/luabins.h \ - src/saveload.h src/luainternals.h - $(CXX) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c++ -std=c++98 -o $@ -c src/load.c - -$(OBJDIR)/c++98-luabins.o: src/luabins.c src/luaheaders.h src/luabins.h - $(CXX) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c++ -std=c++98 -o $@ -c src/luabins.c - -$(OBJDIR)/c++98-luainternals.o: src/luainternals.c src/luainternals.h - $(CXX) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c++ -std=c++98 -o $@ -c src/luainternals.c - -$(OBJDIR)/c++98-lualess.o: src/lualess.c - $(CXX) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c++ -std=c++98 -o $@ -c src/lualess.c - -$(OBJDIR)/c++98-save.o: src/save.c src/luaheaders.h src/luabins.h \ - src/saveload.h src/savebuffer.h src/write.h - $(CXX) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c++ -std=c++98 -o $@ -c src/save.c - -$(OBJDIR)/c++98-savebuffer.o: src/savebuffer.c src/luaheaders.h \ - src/saveload.h src/savebuffer.h - $(CXX) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c++ -std=c++98 -o $@ -c src/savebuffer.c - -$(OBJDIR)/c++98-write.o: src/write.c src/luaheaders.h src/write.h \ - src/saveload.h src/savebuffer.h - $(CXX) $(CFLAGS) -Werror -Wall -Wextra -pedantic -x c++ -std=c++98 -o $@ -c src/write.c - -## END OF GENERATED TARGETS ################################################### - -.PHONY: all clean install cleanlibs cleanobjects test resettest cleantest testc89 lua-testsc89 c-testsc89 resettestc89 cleantestc89 cleantestobjectsc89 cleanlibsc89 cleanobjectsc89 testc99 lua-testsc99 c-testsc99 resettestc99 cleantestc99 cleantestobjectsc99 cleanlibsc99 cleanobjectsc99 testc++98 lua-testsc++98 c-testsc++98 resettestc++98 cleantestc++98 cleantestobjectsc++98 cleanlibsc++98 cleanobjectsc++98 +include ../../Makefile.inc + +LIB = libluabins.a + +CXXFLAGS += -I../lua/src -DLUABINS_LUABUILTASCPP + +SRC = \ + src/fwrite.cpp \ + src/load.cpp \ + src/luabins.cpp \ + src/luainternals.cpp \ + src/save.cpp \ + src/savebuffer.cpp \ + src/write.cpp + +HEADER = \ + src/fwrite.h \ + src/luabins.h \ + src/luaheaders.h \ + src/luainternals.h \ + src/savebuffer.h \ + src/saveload.h \ + src/write.h + +EXTRA_DIST = \ + src/lualess.c \ + src/lualess.h \ + etc/benchmark.lua \ + etc/checkfmt.lua \ + etc/dataset.lua \ + etc/tolua.lua \ + etc/toluabins.lua \ + AUTHORS \ + COPYRIGHT \ + HISTORY \ + README.md \ + TODO + +include ../../Makefile.target +-include src/*.d diff --git a/vendor/luabins/etc/Makefile.luabins.template b/vendor/luabins/etc/Makefile.luabins.template deleted file mode 100644 index 77b76e80d..000000000 --- a/vendor/luabins/etc/Makefile.luabins.template +++ /dev/null @@ -1,242 +0,0 @@ -@{define:projectname:luabins} -@{define:test-dir:test/} -@{define:source-dir:src/} -@{define:sharedlib:$(LIBDIR)/$(SONAME)} -@{define:staticlib:$(LIBDIR)/$(ANAME)} -@{define-table:release-info: - {suffix=""; - libdir="$(LIBDIR)";objprefix="$(OBJDIR)/"; - cflags=""; - CC="$(CC)"; - LD="$(LD)"; - }; -} -@{define-table:std-info: - {suffix="c89"; - libdir="$(TMPDIR)/c89";objprefix="$(OBJDIR)/c89-"; - cflags="-Werror -Wall -Wextra -pedantic -x c -std=c89"; - CC="$(CC)"; - LD="$(LD)"; - }; - {suffix="c99"; - libdir="$(TMPDIR)/c99";objprefix="$(OBJDIR)/c99-"; - cflags="-Werror -Wall -Wextra -pedantic -x c -std=c99"; - CC="$(CC)"; - LD="$(LD)"; - }; - {suffix="c++98"; - libdir="$(TMPDIR)/c++98";objprefix="$(OBJDIR)/c++98-"; - cflags="-Werror -Wall -Wextra -pedantic -x c++ -std=c++98"; - CC="$(CXX)"; - LD="$(LDXX)"; - }; -} -@{define-dep:dep-objects:dep-template::@{source-dir}} -@{define-dep:test-dep-objects:test-dep-template:-I@{source-dir}:@{test-dir}} - -## CONFIGURATION ############################################################## - -ifeq ($(shell uname),Darwin) - LUA_DIR := /usr/local - LUA_LIBDIR := $(LUA_DIR)/lib/lua/5.1 - LUA_INCDIR := $(LUA_DIR)/include - LUALIB := lua -else - # Assuming Ubuntu - LUA_LIBDIR := /usr/lib - LUA_INCDIR := /usr/include/lua5.1 - LUALIB := lua5.1 -endif - -PROJECTNAME := @{projectname} - -SONAME := $(PROJECTNAME).so -ANAME := lib$(PROJECTNAME).a -HNAME := $(PROJECTNAME).h -TESTNAME := $(PROJECTNAME)-test -TESTLUA := test.lua - -LUA := lua -CP := cp -RM := rm -f -RMDIR := rm -df -MKDIR := mkdir -p -CC := gcc -LD := gcc -AR := ar rcu -RANLIB := ranlib -ECHO := @echo -TOUCH := touch - -# Needed for tests only -CXX := g++ -LDXX := g++ - -OBJDIR := ./obj -TMPDIR := ./tmp -INCDIR := ./include -LIBDIR := ./lib - -HFILE := $(INCDIR)/$(HNAME) - -CFLAGS += -O2 -Wall -I$(LUA_INCDIR) -LDFLAGS += -L$(LUA_LIBDIR) - -# Tested on OS X and Ubuntu -SOFLAGS := -ifeq ($(shell uname),Darwin) - SOFLAGS += -dynamiclib -undefined dynamic_lookup -else - CFLAGS += -fPIC - SOFLAGS += -shared - LDFLAGS += -ldl - RMDIR := rm -rf -endif - -CFLAGS += $(MYCFLAGS) -LDFLAGS += $(MYLDFLAGS) - -## MAIN TARGETS ############################################################### - -@{define-table:.PHONY:} - -@{insert:.PHONY:all} -all: @{sharedlib} @{staticlib} $(HFILE) - -@{insert:.PHONY:clean} -clean: cleanlibs cleantest - $(RM) $(HFILE) - -@{insert:.PHONY:install} -install: @{sharedlib} - # Note header and static library are not copied anywhere - $(CP) @{sharedlib} $(LUA_LIBDIR)/$(SONAME) - -$(HFILE): - $(CP) src/$(HNAME) $(HFILE) - -@{--:-------------------------------------------------------------------------} - -@{define:objects-macro: - -@{insert:.PHONY:clean%objects@{suffix}} -clean%objects@{suffix}: - $(RM) % - -% - -} - -@{define:lib-targets: - -@{define-fill:objects:@{fill-template:@{dep-objects}:}} - -@{insert:.PHONY:cleanlibs@{suffix}} -cleanlibs@{suffix}: cleanobjects@{suffix} - $(RM) @{sharedlib} - $(RM) @{staticlib} - -@{sharedlib}: @{objects} - $(MKDIR) @{libdir} - @{LD} -o $@ @{objects} $(LDFLAGS) $(SOFLAGS) - -@{staticlib}: @{objects} - $(MKDIR) @{libdir} - $(AR) $@ @{objects} - $(RANLIB) $@ - -@{--: note implicit objprefix parameter } -# objects@{suffix}: -@{fill-macro:objects-macro:%<>: - prefix="", - objects=@{lua-escape:@{objects}}; - dep=@{lua-escape:@{fill-template:dep-template:}}; -} - -} - -@{define:std-targets: - -## ----- Begin @{suffix} ----- - -@{define-fill:cflags-orig:@{cflags}} -@{define-fill:cflags:@{cflags} -I@{source-dir}} - -@{define-fill:sharedlib:@{libdir}/$(SONAME)} -@{define-fill:staticlib:@{libdir}/$(ANAME)} -@{define-fill:objects:@{fill-template:@{test-dep-objects}:}} - -@{insert:.PHONY:test@{suffix}} -test@{suffix}: lua-tests@{suffix} c-tests@{suffix} - -@{insert:.PHONY:lua-tests@{suffix}} -lua-tests@{suffix}: @{libdir}/.luatestspassed - -@{insert:.PHONY:c-tests@{suffix}} -c-tests@{suffix}: @{libdir}/.ctestspassed - -@{libdir}/.luatestspassed: @{sharedlib} test/$(TESTLUA) - $(ECHO) "===== Running Lua tests for @{suffix} =====" - @$(LUA) \ - -e "package.cpath='@{sharedlib};'..package.cpath" \ - test/$(TESTLUA) - $(TOUCH) @{libdir}/.luatestspassed - $(ECHO) "===== Lua tests for @{suffix} PASSED =====" - -@{libdir}/.ctestspassed: @{libdir}/$(TESTNAME) test/$(TESTLUA) - $(ECHO) "===== Running C tests for @{suffix} =====" - @{libdir}/$(TESTNAME) - $(TOUCH) @{libdir}/.ctestspassed - $(ECHO) "===== C tests for @{suffix} PASSED =====" - -@{libdir}/$(TESTNAME): @{objects} @{staticlib} - $(MKDIR) @{libdir} - @{LD} -o $@ @{objects} $(LDFLAGS) -lm -l$(LUALIB) -l$(PROJECTNAME) -L@{libdir} - -@{insert:.PHONY:resettest@{suffix}} -resettest@{suffix}: - $(RM) @{libdir}/.luatestspassed - $(RM) @{libdir}/.ctestspassed - -@{insert:.PHONY:cleantest@{suffix}} -cleantest@{suffix}: cleanlibs@{suffix} resettest@{suffix} \ - cleantestobjects@{suffix} - $(RM) @{libdir}/$(TESTNAME) - $(RMDIR) @{libdir} - -@{--: Note implicit objprefix parameter } -# testobjects@{suffix}: -@{fill-macro:objects-macro:%<>: - prefix="test", - objects=@{lua-escape:@{objects}}; - dep=@{lua-escape:@{fill-template:test-dep-template:}}; -} - -@{--: Libraries must use original cflags } -@{fill-template:lib-targets:cflags=@{lua-escape:@{cflags-orig}}} - -} - -## GENERATED RELEASE TARGETS ################################################## - -@{map-template:release-info:lib-targets} - -## TEST TARGETS ############################################################### - -@{insert:.PHONY:test} -test:@{map-template:std-info: test@{suffix}} - $(ECHO) "===== TESTS PASSED =====" - -@{insert:.PHONY:resettest} -resettest:@{map-template:std-info: resettest@{suffix}} - -@{insert:.PHONY:cleantest} -cleantest:@{map-template:std-info: cleantest@{suffix}} - -## GENERATED TEST TARGETS ##################################################### - -@{map-template:std-info:std-targets} - -## END OF GENERATED TARGETS ################################################### - -.PHONY: @{concat:.PHONY: } diff --git a/vendor/luabins/etc/genmakefile.sh b/vendor/luabins/etc/genmakefile.sh deleted file mode 100755 index 45244e442..000000000 --- a/vendor/luabins/etc/genmakefile.sh +++ /dev/null @@ -1,2 +0,0 @@ -#! /bin/bash -lua ~/projects/genmakefile/src/genmakefile.lua Makefile diff --git a/vendor/luabins/src/fwrite.c b/vendor/luabins/src/fwrite.cpp similarity index 100% rename from vendor/luabins/src/fwrite.c rename to vendor/luabins/src/fwrite.cpp diff --git a/vendor/luabins/src/load.c b/vendor/luabins/src/load.cpp similarity index 100% rename from vendor/luabins/src/load.c rename to vendor/luabins/src/load.cpp diff --git a/vendor/luabins/src/luabins.c b/vendor/luabins/src/luabins.cpp similarity index 100% rename from vendor/luabins/src/luabins.c rename to vendor/luabins/src/luabins.cpp diff --git a/vendor/luabins/src/luainternals.c b/vendor/luabins/src/luainternals.cpp similarity index 100% rename from vendor/luabins/src/luainternals.c rename to vendor/luabins/src/luainternals.cpp diff --git a/vendor/luabins/src/save.c b/vendor/luabins/src/save.cpp similarity index 100% rename from vendor/luabins/src/save.c rename to vendor/luabins/src/save.cpp diff --git a/vendor/luabins/src/savebuffer.c b/vendor/luabins/src/savebuffer.cpp similarity index 100% rename from vendor/luabins/src/savebuffer.c rename to vendor/luabins/src/savebuffer.cpp diff --git a/vendor/luabins/src/write.c b/vendor/luabins/src/write.cpp similarity index 100% rename from vendor/luabins/src/write.c rename to vendor/luabins/src/write.cpp