From: Thomas Walker Lynch Date: Sat, 6 Apr 2019 15:10:49 +0000 (+0200) Subject: adds 'setup' target to the top level makefile X-Git-Url: https://git.reasoningtechnology.com/style/static/gitweb.js?a=commitdiff_plain;h=61b1cc95290e191d8ac1a9d78064fe04d0a27e95;p=subu adds 'setup' target to the top level makefile --- diff --git a/makefile b/makefile index 287b43b..25325da 100755 --- a/makefile +++ b/makefile @@ -1,31 +1,47 @@ +# nice idea, but the modules have to be made in the correct order, perhpas run this to check the module list +# MAKEABLE= $(shell find module tool -name 'makefile' | grep -v deprecated) + +CLEANABLE=\ + module/da\ + module/da/test\ + module/tranche\ + module/debug\ + module/dispatch\ + module/subu-0 + MAKEABLE=\ - module/da\ - module/da/test\ - module/debug\ - module/tranche\ - module/dispatch\ - module/subu-0 + module/da\ + module/da/test\ + module/tranche\ + module/debug\ + module/dispatch\ + module/subu-0 + .PHONY: all all: - for dir in $(MAKEABLE); do pushd $$dir; make dist-clean dep lib exec share; popd; done + for dir in $(MAKEABLE); do make -C $$dir dist-clean dep lib exec share || true; done + +.PHONY: info +info: + @echo "MAKEABLE:" $(MAKEABLE) + +.PHONY: setup +setup: + for dir in $(MAKEABLE); do make -C $$dir setup || true; done .PHONY: dep dep: - for dir in $(MAKEABLE); do pushd $$dir; make dep; popd; done + for dir in $(MAKEABLE); do make -C $$dir dep || true; done .PHONY: update update: - for dir in $(MAKEABLE); do pushd $$dir; make lib exec share; popd; done - -.PHONY: info -info: - @echo "MAKEABLE:" $(MAKEABLE) + for dir in $(MAKEABLE); do make -C $$dir lib exec share || true; done .PHONY: clean clean: - for dir in $(MAKEABLE); do pushd $$dir; make clean; popd; done + for dir in $(CLEANABLE); do make -C $$dir clean || true; done .PHONY: dist-clean dist-clean : clean diff --git a/module/da/lib/libda.a b/module/da/lib/libda.a index a535373..71502f7 100644 Binary files a/module/da/lib/libda.a and b/module/da/lib/libda.a differ diff --git a/module/da/test/lib/libtest.a b/module/da/test/lib/libtest.a index 7081270..a392e1c 100644 Binary files a/module/da/test/lib/libtest.a and b/module/da/test/lib/libtest.a differ diff --git a/module/debug/lib/libdebug.a b/module/debug/lib/libdebug.a index 05415b9..1bc7b39 100644 Binary files a/module/debug/lib/libdebug.a and b/module/debug/lib/libdebug.a differ diff --git a/module/dispatch/lib/libdispatch.a b/module/dispatch/lib/libdispatch.a index 54ca624..855faa5 100644 Binary files a/module/dispatch/lib/libdispatch.a and b/module/dispatch/lib/libdispatch.a differ diff --git a/module/share/include/da.h b/module/share/include/da.h index 52ffb4e..8195c4a 100644 --- a/module/share/include/da.h +++ b/module/share/include/da.h @@ -4,7 +4,7 @@ #include #include -typedef struct{ +typedef struct Da{ char *base; char *end; // one byte/one element off the end of the array size_t size; // size >= (end - base) + 1; diff --git a/module/share/include/subu.h b/module/share/include/subu.h index 683ddb3..5a82782 100644 --- a/module/share/include/subu.h +++ b/module/share/include/subu.h @@ -20,6 +20,7 @@ Each of these returns SQLITE_OK upon success */ + #include #include int db_begin(sqlite3 *db); int db_commit(sqlite3 *db); diff --git a/module/subu-0/doc/to_do.txt b/module/subu-0/doc/to_do.txt deleted file mode 100644 index 0b989cc..0000000 --- a/module/subu-0/doc/to_do.txt +++ /dev/null @@ -1,38 +0,0 @@ -2019-02-05T23:14:40Z - error can cause subu-mk-0 to leave the creating of a subu in an intermediate - state. Rather than bailing on some of the errors we need to clean up instead. - Perhaps the yet to be written subu-rm program will be resilent enough to do - more general cleanup. - -2019-02-23T18:56:31Z - need to modify subu-init to take a configuration file name argument instead of - using a global variabel value. might want to add arguments to other subu - commands also - -2019-03-11T13:48:03Z - in subu.lib.c append cascading rmdir failure mess to useradd failure mess - -2019-03-11T13:48:03Z - want to add subu-type to masteru_subu(), I imagine there will be static, - permanent, and temporary subu types. - -2019-03-12T18:35:06Z - the masteru subu relation should contain the uid of the masteru as - well as the backup type for the subu: git, rdiff, rsync, none. - and the persisitance fo the subu: indefinite, session. - seems that operations need to be logged, in case the db is lost - the transcript can be played back. It should also be possible - to co-opt an existing user as a subu, though, would require - sudo privs. - - need to add messages for subu errors I've added to the end of - the list in subu.lib.c - -2019-03-14T10:43:50Z - - should mod all to he subudb routines to return a message, probably - strdup(sqlite_errmsg(db)), then the callers to these routines can just pass - mess in rather than making up new ones for each situation. The error code - probably already carries the contexts specific message. Or perhaps add - a string cat function for message strings, that would run through a stream - and free the originals. diff --git a/module/subu-0/doc/todo.txt b/module/subu-0/doc/todo.txt new file mode 100644 index 0000000..3631ba1 --- /dev/null +++ b/module/subu-0/doc/todo.txt @@ -0,0 +1,41 @@ +2019-02-05T23:14:40Z + error can cause subu-mk-0 to leave the creating of a subu in an intermediate + state. Rather than bailing on some of the errors we need to clean up instead. + Perhaps the yet to be written subu-rm program will be resilent enough to do + more general cleanup. + +2019-02-23T18:56:31Z + need to modify subu-init to take a configuration file name argument instead of + using a global variabel value. might want to add arguments to other subu + commands also + +2019-03-11T13:48:03Z + in subu.lib.c append cascading rmdir failure mess to useradd failure mess + +2019-03-11T13:48:03Z + want to add subu-type to masteru_subu(), I imagine there will be static, + permanent, and temporary subu types. + +2019-03-12T18:35:06Z + the masteru subu relation should contain the uid of the masteru as + well as the backup type for the subu: git, rdiff, rsync, none. + and the persisitance fo the subu: indefinite, session. + seems that operations need to be logged, in case the db is lost + the transcript can be played back. It should also be possible + to co-opt an existing user as a subu, though, would require + sudo privs. + + need to add messages for subu errors I've added to the end of + the list in subu.lib.c + +2019-03-14T10:43:50Z + + should mod all to he subudb routines to return a message, probably + strdup(sqlite_errmsg(db)), then the callers to these routines can just pass + mess in rather than making up new ones for each situation. The error code + probably already carries the contexts specific message. Or perhaps add + a string cat function for message strings, that would run through a stream + and free the originals. + +2019-04-02T19:24:03Z + Really need to add a transcript to help recover if there are any problems. diff --git a/module/subu-0/exec/subu-bind b/module/subu-0/exec/subu-bind index 3c27383..6e4b6fd 100755 Binary files a/module/subu-0/exec/subu-bind and b/module/subu-0/exec/subu-bind differ diff --git a/module/subu-0/exec/subu-bind-all b/module/subu-0/exec/subu-bind-all index d6bf08c..5d29017 100755 Binary files a/module/subu-0/exec/subu-bind-all and b/module/subu-0/exec/subu-bind-all differ diff --git a/module/subu-0/exec/subu-mk-0 b/module/subu-0/exec/subu-mk-0 index 4fdf004..0889e0e 100755 Binary files a/module/subu-0/exec/subu-mk-0 and b/module/subu-0/exec/subu-mk-0 differ diff --git a/module/subu-0/exec/subu-rm-0 b/module/subu-0/exec/subu-rm-0 index 2d6c42e..f68421d 100755 Binary files a/module/subu-0/exec/subu-rm-0 and b/module/subu-0/exec/subu-rm-0 differ diff --git a/module/subu-0/exec/subudb-init b/module/subu-0/exec/subudb-init index b389cea..6d26441 100755 Binary files a/module/subu-0/exec/subudb-init and b/module/subu-0/exec/subudb-init differ diff --git a/module/subu-0/exec/subudb-number b/module/subu-0/exec/subudb-number index a0ba2c9..dd78319 100755 Binary files a/module/subu-0/exec/subudb-number and b/module/subu-0/exec/subudb-number differ diff --git a/module/subu-0/exec/subudb-rel-get b/module/subu-0/exec/subudb-rel-get index 8d5bf37..7093dab 100755 Binary files a/module/subu-0/exec/subudb-rel-get and b/module/subu-0/exec/subudb-rel-get differ diff --git a/module/subu-0/exec/subudb-rel-put b/module/subu-0/exec/subudb-rel-put index 76667e2..4ddb70f 100755 Binary files a/module/subu-0/exec/subudb-rel-put and b/module/subu-0/exec/subudb-rel-put differ diff --git a/module/subu-0/exec/subudb-rel-rm b/module/subu-0/exec/subudb-rel-rm index cd64ce9..4284dcb 100755 Binary files a/module/subu-0/exec/subudb-rel-rm and b/module/subu-0/exec/subudb-rel-rm differ diff --git a/module/subu-0/exec/subudb-subus b/module/subu-0/exec/subudb-subus index 2abcd16..8a2a01b 100755 Binary files a/module/subu-0/exec/subudb-subus and b/module/subu-0/exec/subudb-subus differ diff --git a/module/subu-0/lib/libsubu-0.a b/module/subu-0/lib/libsubu-0.a index 63f4e5b..e7658a7 100644 Binary files a/module/subu-0/lib/libsubu-0.a and b/module/subu-0/lib/libsubu-0.a differ diff --git a/module/subu-0/test/0_makefile b/module/subu-0/test/0_makefile deleted file mode 100644 index c16998b..0000000 --- a/module/subu-0/test/0_makefile +++ /dev/null @@ -1,32 +0,0 @@ -# src/1_tests/0_makefile - -SHELL=/bin/bash - --include 0_makefile_flags - -MAKE=/usr/bin/make -f $(PROJECT_SUBU)/tools/lib/makefile-cc - -SOURCES=$(wildcard *.c) -HFILES=$(wildcard *.h) - -all: version deps lib execs - -deps: - makeheaders $(SOURCES) $(HFILES) - sed -i '/^ *int *main *(.*)/d' *.h - $(MAKE) $@ - -clean: - $(MAKE) $@ - for i in $(HFILES); do rm $$i; done - -dist-clean: - $(MAKE) $@ - if [ -f subudb ]; then rm subudb; fi - -%:: - $(MAKE) $@ - - - - diff --git a/module/subu-0/test/0_makefile_flags b/module/subu-0/test/0_makefile_flags deleted file mode 100644 index bc6bd25..0000000 --- a/module/subu-0/test/0_makefile_flags +++ /dev/null @@ -1,31 +0,0 @@ - -# some versions of Linux need a -e option others complain if there is a -e .. and it isn't the binary for echo .. -ECHO= echo -#ECHO= echo -e - -# directories used by this makefile, these could all be set to dot for -# the simplest source directory structure - -#LIDBIR, EXECSDIR, HDIR hold the make results that might later be shared -#$(PWD) is the directory that make was called from, this is already build in -#set to dot to use the same directory as the source code -#leave blank to ommit -DEPRDIR= -DOCDIR= -EXECSDIR=. -HDIR=. -LIBDIR=. -TESTDIR=. -TMPDIR=1_tmp -TOOLSDIR=$(realpath $(PROJECT_SUBU)/tools) -TRYDIR= - - -# compiler and flags -CC=gcc -CFLAGS=-std=gnu11 -fPIC -I. -ggdb -Werror -DDEBUG -DDEBUGDB -#CFLAGS=-std=gnu11 -fPIC -I. -Werror -LINKFLAGS=-L$(PROJECT_SUBU)/src/$(LIBDIR) -L. -lsubu -lsqlite3 -lsubutests - -LIBFILE=$(LIBDIR)/libtests.a - diff --git a/module/subu-0/test/1_tmp/makefile_deps b/module/subu-0/test/1_tmp/makefile_deps deleted file mode 100644 index 9486ae8..0000000 --- a/module/subu-0/test/1_tmp/makefile_deps +++ /dev/null @@ -1,4 +0,0 @@ -da.cli.o: da.cli.c da.cli.h - -./da : da.cli.o ./libtests.a - gcc -o ./da da.cli.o -L/home/morpheus/subu_land/subu/src/. -L. -lsubu -lsqlite3 -lsubutests diff --git a/module/subu-0/test/da.cli.c b/module/subu-0/test/da.cli.c deleted file mode 100644 index 910a15e..0000000 --- a/module/subu-0/test/da.cli.c +++ /dev/null @@ -1,50 +0,0 @@ -/* -Tests for da. - -*/ - -#include -#include - -int test_da_0(){ - da da0; - da_alloc(&da0, sizeof(int)); // leaves room for 4 ints - int i = 0; - int *pt = da0->base; - // will double, 4 -> 8, then double 8 -> 16 - while( i < 10 ){ - if(da_boundq(&da0, pt)){ - char *old_base = da_expand(&da); - da_rebase(&da, old_base, pt); - } - *pt = i; - i++; - pt++; - } - - bool f0 = da.size == sizof(int) * 16; - bool f1 = 10 == (da.end - da.base) / sizeof(int); - bool f2 = true; - pt = da0->base; - while( i < 10 ){ - f2 = f2 && *pt == i && !da_endq(&da, pt); - i++; - pt++; - } - bool f3 = da_endq(&da, pt); - - return f0 && f1 && f2 && f3; -} - - -int main(){ - - bool da_0_passed = test_da_0(); - if( da_0_passed ){ - printf("da_0_passed"); - return 0; - } - printf("da_0_failed"); - return 1; - -} diff --git a/module/subu-0/test/libtests.a b/module/subu-0/test/libtests.a deleted file mode 100644 index 8b277f0..0000000 --- a/module/subu-0/test/libtests.a +++ /dev/null @@ -1 +0,0 @@ -! diff --git a/module/subu-0/try/makefile b/module/subu-0/try/makefile deleted file mode 100644 index 400ec02..0000000 --- a/module/subu-0/try/makefile +++ /dev/null @@ -1,11 +0,0 @@ - - -a b c: - echo $@ - -x y z: - echo $@ - -e f g: x y z - echo $^ - diff --git a/module/subu-0/try/multiple-makefile-targets/makefile b/module/subu-0/try/multiple-makefile-targets/makefile new file mode 100644 index 0000000..400ec02 --- /dev/null +++ b/module/subu-0/try/multiple-makefile-targets/makefile @@ -0,0 +1,11 @@ + + +a b c: + echo $@ + +x y z: + echo $@ + +e f g: x y z + echo $^ + diff --git a/module/subu-0/try/split.c b/module/subu-0/try/split.c deleted file mode 100644 index 6d4c6ac..0000000 --- a/module/subu-0/try/split.c +++ /dev/null @@ -1,20 +0,0 @@ -/* -Using preprocessor to make header file? - -gcc -E split.c -DPROTOTYPE - -Outputs source code source comment lines starting with a hash. Resolves all macro commands, -hence the resulting header can not have macro commands. - - */ - -#if PROTOTYPE -##define GREATNESS 21 -int f(int x); -#endif - -#if IMPLEMENTATION -int f(int x){ - return x; -} -#endif diff --git a/module/subu-0/try/split_arg.c b/module/subu-0/try/split_arg.c deleted file mode 100644 index 6d4c6ac..0000000 --- a/module/subu-0/try/split_arg.c +++ /dev/null @@ -1,20 +0,0 @@ -/* -Using preprocessor to make header file? - -gcc -E split.c -DPROTOTYPE - -Outputs source code source comment lines starting with a hash. Resolves all macro commands, -hence the resulting header can not have macro commands. - - */ - -#if PROTOTYPE -##define GREATNESS 21 -int f(int x); -#endif - -#if IMPLEMENTATION -int f(int x){ - return x; -} -#endif diff --git a/module/subu-0/try/subudb b/module/subu-0/try/subudb deleted file mode 100644 index e69de29..0000000 diff --git a/module/subu-0/try/voidptr.c b/module/subu-0/try/voidptr.c index bd9c3e5..383e9e3 100644 --- a/module/subu-0/try/voidptr.c +++ b/module/subu-0/try/voidptr.c @@ -1,6 +1,6 @@ /* They say a cast is not required passing a typed pointer to a void * argument, -but What about void **? +but What about void **? .. oop then it matters. gcc -std=gnu11 -o voidptr voidptr.c voidptr.c: In function ‘main’: diff --git a/module/tranche/lib/libtranche.a b/module/tranche/lib/libtranche.a index ceba37a..33d8840 100644 Binary files a/module/tranche/lib/libtranche.a and b/module/tranche/lib/libtranche.a differ diff --git a/module/tranche/makefile b/module/tranche/makefile index e80a0d9..9f66b5c 100644 --- a/module/tranche/makefile +++ b/module/tranche/makefile @@ -25,6 +25,10 @@ exec: .PHONY: share share: + @echo "instead of share, the 'install' target will put the execs in tools/bin" + +.PHONY: install +install: if [ -d $(EXECDIR) ]; then if [ ! -z "$(wildcard $(EXECDIR)/*)" ]; then cp $(EXECDIR)/* $(PROJECT_SUBU)/tool/bin; fi; fi %:: diff --git a/temp b/temp deleted file mode 100644 index 10ac0e2..0000000 --- a/temp +++ /dev/null @@ -1,23 +0,0 @@ -./tool/lib/makefile_cc: @echo "TOOLSDIR: " $(TOOLSDIR) -./module/db/0_makefile:SUID_TOOL=$(TOOLSDIR)/bin/setuid_root.sh -./module/db/0_makefile: @echo "SUID_TOOL: " $(SUID_TOOL) -./module/db/0_makefile: @echo "-> $(SUID_TOOL) $(EXECSDIR)/subu-mk-0 $(EXECSDIR)/subu-rm-0 $(EXECSDIR)/subu-bind-all" -./module/db/0_makefile: cat $(SUID_TOOL) -./module/db/0_makefile: sudo $(SUID_TOOL) $(EXECSDIR)/subu-mk-0 $(EXECSDIR)/subu-rm-0 $(EXECSDIR)/subu-bind-all -./module/db/0_makefile-flags:TOOLSDIR=$(realpath $(PROJECT_SUBU)/tools) -./module/subu-0/1_tests/0_makefile_flags:TOOLSDIR=$(realpath $(PROJECT_SUBU)/tools) -./module/subu-0/0_makefile:SUID_TOOL=$(TOOLSDIR)/bin/setuid_root.sh -./module/subu-0/0_makefile: @echo "SUID_TOOL: " $(SUID_TOOL) -./module/subu-0/0_makefile: @echo "-> $(SUID_TOOL) $(EXECSDIR)/subu-mk-0 $(EXECSDIR)/subu-rm-0 $(EXECSDIR)/subu-bind-all" -./module/subu-0/0_makefile: cat $(SUID_TOOL) -./module/subu-0/0_makefile: sudo $(SUID_TOOL) $(EXECSDIR)/subu-mk-0 $(EXECSDIR)/subu-rm-0 $(EXECSDIR)/subu-bind-all -./module/subu-0/0_makefile-flags:TOOLSDIR=$(realpath $(PROJECT_SUBU)/tools) -./module/tranche/deprecated/0_makefile:SUID_TOOL=$(TOOLSDIR)/bin/setuid_root.sh -./module/tranche/deprecated/0_makefile: @echo "SUID_TOOL: " $(SUID_TOOL) -./module/tranche/deprecated/0_makefile: @echo "-> $(SUID_TOOL) $(EXECSDIR)/subu-mk-0 $(EXECSDIR)/subu-rm-0 $(EXECSDIR)/subu-bind-all" -./module/tranche/deprecated/0_makefile: cat $(SUID_TOOL) -./module/tranche/deprecated/0_makefile: sudo $(SUID_TOOL) $(EXECSDIR)/subu-mk-0 $(EXECSDIR)/subu-rm-0 $(EXECSDIR)/subu-bind-all -./module/tranche/deprecated/0_makefile-flags:TOOLSDIR=$(realpath $(PROJECT_SUBU)/tools) -./module/tranche/makefile-flags:TOOLSDIR=$(realpath $(PROJECT_SUBU)/tools) -./module/da/test/makefile-flags:TOOLSDIR=$(realpath $(PROJECT_SUBU)/tools) -./module/da/makefile-flags:TOOLSDIR=$(realpath $(PROJECT_SUBU)/tools)