fleshing out src-tranche
authorThomas Walker Lynch <thomas.lynch@reasoningtechnology.com>
Fri, 22 Mar 2019 00:07:07 +0000 (01:07 +0100)
committerThomas Walker Lynch <thomas.lynch@reasoningtechnology.com>
Fri, 22 Mar 2019 00:07:07 +0000 (01:07 +0100)
41 files changed:
doc/file_extentions.txt [new file with mode: 0644]
doc/src.txt [new file with mode: 0644]
makefile
src-0/0_makefile-flags
src-0/1_doc/README.txt [deleted file]
src-0/1_doc/makefile.txt [deleted file]
src-0/1_doc/makeheaders.txt [deleted file]
src-0/1_doc/sqlite.txt [deleted file]
src-0/1_tests/0_makefile_flags
src-da/0_makefile
src-da/0_makefile-flags
src-da/1_include/da.h
src-da/1_lib/libda.a [new file with mode: 0644]
src-da/1_tests/0_makefile
src-da/1_tests/0_makefile-flags
src-da/1_tests/results
src-da/1_tests/test.dat [new file with mode: 0644]
src-da/1_tests/test_da.cli.c
src-da/1_tests/test_da.lib.c
src-da/1_tests/test_da.lib.h
src-da/1_tmp/makefile_deps [new file with mode: 0644]
src-da/da.lib.c
src-da/da.lib.h
src-da/da.lib.o [new file with mode: 0644]
src-db/0_makefile-flags
src-db/1_doc/return-from-transaction.txt [new file with mode: 0644]
src-tranche/0_makefile
src-tranche/0_makefile-flags
src-tranche/1_deprecated/0_makefile [new file with mode: 0644]
src-tranche/1_deprecated/0_makefile-flags [new file with mode: 0644]
src-tranche/1_tests/0_makefile [new file with mode: 0644]
src-tranche/1_tests/0_makefile-flags [new file with mode: 0644]
src-tranche/tranche.c [deleted file]
src-tranche/tranche.cli.c [new file with mode: 0644]
src-tranche/tranche.lib.c [new file with mode: 0644]
src-tranche/tranche.lib.h [new file with mode: 0644]
stage/include/da.h
stage/lib/libda.a
tools/doc/makefile.txt [new file with mode: 0644]
tools/doc/makeheaders-notes.txt [new file with mode: 0644]
tools/lib/makefile_cc

diff --git a/doc/file_extentions.txt b/doc/file_extentions.txt
new file mode 100644 (file)
index 0000000..a9a2b21
--- /dev/null
@@ -0,0 +1,23 @@
+
+
+filename.tag.extension
+
+extension: 
+  .c for C source
+  .cc for C++ source
+  .h for C header file
+  .hh for C++ header file
+  .o an object file
+
+tag:
+  .lib. The resulting .o file to be placed in release library and is part of the
+        programming interface.
+  .aux. The resulting.o file not directly part of the programming interface, but
+        it might be called by functions that are.
+  .cli. The source file has a main call and is to be relased as part of the command line interface
+  .loc. file has a main call to be made into a local uitlity function
+
+We carry the source file tag and extension to the .o file.  We do not put tags
+nor extensions on command line executables.
+
+local_common.h should be included in all source files
diff --git a/doc/src.txt b/doc/src.txt
new file mode 100644 (file)
index 0000000..902157b
--- /dev/null
@@ -0,0 +1,9 @@
+
+      src-da a simple doubling size expanding array in C
+ src-tranche splits source code into multiple files.  A poor man's 'makeheaders'.
+src-dispatch runs a function or shell command as a separate process
+      src-db sqlite schema and interface for subu
+       src-0 The layer 0 commands for subu. Some are setuid root programs.
+      src-py The application layer
+
+
index 3531a77..f8e38f8 100755 (executable)
--- a/makefile
+++ b/makefile
@@ -1,10 +1,10 @@
 #subdirectories=$(shell /usr/bin/find . -maxdepth 1 -printf "%f " | sed y/\./\ /)
-subdirectories=src
+subdirectories=$(wildcard src-*)
 
 all :
 #      $(foreach dir, $(subdirectories), \
 #              if [ -f $(dir)/0_makefile ]; then \
-#                      make -C $(dir) all && make -C $(dir) install; \
+#                      make -C $(dir) all && make -C $(dir) stage; \
 #              fi;\
 #      )
 
index c523d61..0da8b61 100644 (file)
@@ -27,5 +27,5 @@ CFLAGS=-std=gnu11 -fPIC -I. -ggdb -Werror -DDEBUG -DDEBUGDB
 #CFLAGS=-std=gnu11 -fPIC -I. -Werror
 LINKFLAGS=-L1_lib -lsubu -lsqlite3
 
-LIB_FILE=$(LIBDIR)/libsubu.a
+LIBFILE=$(LIBDIR)/libsubu.a
 
