+# 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
#include <stdbool.h>
#include <stdio.h>
-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;
Each of these returns SQLITE_OK upon success
*/
+ #include <da.h>
#include <sqlite3.h>
int db_begin(sqlite3 *db);
int db_commit(sqlite3 *db);
+++ /dev/null
-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.
--- /dev/null
+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.
+++ /dev/null
-# 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) $@
-
-
-
-
+++ /dev/null
-
-# 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
-
+++ /dev/null
-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
+++ /dev/null
-/*
-Tests for da.
-
-*/
-
-#include <da.cli.h>
-#include <stdbool.h>
-
-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;
-
-}
+++ /dev/null
-
-
-a b c:
- echo $@
-
-x y z:
- echo $@
-
-e f g: x y z
- echo $^
-
--- /dev/null
+
+
+a b c:
+ echo $@
+
+x y z:
+ echo $@
+
+e f g: x y z
+ echo $^
+
+++ /dev/null
-/*
-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
+++ /dev/null
-/*
-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
/*
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’:
.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
%::
+++ /dev/null
-./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)