# # # rename "tester.lua" # to "testlib.lua" # # patch "Makefile.am" # from [8fe8566c971bf67be3d1b1739dc69404a55f1e35] # to [ecc00e0b8e9b5350157a1922e430ade4508d31bd] # # patch "database.cc" # from [3a4df9126b98bf1a5e863f32cc8cb83357d39ee2] # to [4e7fc712cb49d0e87413ee46797b07ce53c286af] # # patch "lua_hooks.cc" # from [10b40cfc6a783fb5e80f7221d15a72918e475bcf] # to [63fe915d3ab06723dd4f5efcdc1ef72c17fbd2eb] # # patch "tester.cc" # from [775277ecee57590d0124a8d04f94452668ca34e0] # to [f6d1c48885f8231c79e40e3bd0b0041d84c983f9] # ============================================================ --- Makefile.am 8fe8566c971bf67be3d1b1739dc69404a55f1e35 +++ Makefile.am ecc00e0b8e9b5350157a1922e430ade4508d31bd @@ -294,9 +294,12 @@ mtn_SOURCES = $(MOST_SOURCES) monotone.c EXTRA_PROGRAMS = usher mtn_SOURCES = $(MOST_SOURCES) monotone.cc +nodist_mtn_SOURCES = std_hooks.c schema.c usher_SOURCES = contrib/usher.cc unit_tests_SOURCES = $(MOST_SOURCES) unit_tests.cc crypto_tests.cc +nodist_unit_tests_SOURCES = std_hooks.c test_hooks.c schema.c tester_SOURCES = $(SANITY_CORE_SOURCES) $(LUAEXT_SOURCES) tester.cc +nodist_tester_SOURCES = testlib.c txt2c_SOURCES = txt2c.cc @@ -426,7 +429,7 @@ EXTRA_DIST = $(PDF_FIGURES) $(PNG_FIGURE info_TEXINFOS = monotone.texi EXTRA_DIST = $(PDF_FIGURES) $(PNG_FIGURES) INSTALL \ README.changesets UPGRADE monotone.spec monotone.html \ - texinfo.css schema.sql std_hooks.lua test_hooks.lua tester.lua \ + texinfo.css schema.sql std_hooks.lua test_hooks.lua testlib.lua \ testsuite.lua $(srcdir)/tests tester-testsuite.lua \ $(srcdir)/tester-tests package.m4 package_revision.txt \ package_full_revision_dist.txt $(wildcard $(srcdir)/m4/*.m4) \ @@ -540,34 +543,44 @@ run_tester_tests: Makefile echo 'exec $(top_builddir)/tester $(srcdir)/tester-testsuite.lua "$$@"' >> $@ ; \ chmod 755 $@ -# we generate some headers to copy data into the executable +# we generate some source files to copy data into the executable +# note that the only things that should go in BUILT_SOURCES are things +# that need to be generated early on 'make all'; this is _not_ true of +# generated source files, but it is true for the PCH if used. -BUILT_SOURCES_CLEAN = std_hooks.h test_hooks.h tester.h schema.h \ +CLEAN_SOURCES = std_hooks.c test_hooks.c testlib.c schema.c \ package_revision.c package_full_revision.txt \ - package_full_revision_raw.txt package_full_revision.c \ - $(PCH_FILE) $(PCH_BUILD) -BUILT_SOURCES_NOCLEAN = package_revision.txt package_full_revision_dist.txt -BUILT_SOURCES = $(BUILT_SOURCES_CLEAN) $(BUILT_SOURCES_NOCLEAN) -CLEANFILES = $(BUILT_SOURCES_CLEAN) $(EPS_FIGURES) + package_full_revision_raw.txt package_full_revision.c -txt2c: txt2c.cc Makefile +BUILT_SOURCES = $(PCH_FILE) $(PCH_BUILD) + +CLEANFILES = $(BUILT_SOURCES) $(CLEAN_SOURCES) $(EPS_FIGURES) + +txt2c: txt2c.cc $(CXX) $(CXXFLAGS) -o $@ $< chmod 0755 address@hidden(EXEEXT) -.PHONY: apidocs -apidocs: - doxygen doxygen.cfg +# FIXME: should use stamp files. +%.c: %.sql txt2c + ./txt2c $(TXT2CFLAGS) --no-static $< $(*F) >address@hidden + cmp -s address@hidden $@ || mv -f address@hidden $@ + rm -f address@hidden -%.h: %.sql txt2c Makefile - ./txt2c $< $(*F) >address@hidden +%.c: %.lua txt2c + ./txt2c $(TXT2CFLAGS) --no-static $< $(*F) >address@hidden cmp -s address@hidden $@ || mv -f address@hidden $@ rm -f address@hidden -%.h: %.lua txt2c Makefile - ./txt2c $< $(*F) >address@hidden +%.c: %.txt txt2c + ./txt2c $(TXT2CFLAGS) --no-static $< $(*F) >address@hidden cmp -s address@hidden $@ || mv -f address@hidden $@ rm -f address@hidden +# This construct causes --strip-trailing to be applied only when +# generating package_revision.c. +TXT2CFLAGS = +package_revision.c : TXT2CFLAGS = --strip-trailing + # This is phony, so that we always try to rebuild it. If it succeeds # in calculating changes, it produces its target; otherwise, its # target does not exist. @@ -585,10 +598,6 @@ package_revision.txt: package_revision_r cp $< $@; \ fi [ -f $@ ] || echo "unknown" > $@ -package_revision.c: package_revision.txt txt2c Makefile - ./txt2c --strip-trailing --no-static $< package_revision >address@hidden - cmp -s address@hidden $@ || mv -f address@hidden $@ - rm -f address@hidden # To avoid a dependency loop here, what we do is: # calculate changes @@ -626,10 +635,6 @@ package_full_revision.txt: package_full_ package_full_revision.txt: package_full_revision_raw.txt package_full_revision_dist.txt rm -f $@ for SRC in $^; do ([ -f $$SRC -a ! -f $@ ] && cp -f $$SRC $@) || true; done -package_full_revision.c: package_full_revision.txt txt2c Makefile - ./txt2c --no-static $< package_full_revision >address@hidden - cmp -s address@hidden $@ || mv -f address@hidden $@ - rm -f address@hidden # This is a magic directive copy-and-pasted, then modified, from the # automake 1.9 manual, section 13.4, "Checking the distribution". @@ -650,6 +655,10 @@ CHECK_SRCDIR_EQ_BUILDDIR=[ "`cd \"$(srcd CHECK_SRCDIR_EQ_BUILDDIR=[ "`cd \"$(srcdir)\"; pwd`" = "`pwd`" -a -f ./monotone.texi ] +.PHONY: apidocs +apidocs: + doxygen doxygen.cfg + monotone.html: monotone.texi version.texi std_hooks.lua texinfo.css if $(CHECK_SRCDIR_EQ_BUILDDIR); then :; else \ cp -r $(srcdir)/figures .; \ @@ -673,10 +682,3 @@ html: monotone.texi version.texi std_hoo sed -e 's,,,' $$f.bak >$$f; \ rm -f $$f.bak; \ done - -# Explicit dependencies of object files on generated headers, so Make -# knows it has to build 'em. -mtn-lua_hooks.o unit_tests-lua_hooks.o : test_hooks.h std_hooks.h -mtn-database.o unit_tests-database.o : schema.h - -tester.o : tester.h ============================================================ --- database.cc 3a4df9126b98bf1a5e863f32cc8cb83357d39ee2 +++ database.cc 4e7fc712cb49d0e87413ee46797b07ce53c286af @@ -45,8 +45,8 @@ #include "roster_delta.hh" #include "rev_height.hh" -// defined in schema.sql, converted to header: -#include "schema.h" +// defined in schema.c, generated from schema.sql: +extern char const schema_constant[]; // this file defines a public, typed interface to the database. // the database class encapsulates all knowledge about sqlite, ============================================================ --- lua_hooks.cc 10b40cfc6a783fb5e80f7221d15a72918e475bcf +++ lua_hooks.cc 63fe915d3ab06723dd4f5efcdc1ef72c17fbd2eb @@ -32,9 +32,11 @@ #include "paths.hh" #include "uri.hh" -// defined in {std,test}_hooks.lua, converted -#include "test_hooks.h" -#include "std_hooks.h" +// defined in {std,test}_hooks.lua, converted to {std,test}_hooks.c respectively +extern char const std_hooks_constant[]; +#ifdef BUILD_UNIT_TESTS +extern char const test_hooks_constant[]; +#endif using std::make_pair; using std::map; ============================================================ --- tester.cc 775277ecee57590d0124a8d04f94452668ca34e0 +++ tester.cc f6d1c48885f8231c79e40e3bd0b0041d84c983f9 @@ -1,9 +1,8 @@ #include "lua.h" #include "lualib.h" #include "lauxlib.h" #include "lua.hh" -#include "tester.h" #include "platform.hh" #include "sanity.hh" @@ -22,6 +21,9 @@ #include #include +// defined in testlib.c, generated from testlib.lua +extern char const testlib_constant[]; + namespace fs = boost::filesystem; using std::string; @@ -541,7 +543,7 @@ int main(int argc, char **argv) try { - run_string(st, tester_constant, "tester builtin functions"); + run_string(st, testlib_constant, "tester builtin functions"); //printf("Loading test file %s\n", testfile.c_str()); run_file(st, testfile); Lua ll(st);