diff --git a/src-0/1_doc/README.txt b/src-0/1_doc/README.txt
deleted file mode 100644 (file)
index a9a2b21..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-filename.tag.extension
-
-extension: 
-  .c for C source
-  .cc for C++ source
-  .h for C header file
-  .hh for C++ header file
-  .o an object file
-
-tag:
-  .lib. The resulting .o file to be placed in release library and is part of the
-        programming interface.
-  .aux. The resulting.o file not directly part of the programming interface, but
-        it might be called by functions that are.
-  .cli. The source file has a main call and is to be relased as part of the command line interface
-  .loc. file has a main call to be made into a local uitlity function
-
-We carry the source file tag and extension to the .o file.  We do not put tags
-nor extensions on command line executables.
-
-local_common.h should be included in all source files
diff --git a/src-0/1_doc/makefile.txt b/src-0/1_doc/makefile.txt
deleted file mode 100644 (file)
index 722de84..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-these are the comments from my RT makefile:
-
-#
-# 2010 11 20 TWL Created
-# 2011 05 26 TWL Modified to generalize
-# 2012 02 23 NLS Add ECHO variable to use on different environnement
-#                corrected setup macro --> add include directory in the path to copy
-#                corrected install macro --> change the name of installed library : lib$(LIB)$(LIBSUFFIX)
-#                changed DOC_DIR directory name to 5_documents
-# 2012 02 23 TWL removed LIB variable which is now set from the command line so
-#                so that all source dirs can use the same makefile
-# 2012 02 23 TWL added target make dist_clean which also deletes the 2_makefile_deps file
-# 2012 04 11 AWW added creation of temporary disk before each test is run 
-# 2012 06 05 TWL moved tests and try .cc files to directories. caused rtmake tests to
-#                dist_clean and make deps
-#
-#
-#----------------------------------------------------------------------------
-#      use this makefile to compile and test the code:
-#
-#               for a first time run, or for regression use the following:
-#
-#                   $ make setup  # makes the directories, though should already exist
-#                   $ make regress 
-#
-#               the usual development workflow makes use of these:
-#
-#                   $ make deps              # only when needed, for example if headers includes change or new files introduced
-#                   $ cd tests; make deps    # only when needed
-#                   $ make lib               # this makes the local library
-#                   $ make tests             # this updates tests and compiles
-#                   $ make clean             # deletes the .o files and library to force a recompile
-#                   $ cd 1_tests; make clean
-#
-#               for a release of a component
-# 
-#                   $ make regress
-#                   $ make install  # this will only work if all the tests in 1_tests are passing 
-#
-#               before a checkin
-# 
-#                   $ make dist_clean # will also clean the tests and try directories
-#
-#               .lib.cc c++ files taken as source of object files for local build library
-#               .exl.cc c++ files taken to have main calls and are linked against local build libary
-#               .ex.cc  c++ files taken to have main calls and are not linked against the local build library
-#               there are no rules for other files in this makefile
-#
-#      about dependencies
-#               The makefile has no way of knowing if an edit changed the dependencies.  Often they do not
-#               and it would be unwieldy to make the deps every time.  Hence *the programmer* must delete
-#               the deps file if he has made any changes that change the dependencies.
-#
-#               The makefile will make the 2_makefile_deps if the file is missing.
-# 
-#
-#      about testing
-#  
-#                the name of the directory you run make in is taken to also be: the name of the library,
-#                the name of the main include file (with a .h added), and the name of the include directory
-#                where the individual headers are found. It is called LIB
-#
-#               test programs are kept in a subdirectory called 1_tests, and are either .exl.cc, ex.cc,
-#                .sh files. When 'make tests' target is invoked they are all run. Test executables return 0
-#                if the test fails, non-zero otherwise.  
-#
-#                to remove a test from the pool move it into the subdirectory in 1_tests, 9_broken,
-#                5_more_tests of 5_scratch.  broken tests are things that are known but must be fixed
-#                before a release.  5_more_tests are tests being worked on.  5_scratch is stuff that is
-#                probably going to be deleted.  if there is a 5_deprecated, that is for good stuff but it
-#                is no longer used for some reason or other.
-#
-#                There is a standard source code template and a
-#                messaging convention.  Also, the names, by convention,are test_xxxx_ where xxx is a
-#                hexadecimal series nummber.  If all the test executables pass the file 1_TESTS_PASSED is
-#                left in the directory.  Otherwise the file 1_TESTS_FAILED is left in the directory.
-#
-#     about release directory
-#
-#               this is set in the ApplicationBase variable by rt_init
-#
-#               after the tests pass stuff might be copied to the release directory using
-# 
-#                  make install
-#
-#               the release directory must have these subdirectories:  
-#
-#                  bin documents include src
-#
-#
-#
diff --git a/src-0/1_doc/makeheaders.txt b/src-0/1_doc/makeheaders.txt
deleted file mode 100644 (file)
index 5aebda9..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-
-This worked to force the include to be part of the interface:
-
-#if INTERFACE
-#include <sqlite3.h>
-#endif
-
-But this did not:
-
-#if INTERFACE
-  #include <sqlite3.h>
-#endif
-
-makeheaders looks to be sensitive to indentation
-
-
diff --git a/src-0/1_doc/sqlite.txt b/src-0/1_doc/sqlite.txt
deleted file mode 100644 (file)
index b7f8cbb..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-
-1.
-  This sql:
-
-    char *sql = 
-      "BEGIN TRANSACTION;"
-      "UPDATE Key_Int SET value = value + 1 WHERE key = 'max_subu_number';"
-      "SELECT value FROM Key_Int WHERE key = 'max_subu_number';"
-      "COMMIT;"
-      ;
-
-  with sqlite_exec, the call back is called with the data from the select.
-
-  with sqlite_prepare_v2, sqlite_step just returns SQLITE_DONE, and we never
-  get to see our data from the select.
index 80ba0ee..8818691 100644 (file)
@@ -27,5 +27,5 @@ 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
 
-LIB_FILE=$(LIBDIR)/libtests.a
+LIBFILE=$(LIBDIR)/libtests.a
 
index 4a9fffa..9835402 100644 (file)
@@ -4,8 +4,6 @@ SHELL=/bin/bash
 
 -include 0_makefile-flags
 
-MAKE=/usr/bin/make -f $(PROJECT_SUBU)/tools/lib/makefile_cc
-
 all: version deps lib execs
 
 lib:
index 89d12f1..daa96bb 100644 (file)
@@ -20,12 +20,13 @@ TMPDIR=1_tmp
 TOOLSDIR=$(realpath $(PROJECT_SUBU)/tools)
 TRYDIR=1_try
 
-
 # compiler and flags
 CC=gcc
 CFLAGS=-std=gnu11 -fPIC -I. -ggdb -Werror -DDEBUG -DDEBUGDB 
 #CFLAGS=-std=gnu11 -fPIC -I. -Werror
 LINKFLAGS=-L1_lib -lda 
 
-LIB_FILE=libda.a
-INC_FILE=da.h
+LIBFILE=libda.a
+INCFILE=da.h
+
+MAKE=/usr/bin/make --no-print-directory -f $(PROJECT_SUBU)/tools/lib/makefile_cc
index e6a3af2..d5ba4db 100644 (file)
@@ -15,13 +15,17 @@ typedef struct Da{
   { da_map(dap, da_free, NULL); return r; }
 
 void da_alloc(Da *dap, size_t item_size);
+void da_free(Da *dap);
+void da_rewind(Da *dap);
 char *da_expand(Da *dap);
 void da_rebase(Da *dap, char *old_base, void *pta);
 bool da_endq(Da *dap, void *pt);
 bool da_boundq(Da *dap);
 void da_push(Da *dap, void *item);
+bool da_pop(Da *dap, void *item);
 void da_map(Da *dap, void f(void *, void *), void *closure);
-void da_free(void *pt, void *closure);
+void da_free_elements(Da *dap);
+char *da_fgets(Da *dap, FILE *fd);
 
 #endif
 
diff --git a/src-da/1_lib/libda.a b/src-da/1_lib/libda.a
new file mode 100644 (file)
index 0000000..db52b0b
Binary files /dev/null and b/src-da/1_lib/libda.a differ
index 18e886d..8b6f67c 100644 (file)
@@ -4,8 +4,6 @@ SHELL=/bin/bash
 
 -include 0_makefile-flags
 
-MAKE=/usr/bin/make -f $(PROJECT_SUBU)/tools/lib/makefile_cc
-
 all: version deps lib execs
 
 %::
index b00890c..4b8fa2c 100644 (file)
@@ -27,5 +27,7 @@ CFLAGS=-std=gnu11 -fPIC -I. -I../1_include -ggdb -Werror -DDEBUG -DDEBUGDB
 #CFLAGS=-std=gnu11 -fPIC -I. -I../1_include -Werror
 LINKFLAGS=-L. -L../1_lib -ltests -lda
 
-LIB_FILE=libtests.a
+LIBFILE=libtests.a
+MAKE=/usr/bin/make --no-print-directory -f $(PROJECT_SUBU)/tools/lib/makefile_cc
+
 
index 313ae95..9e59b33 100644 (file)
@@ -1 +1 @@
-passed all 2 tests
+passed all 4 tests
diff --git a/src-da/1_tests/test.dat b/src-da/1_tests/test.dat
new file mode 100644 (file)
index 0000000..6b4b5bd
--- /dev/null
@@ -0,0 +1,3 @@
+this is a test
+ends without a newline
+(setq mode-require-final-newline nil)
\ No newline at end of file
index e69a73a..bee5a6c 100644 (file)
@@ -9,17 +9,28 @@ int main(){
   unsigned int passed = 0;
   unsigned int failed = 0;
 
-  if( !test_da_0() ){
-    failed++;
-    printf("test_da_0 failed\n");
-  }else
-    passed++;
-
-  if( !test_da_1() ){
-    failed++;
-    printf("test_da_1 failed\n");
-  }else
-    passed++;
+  // enumeration of tests
+  typedef bool (*test_fun)();
+  test_fun tests[] = {test_da_0, test_da_1, test_da_2, test_da_3, NULL};
+  char *test_names[] = {"test_da_0", "test_da_1", "test_da_2", "test_da_3", NULL};
+
+  // call tests
+  test_fun *tfp = tests;
+  char **tnp = test_names;
+  while(*tfp){
+    if( !(*tfp)() ){
+      failed++;
+      if(*tnp)
+        printf("%s failed\n", *tnp);
+      else
+        fprintf(stderr, "internal error, no test_names[] entry for test\n");
+    }else
+      passed++;
+  tfp++;
+  tnp++;
+  }
+
+  // summarize results
 
   if( passed == 0 && failed == 0)
     printf("no tests ran\n");
index 490d6dd..4657c3d 100644 (file)
@@ -3,13 +3,15 @@ Tests for Da.
 
 */
 
+#include <stdio.h>
+#include <string.h>
 #include <stdbool.h>
 #include <da.h>
 
 #include "test_da.lib.h"
 
-
-int test_da_0(){
+// tests push
+bool test_da_0(){
   Da da;
   da_alloc(&da, sizeof(int)); // leaves room for 4 ints
   int i = 0;
@@ -36,7 +38,8 @@ int test_da_0(){
   return f0 && f1 && f2 && f3;
 }
 
-int test_da_1(){
+// tests manual expansion
+bool test_da_1(){
   Da da;
   da_alloc(&da, sizeof(int)); // leaves room for 4 ints
   int i = 0;
@@ -68,4 +71,60 @@ int test_da_1(){
   return f0 && f1 && f2 && f3;
 }
 
+// da_fgets
+bool test_da_2(){
+
+  FILE *fd = fopen("test.dat","r");
+
+  Da da;
+  da_alloc(&da, sizeof(char));
+
+  da_fgets(&da, fd);
+  bool f0 = !strcmp(da.base, "this is a test");
+
+  char *old_base;
+  da_pop(&da, NULL); // pop the prior null terminator
+  char *s1 = da.end;
+  old_base = da_fgets(&da,fd);
+  da_rebase(&da, old_base, &s1);
+  bool f1 = !strcmp(s1, "ends without a newline");
+  
+  da_pop(&da, NULL); // pop the prior null terminator
+  char *s2 = da.end;
+  old_base = da_fgets(&da,fd);
+  da_rebase(&da, old_base, &s2);
+  bool f2 = !strcmp(s2, "(setq mode-require-final-newline nil)");
+
+  bool f3 = !strcmp(da.base, "this is a testends without a newline(setq mode-require-final-newline nil)");
+
+  fclose(fd);
+  return f0 && f1 && f2 && f3;
+}
+
+// da_fgets
+bool test_da_3(){
+
+  FILE *fd = fopen("test.dat","r");
+
+  Da da;
+  da_alloc(&da, sizeof(int));
+
+  int i = 5;
+  da_push(&da, &i);
+  i++;
+  da_push(&da, &i);
+  i++;
+  da_push(&da, &i);
+
+  int j;
+  bool f0 = da_pop(&da, &j) && j == 7;
+  bool f1 = da_pop(&da, &j) && j == 6;
+  bool f2 = da_pop(&da, NULL);
+  bool f3 = !da_pop(&da, &j);
+
+  return f0 && f1 && f2 && f3;
+}
+
+
+
 
index 3b8975e..686b0d0 100644 (file)
@@ -1,7 +1,9 @@
 #ifndef DA_LIB_H
 #define DA_LIB_H
 
-int test_da_0();
-int test_da_1();
+bool test_da_0();
+bool test_da_1();
+bool test_da_2();
+bool test_da_3();
 
 #endif
diff --git a/src-da/1_tmp/makefile_deps b/src-da/1_tmp/makefile_deps
new file mode 100644 (file)
index 0000000..905b038
--- /dev/null
@@ -0,0 +1 @@
+da.lib.o: da.lib.c da.lib.h
index 7ac3935..5e51d43 100644 (file)
@@ -20,6 +20,17 @@ void da_alloc(Da *dap, size_t item_size){
   dap->base = malloc(dap->size);
   dap->end = dap->base;
 }
+void da_free(Da *dap){
+  free(dap->base);
+  dap->size = 0;
+}
+void da_rewind(Da *dap){
+  dap->end = dap->base;
+}
+
+bool da_empty(Da *dap){
+  return dap->end == dap->base;
+}
 
 // Doubles size of of da.  Returns old base, so that existing pointers into the
 // array can be moved to the new array
@@ -58,6 +69,15 @@ void da_push(Da *dap, void *item){
   dap->end += dap->item_size;
 }
 
+bool da_pop(Da *dap, void *item){
+  bool flag = dap->end >= dap->base + dap->item_size;
+  if( flag ){
+    dap->end -= dap->item_size;
+    if(item) memcpy(item, dap->end, dap->item_size);
+  }
+  return flag;
+}
+
 // passed in f(item_pt, arg_pt)
 // We have no language support closures, so we pass in an argument for it.
 // The closure may be set to NULL if it is not needed.
@@ -70,15 +90,22 @@ void da_map(Da *dap, void f(void *, void *), void *closure){
 }
 
 // da_lists are sometimes used as resource managers
-void da_free(void *pt, void *closure){
+static void da_free_element(void *pt, void *closure){
   free(pt);
 }
 
+void da_free_elements(Da *dap){
+  da_map(dap, da_free_element, NULL);
+  da_rewind(dap);
+}
+
+
 // Puts text from a line into buffer *dap. Does not push EOF or '\n' into the
-// buffer.  Returns the line terminator, which will either be EOF or '\n'.  This
-// will not work very well if the line gets very long, as da doubles in size at
-// buffer overrun. items_size for dap must be sizeof(char).
-int da_fgets(Da *dap, FILE *fd){
+// buffer.  Returns the old_base so that external pointers can be rebased.
+// It is possible that the the base hasn't changed. Use feof(FILE *stream) to
+// test for EOF;
+char *da_fgets(Da *dap, FILE *fd){
+  char *old_base = dap->base;
   int c = fgetc(fd);
   while( c != EOF && c != '\n' ){
     da_push(dap, &c);
@@ -86,5 +113,5 @@ int da_fgets(Da *dap, FILE *fd){
   }
   int terminator = 0;
   da_push(dap, &terminator);
-  return c;
+  return old_base;
 }
index e6a3af2..d5ba4db 100644 (file)
@@ -15,13 +15,17 @@ typedef struct Da{
   { da_map(dap, da_free, NULL); return r; }
 
 void da_alloc(Da *dap, size_t item_size);
+void da_free(Da *dap);
+void da_rewind(Da *dap);
 char *da_expand(Da *dap);
 void da_rebase(Da *dap, char *old_base, void *pta);
 bool da_endq(Da *dap, void *pt);
 bool da_boundq(Da *dap);
 void da_push(Da *dap, void *item);
+bool da_pop(Da *dap, void *item);
 void da_map(Da *dap, void f(void *, void *), void *closure);
-void da_free(void *pt, void *closure);
+void da_free_elements(Da *dap);
+char *da_fgets(Da *dap, FILE *fd);
 
 #endif
 
diff --git a/src-da/da.lib.o b/src-da/da.lib.o
new file mode 100644 (file)
index 0000000..979ccb8
Binary files /dev/null and b/src-da/da.lib.o differ
index c523d61..0da8b61 100644 (file)
@@ -27,5 +27,5 @@ CFLAGS=-std=gnu11 -fPIC -I. -ggdb -Werror -DDEBUG -DDEBUGDB
 #CFLAGS=-std=gnu11 -fPIC -I. -Werror
 LINKFLAGS=-L1_lib -lsubu -lsqlite3
 
-LIB_FILE=$(LIBDIR)/libsubu.a
+LIBFILE=$(LIBDIR)/libsubu.a
 
diff --git a/src-db/1_doc/return-from-transaction.txt b/src-db/1_doc/return-from-transaction.txt
new file mode 100644 (file)
index 0000000..b7f8cbb
--- /dev/null
@@ -0,0 +1,15 @@
+
+1.
+  This sql:
+
+    char *sql = 
+      "BEGIN TRANSACTION;"
+      "UPDATE Key_Int SET value = value + 1 WHERE key = 'max_subu_number';"
+      "SELECT value FROM Key_Int WHERE key = 'max_subu_number';"
+      "COMMIT;"
+      ;
+
+  with sqlite_exec, the call back is called with the data from the select.
+
+  with sqlite_prepare_v2, sqlite_step just returns SQLITE_DONE, and we never
+  get to see our data from the select.
index b8c7b9d..b30d8fb 100644 (file)
@@ -1,37 +1,11 @@
-# src/0_makefile
+# src-da/0_makefile
 
 SHELL=/bin/bash
 
--include 0_makefile_flags
-
-SUID_TOOL=$(TOOLSDIR)/bin/setuid_root.sh
-MAKE=/usr/bin/make -f $(PROJECT_SUBU)/tools/lib/makefile_cc
-
-SOURCES=$(wildcard *.c)
-HFILES=$(wildcard *.h)
+-include 0_makefile-flags
 
 all: version deps lib execs
 
-version:
-       $(MAKE) $@
-       @echo "SUID_TOOL: " $(SUID_TOOL)
-
-deps:
-       makeheaders $(SOURCES) $(HFILES)
-       sed -i '/^ *int *main *(.*)/d' *.h
-       $(MAKE) $@
-
-execs:
-       $(MAKE) $@
-       @echo "-> $(SUID_TOOL) $(EXECSDIR)/subu-mk-0 $(EXECSDIR)/subu-rm-0 $(EXECSDIR)/subu-bind-all"
-       cat $(SUID_TOOL)
-       @echo -n "Are you sure? [y/N] " && read ans && [ $${ans:-N} == y ]
-       sudo $(SUID_TOOL) $(EXECSDIR)/subu-mk-0 $(EXECSDIR)/subu-rm-0 $(EXECSDIR)/subu-bind-all
-
-clean:
-       $(MAKE) $@
-       for i in $(HFILES); do rm $$i; done
-
 %::
        $(MAKE) $@
 
index c523d61..2c44f58 100644 (file)
@@ -13,19 +13,20 @@ ECHO= echo
 DEPRDIR=1_deprecated
 DOCDIR=1_doc
 EXECSDIR=1_execs
-HDIR=1_headers
+INCDIR=1_include
 LIBDIR=1_lib
 TESTDIR=1_tests
 TMPDIR=1_tmp
 TOOLSDIR=$(realpath $(PROJECT_SUBU)/tools)
 TRYDIR=1_try
 
-
 # compiler and flags
 CC=gcc
-CFLAGS=-std=gnu11 -fPIC -I. -ggdb -Werror -DDEBUG -DDEBUGDB 
+CFLAGS=-std=gnu11 -fPIC -I. -I$(PROJECT_SUBU)/stage/include -ggdb -Werror -DDEBUG -DDEBUGDB 
 #CFLAGS=-std=gnu11 -fPIC -I. -Werror
-LINKFLAGS=-L1_lib -lsubu -lsqlite3
+LINKFLAGS=-L1_lib -lda 
 
-LIB_FILE=$(LIBDIR)/libsubu.a
+LIBFILE=libtranche.a
+INCFILE=tranche.h
 
+MAKE=/usr/bin/make --no-print-directory -f $(PROJECT_SUBU)/tools/lib/makefile_cc
diff --git a/src-tranche/1_deprecated/0_makefile b/src-tranche/1_deprecated/0_makefile
new file mode 100644 (file)
index 0000000..b8c7b9d
--- /dev/null
@@ -0,0 +1,40 @@
+# src/0_makefile
+
+SHELL=/bin/bash
+
+-include 0_makefile_flags
+
+SUID_TOOL=$(TOOLSDIR)/bin/setuid_root.sh
+MAKE=/usr/bin/make -f $(PROJECT_SUBU)/tools/lib/makefile_cc
+
+SOURCES=$(wildcard *.c)
+HFILES=$(wildcard *.h)
+
+all: version deps lib execs
+
+version:
+       $(MAKE) $@
+       @echo "SUID_TOOL: " $(SUID_TOOL)
+
+deps:
+       makeheaders $(SOURCES) $(HFILES)
+       sed -i '/^ *int *main *(.*)/d' *.h
+       $(MAKE) $@
+
+execs:
+       $(MAKE) $@
+       @echo "-> $(SUID_TOOL) $(EXECSDIR)/subu-mk-0 $(EXECSDIR)/subu-rm-0 $(EXECSDIR)/subu-bind-all"
+       cat $(SUID_TOOL)
+       @echo -n "Are you sure? [y/N] " && read ans && [ $${ans:-N} == y ]
+       sudo $(SUID_TOOL) $(EXECSDIR)/subu-mk-0 $(EXECSDIR)/subu-rm-0 $(EXECSDIR)/subu-bind-all
+
+clean:
+       $(MAKE) $@
+       for i in $(HFILES); do rm $$i; done
+
+%::
+       $(MAKE) $@
+
+
+
+
diff --git a/src-tranche/1_deprecated/0_makefile-flags b/src-tranche/1_deprecated/0_makefile-flags
new file mode 100644 (file)
index 0000000..0da8b61
--- /dev/null
@@ -0,0 +1,31 @@
+
+# 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 staged
+#$(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=1_deprecated
+DOCDIR=1_doc
+EXECSDIR=1_execs
+HDIR=1_headers
+LIBDIR=1_lib
+TESTDIR=1_tests
+TMPDIR=1_tmp
+TOOLSDIR=$(realpath $(PROJECT_SUBU)/tools)
+TRYDIR=1_try
+
+
+# compiler and flags
+CC=gcc
+CFLAGS=-std=gnu11 -fPIC -I. -ggdb -Werror -DDEBUG -DDEBUGDB 
+#CFLAGS=-std=gnu11 -fPIC -I. -Werror
+LINKFLAGS=-L1_lib -lsubu -lsqlite3
+
+LIBFILE=$(LIBDIR)/libsubu.a
+
diff --git a/src-tranche/1_tests/0_makefile b/src-tranche/1_tests/0_makefile
new file mode 100644 (file)
index 0000000..8b6f67c
--- /dev/null
@@ -0,0 +1,14 @@
+# src-da/1_tests/0_makefile
+
+SHELL=/bin/bash
+
+-include 0_makefile-flags
+
+all: version deps lib execs
+
+%::
+       $(MAKE) $@
+
+
+
+
diff --git a/src-tranche/1_tests/0_makefile-flags b/src-tranche/1_tests/0_makefile-flags
new file mode 100644 (file)
index 0000000..c990581
--- /dev/null
@@ -0,0 +1,33 @@
+
+# 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 staged
+#$(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=.
+INCDIR=.
+LIBDIR=.
+TESTDIR=.
+TMPDIR=1_tmp
+TOOLSDIR=$(realpath $(PROJECT_SUBU)/tools)
+TRYDIR=
+
+
+# compiler and flags
+CC=gcc
+CFLAGS=-std=gnu11 -fPIC -I. -I../1_include -ggdb -Werror -DDEBUG -DDEBUGDB 
+#CFLAGS=-std=gnu11 -fPIC -I. -I../1_include -Werror
+LINKFLAGS=-L. -L../1_lib -ltests -lda
+
+LIBFILE=libtranche.a
+MAKE=/usr/bin/make --no-print-directory -f $(PROJECT_SUBU)/tools/lib/makefile_cc
+
+
diff --git a/src-tranche/tranche.c b/src-tranche/tranche.c
deleted file mode 100644 (file)
index b61cf26..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-The purpose of this tools is to facilitate putting prototypes (declarations) next
-to implementations (definitions) in a single source file of a C/C++ programs. 
-
-Splits a single source file into multiple files.  Scans through the single
-source file looking for lines of the form:
-
-  #tranche filename ...
-
-With the # mandatory at column 1 (like the old C preprocessor).  Upon finding
-such a line, copies all following lines into the listed files, until reaching the
-end marker:
-
-  #endtranche
-
-A next improvement of this file would be to support variables to be passed in,
-as per a make file.
-
-*/
-
-
-void tranche(FILE *file){
-
-
-
-}
diff --git a/src-tranche/tranche.cli.c b/src-tranche/tranche.cli.c
new file mode 100644 (file)
index 0000000..eb0fa3e
--- /dev/null
@@ -0,0 +1,6 @@
+
+
+int main(int argc, char **argv, char **envp){
+
+
+}
diff --git a/src-tranche/tranche.lib.c b/src-tranche/tranche.lib.c
new file mode 100644 (file)
index 0000000..07b0165
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+The purpose of this tools is to facilitate putting prototypes (declarations) next
+to implementations (definitions) in a single source file of a C/C++ programs. 
+
+Splits a single source file into multiple files.  Scans through the single
+source file looking for lines of the form:
+
+  #tranche filename ...
+
+With the # as the first non-space character on the line, and only filename
+following the tag. Upon finding such a line, copies all following lines into the
+listed files, until reaching the end marker:
+
+  #endtranche
+
+A next improvement of this file would be to support variables to be passed in
+for the file names.  As it stands, changing the file name requires editing 
+the source file.
+
+*/
+
+#include <da.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+//--------------------------------------------------------------------------------
+// parsing
+
+char tranche_begin_tag[] = "#tranche";
+size_t tranche_begin_tag_len = 8;
+
+char tranche_end_tag[] = "#endtranche";
+size_t tranche_end_tag_len = 11;
+
+// given a line
+// returns beginning of file name list
+static char *is_tranche_begin(char *pt){
+  while( *pt && isspace(*pt) ) pt++;
+  if(!*pt) return NULL;
+  if( strncmp(pt, tranche_begin_tag, tranche_begin_tag_len) ) return NULL;
+  return pt + tranche_begin_tag_len;
+}
+
+static char *is_tranche_end(char *pt){
+  while( *pt && isspace(*pt) ) pt++;
+  if(!*pt) return NULL;
+  if( strncmp(pt, tranche_end_tag, tranche_end_tag_len) ) return NULL;
+  return pt + tranche_end_tag_len;
+}
+
+static bool parse_file_list(Da *file_names, char *pt0){
+  char *pt1;
+  while( *pt0 && isspace(*pt0) ) pt0++;
+  while( *pt0 ){
+    pt1 = pt0;
+    while( *pt1 && !isspace(pt1) ) pt1++;
+    char *file_name = strndup(pt0, pt1 - pt0);
+    da_push(file_names, file_name);
+    pt0 = pt1;
+    while( *pt0 && isspace(*pt0) ) pt0++;
+  }
+}
+
+
+
+//--------------------------------------------------------------------------------
+// da_map calls
+
+static void tranche_open_fd(void *fn, void *closure){
+  char *file_name = (char *)fn;
+  Da *fds = (Da *)closure;
+  int fd = open(fn, O_CREAT | O_APPEND);
+  if(fd == -1){
+    fprintf(stderr, "Could not open file %s\n", file_name);
+    return;
+  }
+  da_push(fds, &fd);  
+  return;
+}
+static void tranche_open_fds(Da *fns, Da *fds){
+  da_map(fns, tranche_open_fd, fds);
+}
+
+static void tranche_close_fd(void *fd, void *closure){
+  close(*(int *)fd);
+}
+static void tranche_close_fds(Da *fds){
+  da_map(fds, tranche_close_fd, NULL);
+}
+
+static void tranche_puts(void *fd, void *string){
+  write(*(int *)fd, string, strlen(string));
+}
+static void tranche_puts_all(Da *fds, char *string){
+  da_map(fds, tranche_puts, string);
+}
+
+//--------------------------------------------------------------------------------
+// 
+
+int tranche_send(FILE *src, Da *arg_fds){
+  char *pt;
+  Da line;
+  Da file_names;
+  Da fds;
+  da_alloc(&line, sizeof(char));
+  da_alloc(&file_names, sizeof(char *));
+  da_alloc(&fds, sizeof(int));
+  
+  da_fgets(&line, src);
+  while( !feof(src) && !is_tranche_end(line.base) ){
+    pt = is_tranche_begin(line.base);
+    if(pt){ // then this line is the start of a nested tranche block
+      parse_file_list(&file_names, pt);
+      tranche_open_fds(&file_names, &fds);
+      da_free_elements(&file_names);
+      tranche_send(src, &fds);
+      tranche_close_fds(&fds);
+    }else{
+      tranche_puts_all(arg_fds, line.base);
+      da_rewind(&line);
+      da_fgets(&line, src);
+    }
+  }
+  
+  da_free(&line);
+  da_free(&file_names);
+  da_free(&fds);
+  return 0;
+}
diff --git a/src-tranche/tranche.lib.h b/src-tranche/tranche.lib.h
new file mode 100644 (file)
index 0000000..27990a6
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef TRANCHE_LIB_H
+#define TRANCHE_LIB_H
+
+int tranche_send(FILE *src, Da *arg_fds);
+
+
+
+#endif
index e6a3af2..d5ba4db 100644 (file)
@@ -15,13 +15,17 @@ typedef struct Da{
   { da_map(dap, da_free, NULL); return r; }
 
 void da_alloc(Da *dap, size_t item_size);
+void da_free(Da *dap);
+void da_rewind(Da *dap);
 char *da_expand(Da *dap);
 void da_rebase(Da *dap, char *old_base, void *pta);
 bool da_endq(Da *dap, void *pt);
 bool da_boundq(Da *dap);
 void da_push(Da *dap, void *item);
+bool da_pop(Da *dap, void *item);
 void da_map(Da *dap, void f(void *, void *), void *closure);
-void da_free(void *pt, void *closure);
+void da_free_elements(Da *dap);
+char *da_fgets(Da *dap, FILE *fd);
 
 #endif
 
index 2b84557..db52b0b 100644 (file)
Binary files a/stage/lib/libda.a and b/stage/lib/libda.a differ
diff --git a/tools/doc/makefile.txt b/tools/doc/makefile.txt
new file mode 100644 (file)
index 0000000..722de84
--- /dev/null
@@ -0,0 +1,91 @@
+these are the comments from my RT makefile:
+
+#
+# 2010 11 20 TWL Created
+# 2011 05 26 TWL Modified to generalize
+# 2012 02 23 NLS Add ECHO variable to use on different environnement
+#                corrected setup macro --> add include directory in the path to copy
+#                corrected install macro --> change the name of installed library : lib$(LIB)$(LIBSUFFIX)
+#                changed DOC_DIR directory name to 5_documents
+# 2012 02 23 TWL removed LIB variable which is now set from the command line so
+#                so that all source dirs can use the same makefile
+# 2012 02 23 TWL added target make dist_clean which also deletes the 2_makefile_deps file
+# 2012 04 11 AWW added creation of temporary disk before each test is run 
+# 2012 06 05 TWL moved tests and try .cc files to directories. caused rtmake tests to
+#                dist_clean and make deps
+#
+#
+#----------------------------------------------------------------------------
+#      use this makefile to compile and test the code:
+#
+#               for a first time run, or for regression use the following:
+#
+#                   $ make setup  # makes the directories, though should already exist
+#                   $ make regress 
+#
+#               the usual development workflow makes use of these:
+#
+#                   $ make deps              # only when needed, for example if headers includes change or new files introduced
+#                   $ cd tests; make deps    # only when needed
+#                   $ make lib               # this makes the local library
+#                   $ make tests             # this updates tests and compiles
+#                   $ make clean             # deletes the .o files and library to force a recompile
+#                   $ cd 1_tests; make clean
+#
+#               for a release of a component
+# 
+#                   $ make regress
+#                   $ make install  # this will only work if all the tests in 1_tests are passing 
+#
+#               before a checkin
+# 
+#                   $ make dist_clean # will also clean the tests and try directories
+#
+#               .lib.cc c++ files taken as source of object files for local build library
+#               .exl.cc c++ files taken to have main calls and are linked against local build libary
+#               .ex.cc  c++ files taken to have main calls and are not linked against the local build library
+#               there are no rules for other files in this makefile
+#
+#      about dependencies
+#               The makefile has no way of knowing if an edit changed the dependencies.  Often they do not
+#               and it would be unwieldy to make the deps every time.  Hence *the programmer* must delete
+#               the deps file if he has made any changes that change the dependencies.
+#
+#               The makefile will make the 2_makefile_deps if the file is missing.
+# 
+#
+#      about testing
+#  
+#                the name of the directory you run make in is taken to also be: the name of the library,
+#                the name of the main include file (with a .h added), and the name of the include directory
+#                where the individual headers are found. It is called LIB
+#
+#               test programs are kept in a subdirectory called 1_tests, and are either .exl.cc, ex.cc,
+#                .sh files. When 'make tests' target is invoked they are all run. Test executables return 0
+#                if the test fails, non-zero otherwise.  
+#
+#                to remove a test from the pool move it into the subdirectory in 1_tests, 9_broken,
+#                5_more_tests of 5_scratch.  broken tests are things that are known but must be fixed
+#                before a release.  5_more_tests are tests being worked on.  5_scratch is stuff that is
+#                probably going to be deleted.  if there is a 5_deprecated, that is for good stuff but it
+#                is no longer used for some reason or other.
+#
+#                There is a standard source code template and a
+#                messaging convention.  Also, the names, by convention,are test_xxxx_ where xxx is a
+#                hexadecimal series nummber.  If all the test executables pass the file 1_TESTS_PASSED is
+#                left in the directory.  Otherwise the file 1_TESTS_FAILED is left in the directory.
+#
+#     about release directory
+#
+#               this is set in the ApplicationBase variable by rt_init
+#
+#               after the tests pass stuff might be copied to the release directory using
+# 
+#                  make install
+#
+#               the release directory must have these subdirectories:  
+#
+#                  bin documents include src
+#
+#
+#
diff --git a/tools/doc/makeheaders-notes.txt b/tools/doc/makeheaders-notes.txt
new file mode 100644 (file)
index 0000000..5aebda9
--- /dev/null
@@ -0,0 +1,16 @@
+
+This worked to force the include to be part of the interface:
+
+#if INTERFACE
+#include <sqlite3.h>
+#endif
+
+But this did not:
+
+#if INTERFACE
+  #include <sqlite3.h>
+#endif
+
+makeheaders looks to be sensitive to indentation
+
+
index a52f36b..ac1f960 100755 (executable)
@@ -3,7 +3,7 @@ SHELL=/bin/bash
 
 -include 0_makefile-flags
 
-DEPS_FILE=$(TMPDIR)/makefile_deps
+DEPSFILE=$(TMPDIR)/makefile_deps
 
 # a single space literal, for example if you wanted to subsitute commas to
 # spaces: $(subst $(space),;,$(string)) we ran into this out of a need to send
@@ -27,17 +27,14 @@ EXECS= $(sort $(patsubst %.cli.c,  %, $(wildcard *.cli.c)))
 all: version deps lib execs
 
 version:
-       @echo '---- make $@:------------------------------------------------------------'
        @echo makefile version 3.0
        @echo "PWD: " $(PWD)
        @echo "MAKEFILE_LIST: " $(MAKEFILE_LIST)
        @echo "CC: " $(CC)
        @echo "CFLAGS: " $(CFLAGS)
        @echo "LINKFLAGS: " $(LINKFLAGS)
-       @echo '______end make $@_____'
 
 info:
-       @echo '---- make $@:------------------------------------------------------------'
        @echo "DEPDIR: " $(DEPDIR)
        @echo "DOCDIR: " $(DOCDIR)
        @echo "EXECSDIR: " $(EXECSDIR)
@@ -47,8 +44,8 @@ info:
        @echo "TMPDIR: " $(TMPDIR)
        @echo "TOOLSDIR: " $(TOOLSDIR)
        @echo "TRYDIR: " $(TRYDIR)
-       @echo "DEPS_FILE: " $(DEPS_FILE)
-       @echo "LIB_FILE: " $(LIB_FILE)
+       @echo "DEPSFILE: " $(DEPSFILE)
+       @echo "LIBFILE: " $(LIBFILE)
        @echo "SOURCES_LIB: " $(SOURCES_LIB)
        @echo "SOURCES_CLI: " $(SOURCES_CLI)
        @echo "SOURCES: " $(SOURCES)
@@ -57,12 +54,9 @@ info:
        @echo "OBJECTS_CLI: " $(OBJECTS_CLI)
        @echo "OBJECTS: " $(OBJECTS)
        @echo "EXECS: " $(EXECS)
-       @echo '______end make $@_____'
 
 # should be safe to run this in an already setup or partially setup directory
 setup:
-       @echo '---- make $@:------------------------------------------------------------'
-       @echo `pwd`'>' 
        if [ ! -e $(DEPRDIR) ]; then mkdir $(DEPRDIR); fi
        if [ ! -e $(DOCDIR) ]; then mkdir $(DOCDIR); fi
        if [ ! -e $(EXECSDIR) ]; then mkdir $(EXECSDIR); fi
@@ -71,65 +65,49 @@ setup:
        if [ ! -e $(TESTDIR) ]; then mkdir $(TESTDIR); fi
        if [ ! -e $(TMPDIR) ]; then mkdir $(TMPDIR); fi
        if [ ! -e $(TRYDIR) ]; then mkdir $(TRYDIR); fi
-       @echo '______end make $@_____'
 
 deps:
-       @echo '---- make $@:------------------------------------------------------------'
-       @echo `pwd`'>' 
-       $(CC) $(CFLAGS) -MM $(SOURCES) 1> $(DEPS_FILE)
+       $(CC) $(CFLAGS) -MM $(SOURCES) 1> $(DEPSFILE)
        for i in $(EXECS) ; do\
-           $(ECHO) >> $(DEPS_FILE);\
-           $(ECHO) "$(EXECSDIR)/$$i : $$i.cli.o $(LIBDIR)/$(LIB_FILE)" >> $(DEPS_FILE);\
-           $(ECHO) "   $(CC) -o $(EXECSDIR)/$$i $$i.cli.o $(LINKFLAGS)" >> $(DEPS_FILE);\
+           $(ECHO) >> $(DEPSFILE);\
+           $(ECHO) "$(EXECSDIR)/$$i : $$i.cli.o $(LIBDIR)/$(LIBFILE)" >> $(DEPSFILE);\
+           $(ECHO) "   $(CC) -o $(EXECSDIR)/$$i $$i.cli.o $(LINKFLAGS)" >> $(DEPSFILE);\
         done
-       @echo '______end make $@_____'
 
 lib: 
-       @echo '---- make $@:------------------------------------------------------------'
-       @echo `pwd`'>' 
-       if [ ! -e $(DEPS_FILE) ]; then make deps; fi
+       if [ ! -e $(DEPSFILE) ]; then make deps; fi
        make sub_lib
-       @echo '______end make $@_____'
 
-sub_lib: $(LIBDIR)/$(LIB_FILE)
+sub_lib: $(LIBDIR)/$(LIBFILE)
 
 
-execs: $(LIBDIR)/$(LIB_FILE)
-       @echo '---- make $@:------------------------------------------------------------'
-       @echo `pwd`'>' 
-       if [ ! -e $(DEPS_FILE) ]; then make deps; fi
+execs: $(LIBDIR)/$(LIBFILE)
+       if [ ! -e $(DEPSFILE) ]; then make deps; fi
        make sub_execs
-       @echo '______end make $@_____'
 
 sub_execs: $(patsubst %,  $(EXECSDIR)/%, $(EXECS))
 
 stage:
-       if [ -f $(LBIDIR)/$(LIBFILE) ]; then cp $(LIBDIR)/$(LIBFILE) $(PROJECT_SUBU)/stage/lib; fi
-       if [ -f $(INCDIR)/$(INC_FILE) ]; then cp $(INCDIR)/$(INC_FILE) $(PROJECT_SUBU)/stage/include; fi
+       if [ -f $(LIBDIR)/$(LIBFILE) ]; then cp $(LIBDIR)/$(LIBFILE) $(PROJECT_SUBU)/stage/lib; fi
+       if [ -f $(INCDIR)/$(INCFILE) ]; then cp $(INCDIR)/$(INCFILE) $(PROJECT_SUBU)/stage/include; fi
 
 clean:
-       @echo '---- make $@:------------------------------------------------------------'
-       @echo `pwd`'>' 
        for i in $(wildcard *~); do mv $$i $(TMPDIR); done
        for i in $(wildcard *.lib.o) $(wildcard *.cli.o); do rm $$i; done 
        for i in $(EXECS); do if [ -e $(EXECSDIR)/$$i ]; then rm $(EXECSDIR)/$$i; fi; done 
-       if [ -f $(LIBDIR)/$(LIB_FILE) ]; then rm $(LIBDIR)/$(LIB_FILE); fi
-       if [ -f $(DEPS_FILE) ]; then rm $(DEPS_FILE); fi
-       @echo '______end make $@_____'
+       if [ -f $(LIBDIR)/$(LIBFILE) ]; then rm $(LIBDIR)/$(LIBFILE); fi
+       if [ -f $(DEPSFILE) ]; then rm $(DEPSFILE); fi
 
 dist-clean:
-       @echo '---- make $@:------------------------------------------------------------'
-       @echo `pwd`'>' 
        make clean
-       if [ -d $(TESTDIR) ]; then cd $(TESTDIR); make dist_clean; fi
-       if [ -d $(TRYDIR) ] ; then cd $(TRYDIR); make dist_clean; fi
-       @echo '______end make $@_____'
+       if [ -d $(TESTDIR) ]; then cd $(TESTDIR); make dist-clean; fi
+       if [ -d $(TRYDIR) ] ; then cd $(TRYDIR); make dist-clean; fi
 
 #
-$(LIBDIR)/$(LIB_FILE) : $(OBJECTS_LIB)
-       ar rcs $(LIBDIR)/$(LIB_FILE) $(OBJECTS_LIB)
+$(LIBDIR)/$(LIBFILE) : $(OBJECTS_LIB)
+       ar rcs $(LIBDIR)/$(LIBFILE) $(OBJECTS_LIB)
 
--include $(DEPS_FILE)
+-include $(DEPSFILE)
 
 # recipe for making object files:
 #