adds tranche -tdir option
authorThomas Walker Lynch <thomas.lynch@reasoningtechnology.com>
Sat, 30 Mar 2019 16:33:49 +0000 (17:33 +0100)
committerThomas Walker Lynch <thomas.lynch@reasoningtechnology.com>
Sat, 30 Mar 2019 16:33:49 +0000 (17:33 +0100)
30 files changed:
doc/makefile-issue [new file with mode: 0644]
module/da/makefile
module/da/makefile-flags
module/da/test/makefile
module/da/test/makefile-flags
module/db/0_makefile
module/share/bin/tranche [deleted file]
module/share/bin/tranche-target [deleted file]
module/share/lib/libda.a
module/subu-0/0_makefile
module/subu-0/1_tests/0_makefile
module/temp [new file with mode: 0644]
module/tranche/deprecated/0_makefile
module/tranche/makefile
module/tranche/makefile-flags
module/tranche/src/tranche-make.cli.c
module/tranche/src/tranche.cli.c
module/tranche/src/tranche.lib.c
module/tranche/src/tranche.lib.h
module/tranche/test/try/test1.sh
module/tranche/test/try/test2.sh
module/tranche/test/try/test3.sh
module/tranche/test/try/test4.sh
tool/bin/tranche
tool/bin/tranche-make
tool/bin/tranche-target
tool/lib/makefile-cc [new file with mode: 0755]
tool/lib/makefile-trc [new file with mode: 0644]
tool/lib/makefile_cc [deleted file]
tool/lib/makefile_trc [deleted file]

diff --git a/doc/makefile-issue b/doc/makefile-issue
new file mode 100644 (file)
index 0000000..859cf77
--- /dev/null
@@ -0,0 +1,21 @@
+1.
+
+For the following makefile, the .PHONEY tag is ignored unless there
+is an explicit target with that name.  The %:: target is not enough.
+So for expample, if there is an exec directory, the exec target
+caught through the %:: will never fire.  The commented lines must
+be added that give an explicit exec target.
+
+
+.PHONY: all version deps lib exec
+all: version deps lib exec
+
+lib:
+       $(MAKE) $@
+       cp src/tranche.lib.h include/tranche.h
+
+#exec:
+#      $(MAKE) $@
+
+%::
+       $(MAKE) $@
index 67fbdb9..49d84f9 100644 (file)
@@ -1,7 +1,9 @@
 # da/makefile
 
+
 SHELL=/bin/bash
-MAKE=
+MAKE=/usr/bin/make --no-print-directory -f $(PROJECT_SUBU)/tool/lib/makefile-cc
+#MAKE=/usr/bin/make -f $(PROJECT_SUBU)/tool/lib/makefile-cc
 
 -include makefile-flags
 
index 51dd4ca..cb96c22 100644 (file)
@@ -14,7 +14,5 @@ CFLAGS=-std=gnu11 -fPIC -I. -ggdb -Werror -DDEBUG -DDEBUGDB
 #CFLAGS=-std=gnu11 -fPIC -I. -Werror
 LINKFLAGS=-Llib -lda 
 
-MAKE=/usr/bin/make --no-print-directory -f $(PROJECT_SUBU)/tool/lib/makefile_cc
-#MAKE=/usr/bin/make -f $(PROJECT_SUBU)/tool/lib/makefile_cc
 
 
index ae31fa3..292b456 100644 (file)
@@ -1,17 +1,17 @@
 # da/test
 
 SHELL=/bin/bash
+MAKE=/usr/bin/make --no-print-directory -f $(PROJECT_SUBU)/tool/lib/makefile-cc
+#MAKE=/usr/bin/make -f $(PROJECT_SUBU)/tool/lib/makefile-cc
 
 -include makefile-flags
 
-.PHONY: all
+.PHONY: all lib exec
 all: version deps lib exec
 
-.PHONY: lib
 lib:
        $(MAKE) $@
 
-.PHONY: exec
 exec:
        $(MAKE) $@
 
index dbcffea..1904d71 100644 (file)
@@ -15,5 +15,3 @@ CFLAGS=-std=gnu11 -fPIC -I../include -ggdb -Werror -DDEBUG -DDEBUGDB
 #CFLAGS=-std=gnu11 -fPIC -I../include -Werror
 LINKFLAGS= -Llib -L../lib -ltest -lda
 
-MAKE=/usr/bin/make --no-print-directory -f $(PROJECT_SUBU)/tool/lib/makefile_cc
-#MAKE=/usr/bin/make -f $(PROJECT_SUBU)/tool/lib/makefile_cc
index b8c7b9d..f0708ef 100644 (file)
@@ -5,7 +5,7 @@ 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
+MAKE=/usr/bin/make -f $(PROJECT_SUBU)/tools/lib/makefile-cc
 
 SOURCES=$(wildcard *.c)
 HFILES=$(wildcard *.h)
diff --git a/module/share/bin/tranche b/module/share/bin/tranche
deleted file mode 100755 (executable)
index bd19f79..0000000
Binary files a/module/share/bin/tranche and /dev/null differ
diff --git a/module/share/bin/tranche-target b/module/share/bin/tranche-target
deleted file mode 100755 (executable)
index bc5d9c1..0000000
Binary files a/module/share/bin/tranche-target and /dev/null differ
index 6809926..595690a 100644 (file)
Binary files a/module/share/lib/libda.a and b/module/share/lib/libda.a differ
index b8c7b9d..f0708ef 100644 (file)
@@ -5,7 +5,7 @@ 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
+MAKE=/usr/bin/make -f $(PROJECT_SUBU)/tools/lib/makefile-cc
 
 SOURCES=$(wildcard *.c)
 HFILES=$(wildcard *.h)
index 67cea25..c16998b 100644 (file)
@@ -4,7 +4,7 @@ SHELL=/bin/bash
 
 -include 0_makefile_flags
 
-MAKE=/usr/bin/make -f $(PROJECT_SUBU)/tools/lib/makefile_cc
+MAKE=/usr/bin/make -f $(PROJECT_SUBU)/tools/lib/makefile-cc
 
 SOURCES=$(wildcard *.c)
 HFILES=$(wildcard *.h)
diff --git a/module/temp b/module/temp
new file mode 100644 (file)
index 0000000..7b6ed6e
--- /dev/null
@@ -0,0 +1,10 @@
+sed -i -e 's/makefile_cc/makefile-cc/g' ./db/0_makefile
+sed -i -e 's/makefile_cc/makefile-cc/g' ./subu-0/1_tests/0_makefile
+sed -i -e 's/makefile_cc/makefile-cc/g' ./subu-0/0_makefile
+sed -i -e 's/makefile_cc/makefile-cc/g' ./tranche/deprecated/0_makefile
+sed -i -e 's/makefile_cc/makefile-cc/g' ./tranche/makefile-flags
+sed -i -e 's/makefile_cc/makefile-cc/g' ./tranche/makefile-flags
+sed -i -e 's/makefile_cc/makefile-cc/g' ./da/test/makefile-flags
+sed -i -e 's/makefile_cc/makefile-cc/g' ./da/test/makefile-flags
+sed -i -e 's/makefile_cc/makefile-cc/g' ./da/makefile-flags
+sed -i -e 's/makefile_cc/makefile-cc/g' ./da/makefile-flags
index b8c7b9d..f0708ef 100644 (file)
@@ -5,7 +5,7 @@ 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
+MAKE=/usr/bin/make -f $(PROJECT_SUBU)/tools/lib/makefile-cc
 
 SOURCES=$(wildcard *.c)
 HFILES=$(wildcard *.h)
index 4c20d5e..651e98b 100644 (file)
@@ -1,6 +1,8 @@
 # tranche/makefile
 
 SHELL=/bin/bash
+MAKE=/usr/bin/make --no-print-directory -f $(PROJECT_SUBU)/tool/lib/makefile-cc
+#MAKE=/usr/bin/make -f $(PROJECT_SUBU)/tool/lib/makefile-cc
 
 -include makefile-flags
 
@@ -14,6 +16,9 @@ lib:
 exec:
        $(MAKE) $@
 
+share:
+       if [ ! -z "$(wildcard $(EXECDIR)/*)" ]; then cp $(EXECDIR)/* $(PROJECT_SUBU)/tool/bin; fi
+
 %::
        $(MAKE) $@
 
index 1aa3d66..bb0340e 100644 (file)
@@ -7,25 +7,8 @@ ECHO= echo
 # directories used by this makefile, these could all be set to dot for
 # the simplest source directory structure
 
-#LIDBIR, EXECDIR, INCDIR 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=deprecated
-DOCDIR=doc
-EXECDIR=exec
-INCDIR=include
-LIBDIR=lib
-SRCDIR=src
-TESTDIR=test
-TMPDIR=tmp
-TOOLDIR=$(realpath $(PROJECT_SUBU)/tool)
-TRYDIR=try
-
 C=gcc
 CFLAGS=-std=gnu11 -fPIC -I. -I../share/include -ggdb -Werror -DDEBUG -DDEBUGDB 
 #CFLAGS=-std=gnu11 -fPIC -I. -Werror
 LINKFLAGS=-Llib -L../share/lib/ -lda -ltranche
 
-MAKE=/usr/bin/make --no-print-directory -f $(PROJECT_SUBU)/tool/lib/makefile_cc
-#MAKE=/usr/bin/make -f $(PROJECT_SUBU)/tool/lib/makefile_cc
index 6fe480b..5faf31f 100644 (file)
@@ -1,11 +1,7 @@
 /*
 
-.. don't think I need sdir, just pass src_file_path through as the source,
-need to add -tdir option to the tranche call, an mod tranche to take it.
-sname then becomes also becomes a path to src. 
-
 usage: 
-   argv[0] [<src_file_path>] [-sname <sname>] [-sdir <dir>] [-tdir <dir>] [-mfile <mfile_path>]
+   argv[0] [<src_file_path>] [-sname <sname>] [-tdir <tdir>] [-mfile <mfile_path>]
 
 gets the names of all the targets from the source file, then appends
 to the mfile a couple of lines of the form:
@@ -18,8 +14,7 @@ located.
 
 options
 <src_file_path>  the trc file to be read
--sdir <sdir>   prepend <sdir> to <src> in the makefile deps line that is printed
--tdir <tdir>   prepend <tdir> to each <target> "
+-tdir <tdir>   prepend <tdir>/ to each <target> "
 -mfile <mfile_path> where to send the output, defaults to stdout
 -sname <sname> replaces sourcename as the name to write as the source - useful for pipes
 
@@ -29,7 +24,7 @@ If -sdir is not provided, the directory part of the <src_file_path> is used. If
 user does not want this behavior, give a value of "." for -sdir.
 
 .. should modify this to allow multiple source files on the command line ..
-
+.. should check that tdir is an existing directory
 */
   
 #include <sys/types.h>
@@ -45,7 +40,6 @@ int main(int argc, char **argv, char **envp){
 
   char *src_file_path = 0;
   char *sname = 0;
-  char *sdir = 0;  
   char *tdir = 0;  
   char *mfile_path = 0; 
 
@@ -77,10 +71,6 @@ int main(int argc, char **argv, char **envp){
           mfile_path = value;
           goto endif;
         }
-        if( !strcmp(option, "sdir") ){
-          sdir = value;
-          goto endif;
-        }
         if( !strcmp(option, "tdir") ){
           tdir = value;
           goto endif;
@@ -102,16 +92,16 @@ int main(int argc, char **argv, char **envp){
     if(args_cnt > 1) src_file_path = *(char **)da_index(argsp, 1);
 
     // arg contracts
-    if(da_length(argsp) > 2){
+    if(args_cnt > 2){
       fprintf(stderr, "too many args\n");
       err_cnt++;
     }
     if(!src_file_path && !sname){
-      fprintf(stderr, "must specify at least one eof a src_file_path or an sname\n");
+      fprintf(stderr, "must specify at least one of a src_file_path or an sname\n");
       err_cnt++;
     }
     if(err_cnt > 0){
-      fprintf(stderr, "usage: %s [<src_file_path>] [-sname <sname>] [-sdir <dir>] [-tdir <dir>] [-mfile <mfile_path>]\n", argv[0]);
+      fprintf(stderr, "usage: %s [<src_file_path>] [-sname <sname>] [-tdir <dir>] [-mfile <mfile_path>]\n", argv[0]);
       return TRANCHE_ERR_ARG_PARSE;
     }
     da_free(argsp); // this only frees the array itself, not the things it points to
@@ -143,14 +133,9 @@ int main(int argc, char **argv, char **envp){
     if(err) return err;
   }
 
-  char *file_name_part;
-  if(src_file_path){
-    // we are guaranteed a filename part, otherwise the fopen above would have failed
-    file_name_part = path_chop(src_file_path);
-    if(!sname) sname = file_name_part;
-    if(!sdir && file_name_part != src_file_path) sdir = src_file_path; // note the file name has been chopped from src_file_path
-  }
-  tranche_make(src_file, sname,  mfile_fd, sdir, tdir);
+  if(sname)src_file_path = sname;
+  path_trim_slashes(tdir);
+  tranche_make(src_file, src_file_path,  mfile_fd, tdir);
 
   { // deallocate resources instead of just existing, so as to catch any errors
     int err_cnt = 0;
index 1e6ee60..a0fe798 100644 (file)
@@ -18,29 +18,97 @@ the tranche output files before running tranche a second time.
 
 .. currently tranche_send will probably mess up if the user nests a tranche to
 the same file as one already open in the containing tranche ..
+
+.. should allow multiple source file args
 */
   
 #include <stdio.h>
 #include <unistd.h>
+#include <string.h>
 #include <da.h>
 #include "tranche.lib.h"
 
 int main(int argc, char **argv, char **envp){
-  if(argc != 2){
-    fprintf(stderr, "usage: %s <source-file>\n",argv[0]);
-    return TRANCHE_ERR_ARG_PARSE;
-  }
-  FILE *file = fopen(argv[1], "r");
-  if(!file){
-    fprintf(stderr,"could not open file %s\n", argv[1]);
-    return TRANCHE_ERR_SRC_OPEN;
+  char *src_file_path = 0;
+  char *tdir = 0;  
+
+  { // argument parse
+    Da args; // we will queue the non option args here
+    Da *argsp = &args;
+    da_alloc(argsp, sizeof(char *));
+
+    int err_cnt = 0;
+    char **pt = argv;
+    char *option;
+    char *value; // currently all our tranche options have exactly one value
+    while(*pt){
+      if( **pt == '-' ){
+        option = *pt + 1;
+        if(!*option){
+          fprintf(stderr, "Currently there is no lone '-' option.\n");
+          err_cnt++;
+          goto endif;
+        }
+        pt++; if(!*pt || **pt == '-'){
+          fprintf(stderr, "Missing value for option %s.\n", option);
+          err_cnt++;
+          if(!*pt) break; // then nothing more to parse
+          goto endif;
+        }
+        value = *pt;
+        if( !strcmp(option, "tdir") ){
+          tdir = value;
+          goto endif;
+        }
+        fprintf(stderr, "Unrecognized option %s.", option);
+        err_cnt++;
+        goto endif;
+      }
+      // else clause
+      da_push(argsp, pt);
+    endif:
+    pt++;
+    }
+    int args_cnt = da_length(argsp);
+    if(args_cnt > 1) src_file_path = *(char **)da_index(argsp, 1);
+
+    // arg contracts
+    if(args_cnt > 2){
+      fprintf(stderr, "too many arguments\n");
+      err_cnt++;
+    }
+    if(err_cnt > 0){
+      fprintf(stderr, "usage: %s [<src_file_path>] [-tdir <dir>]\n", argv[0]);
+      return TRANCHE_ERR_ARG_PARSE;
+    }
+    da_free(argsp); // this only frees the array itself, not the things it points to
+
+  }// end of argument parse
+
+  FILE *src_file;
+  { //source and mfile open
+    if(!src_file_path)
+      src_file = stdin;
+    else
+      src_file = fopen(src_file_path, "r");
+
+    int err = 0;
+    if(!src_file){
+      fprintf(stderr,"could not open tranche source file %s\n", src_file_path);
+      err+= TRANCHE_ERR_SRC_OPEN;
+    }
+    if(err) return err;
   }
+
   Da targets;
   da_alloc(&targets, sizeof(int));
   int fd = STDOUT_FILENO;
   da_push(&targets, &fd);
-  tranche_send(file, &targets);
+  if(tdir)chdir(tdir);
+
+  tranche_send(src_file, &targets);
+
   da_free(&targets);
-  fclose(file);
+  fclose(src_file);
   return 0;
 }
index b27aaa6..aad290a 100644 (file)
@@ -187,33 +187,23 @@ int tranche_target(FILE *src, Da *target_arrp){
   return 0;
 }
 
-// Inserts a zero to chop off the filename similar to the old basename.
-// Returns a pointer to the first character after the inserted zero, i.e. to the filename.
-char *path_chop(char *path){
-  char *file = path + strlen(path);
-  if(file == path) return file;
-  file--;
-  if(file == path){
-    if(*file == '.') file++; // lone '.' case
-    return file;
-  }
-  file--;
-  if(file == path){
-    if(*file == '.' && *(file+1)=='.') file+=2; // lone '..' case
-    return file;
-  }
-  do{
-    file--;
-  }while(file != path && *file != '/');
-  if( *file == '/' ){
-    *file = 0;
-    file++;
+// replaces trailing slashes with zeros
+void path_trim_slashes(char *path){
+  if(!path || !*path) return;
+  char *pt = path + strlen(path) - 1;
+ loop:
+  if(*pt == '/'){
+    *pt = 0;
+    if(pt != path){
+      pt--;
+      goto loop;
+    }
   }
-  return file;
+  return;
 }
 
 // write a make file rule for making the tranche targets
-void tranche_make(FILE *src_file, char *src_name, int mfile_fd, char *sdir, char *tdir){
+void tranche_make(FILE *src_file, char *src_name, int mfile_fd, char *tdir){
 
   // target list
   Da ta;
@@ -228,7 +218,7 @@ void tranche_make(FILE *src_file, char *src_name, int mfile_fd, char *sdir, char
   char tab = '\t';
   char terminator = 0;
 
-  // output the dependency line ----------------------------------------
+  // construct then output the dependency line ----------------------------------------
   Da dla;
   Da *dlap=&dla; // dependency line array pointer
   da_alloc(dlap, sizeof(char));
@@ -244,10 +234,6 @@ void tranche_make(FILE *src_file, char *src_name, int mfile_fd, char *sdir, char
   }
   da_push(dlap, &colon);
   da_push(dlap, &sp);
-  if(sdir){
-    da_push_string(dlap, sdir);
-    da_push(dlap, &slash);
-  }
   da_push_string(dlap, src_name);
   da_push(dlap, &newline);
   write(mfile_fd, dlap->base, dlap->end - dlap->base);
@@ -258,6 +244,10 @@ void tranche_make(FILE *src_file, char *src_name, int mfile_fd, char *sdir, char
   da_rewind(dlap); // reuse the line buffer
   da_push(dlap, &tab);
   da_push_string(dlap, "tranche $<");
+  if(tdir){
+    da_push_string(dlap, " -tdir ");
+    da_push_string(dlap, tdir);
+  }
   da_push(dlap, &newline);
   da_push(dlap, &newline);
   write(mfile_fd, dlap->base, dlap->end - dlap->base);
index 4ef4840..c847765 100644 (file)
@@ -6,9 +6,9 @@
 #define TRANCHE_ERR_DST_OPEN 4
 #define TRANCHE_ERR_FCLOSE 8
 
-char *path_chop(char *path);
+void path_trim_slashes(char *path);
 int tranche_send(FILE *src, Da *arg_fds);
 int tranche_target(FILE *src, Da *targets);
-void tranche_make(FILE *src_file, char *src_file_name, int mfile_fd, char *sdir, char *tdir);
+void tranche_make(FILE *src_file, char *src_name, int mfile_fd, char *tdir);
 
 #endif
index c1140ca..0551905 100644 (file)
@@ -1,10 +1,10 @@
 #!/bin/bash -x
 ./tranche test1.dat >test1stdout.dat
-diff test11.dat test11.dat.expected
-diff test12.dat test12.dat.expected
-diff test13.dat test13.dat.expected
-diff test14.dat test14.dat.expected
-diff test15.dat test15.dat.expected
-diff test1stdout.dat test1stdout.dat.expected
+diff -q test11.dat test11.dat.expected
+diff -q test12.dat test12.dat.expected
+diff -q test13.dat test13.dat.expected
+diff -q test14.dat test14.dat.expected
+diff -q test15.dat test15.dat.expected
+diff -q test1stdout.dat test1stdout.dat.expected
 rm test11.dat test12.dat test13.dat test14.dat test15.dat test1stdout.dat
 
index 1a4cf28..6ec2626 100644 (file)
@@ -1,8 +1,8 @@
 #!/bin/bash -x
 ./tranche test2.trc.c >test2stdout.dat
-diff test2.c test2.c.expected
-diff test2.h test2.h.expected
-diff test2stdout.dat test2stdout.dat.expected
+diff -q test2.c test2.c.expected
+diff -q test2.h test2.h.expected
+diff -q test2stdout.dat test2stdout.dat.expected
 rm test2.c test2.h
 
 
index e655682..669739c 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash -x
 ./tranche-target test1.dat > test3.out
-diff test3.out test3.out.expected
+diff -q test3.out test3.out.expected
 rm test3.out
 
 
index 49c7c4b..b40b49b 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash -x
 ./tranche-target test2.trc.c > test4.out
-diff test4.out test4.out.expected
+diff -q test4.out test4.out.expected
 rm test4.out
 
 
index b105ce0..0682265 100755 (executable)
Binary files a/tool/bin/tranche and b/tool/bin/tranche differ
index 3330f46..7c587c2 100755 (executable)
Binary files a/tool/bin/tranche-make and b/tool/bin/tranche-make differ
index e9fd5ff..710e4c9 100755 (executable)
Binary files a/tool/bin/tranche-target and b/tool/bin/tranche-target differ
diff --git a/tool/lib/makefile-cc b/tool/lib/makefile-cc
new file mode 100755 (executable)
index 0000000..d03d4e1
--- /dev/null
@@ -0,0 +1,191 @@
+
+# This makefile is usually called through a local makefile rather than directly.
+
+# should add test that incdir is not pwd before deleting the include
+# file. Currently it is working for us despite this problem because dist-clean is
+# looking for $(module).h while the include file is always $(module).lib.h.
+
+SHELL=/bin/bash
+
+#--------------------------------------------------------------------------------
+# defaults
+
+# these are the sources edited by the programmer
+C_SOURCE_LIB=  $(wildcard $(SRCDIR)/*.lib.c)
+C_SOURCE_CLI=  $(wildcard $(SRCDIR)/*.cli.c)
+CC_SOURCE_LIB= $(wildcard $(SRCDIR)/*.lib.cc)
+CC_SOURCE_CLI= $(wildcard $(SRCDIR)/*.cli.cc)
+
+#remove the suffix to get base name
+C_BASE_LIB=  $(sort $(patsubst %.lib.c,  %, $(notdir $(C_SOURCE_LIB))))
+C_BASE_CLI=  $(sort $(patsubst %.cli.c,  %, $(notdir $(C_SOURCE_CLI))))
+CC_BASE_LIB= $(sort $(patsubst %.lib.cc, %, $(notdir $(CC_SOURCE_LIB))))
+CC_BASE_CLI= $(sort $(patsubst %.cli.cc, %, $(notdir $(CC_SOURCE_CLI))))
+
+# two sets of object files, one for the lib, and one for the command line interface progs
+OBJECT_LIB= $(patsubst %, $(TMPDIR)/%.lib.o, $(C_BASE_LIB) $(CC_BASE_LIB))
+OBJECT_CLI= $(patsubst %, $(TMPDIR)/%.cli.o, $(C_BASE_CLI) $(CC_BASE_CLI))
+
+# executables are made from CLI sources
+EXEC= $(patsubst %, $(EXECDIR)/%, $(C_BASE_CLI) $(CC_BASE_CLI))
+
+DEPRDIR=deprecated
+DOCDIR=doc
+EXECDIR=exec
+INCDIR=include
+LIBDIR=lib
+SHAREDIR=../share
+SRCDIR=src
+TESTDIR=test
+TMPDIR=tmp
+TOOLDIR=$(realpath $(PROJECT_SUBU)/tool)
+TRYDIR=try
+
+# a single space literal, for example if you wanted to subsitute commas to
+# spaces: $(subst $(space),;,$(string))
+blank :=
+space :=$(blank)  $(blank)
+
+# prevent make from subsittuing its default for CC
+C=
+CC=
+
+#--------------------------------------------------------------------------------
+# local customization
+#  user must define things needed by the local makefile, the compiler, and flags
+
+-include makefile-flags
+
+DEPFILE=$(TMPDIR)/makefile-cc.deps
+LIBFILE=$(LIBDIR)/lib$(MODULE).a
+INCFILE=$(INCDIR)/$(MODULE).h
+
+#--------------------------------------------------------------------------------
+# targets
+
+.PHONY: all
+all: version dep lib exec
+
+.PHONY: version
+version:
+       @echo makefile version 4.0
+       @echo "PWD: " $(PWD)
+       @echo "MAKEFILE_LIST: " $(MAKEFILE_LIST)
+       @echo "C: " $(C)
+       @echo "CFLAGS: " $(CFLAGS)
+       @echo "CC: " $(CC)
+       @echo "CCFLAGS: " $(CCFLAGS)
+       @echo "LINKFLAGS: " $(LINKFLAGS)
+
+.PHONY: info
+info:
+       @echo "DEPRDIR: " $(DEPRDIR)
+       @echo "DOCDIR: " $(DOCDIR)
+       @echo "EXECDIR: " $(EXECDIR)
+       @echo "INCDIR: " $(INCDIR)
+       @echo "LIBDIR: " $(LIBDIR)
+       @echo "TESTDIR: " $(TESTDIR)
+       @echo "TMPDIR: " $(TMPDIR)
+       @echo "TOOLDIR: " $(TOOLDIR)
+       @echo "TRYDIR: " $(TRYDIR)
+       @echo "DEPFILE: " $(DEPFILE)
+       @echo "LIBFILE: " $(LIBFILE)
+       @echo "INCFILE: " $(INCFILE)
+       @echo "C_SOURCE_LIB: " $(C_SOURCE_LIB)
+       @echo "C_SOURCE_CLI: " $(C_SOURCE_CLI)
+       @echo "CC_SOURCE_LIB: " $(CC_SOURCE_LIB)
+       @echo "CC_SOURCE_CLI: " $(CC_SOURCE_CLI)
+       @echo "C_BASE_LIB: " $(C_BASE_LIB)
+       @echo "C_BASE_CLI: " $(C_BASE_CLI)
+       @echo "CC_BASE_LIB: " $(CC_BASE_LIB)
+       @echo "CC_BASE_CLI: " $(CC_BASE_CLI)
+       @echo "OBJECT_LIB: " $(OBJECT_LIB)
+       @echo "OBJECT_CLI: " $(OBJECT_CLI)
+       @echo "EXEC: " $(EXEC)
+
+# should be safe to run this in an already setup or partially setup directory
+.PHONY: setup
+setup:
+       [ ! -e $(DEPRDIR) ] && mkdir $(DEPRDIR) || true
+       [ ! -e $(DOCDIR) ]  && mkdir $(DOCDIR)  || true
+       [ ! -e $(EXECDIR) ] && mkdir $(EXECDIR) || true
+       [ ! -e $(INCDIR) ]  && mkdir $(INCDIR)  || true
+       [ ! -e $(LIBDIR) ]  && mkdir $(LIBDIR)  || true
+       [ ! -e $(SRCDIR) ]  && mkdir $(SRCDIR)  || true
+       [ ! -e $(TESTDIR) ] && mkdir $(TESTDIR) || true
+       [ ! -e $(TMPDIR) ]  && mkdir $(TMPDIR)  || true
+       [ ! -e $(TRYDIR) ]  && mkdir $(TRYDIR)  || true
+
+#better to put the dependency generation into a loop on the source file and specify -MT for the target
+#also should be redirecting only stdout so stderr messages will be displayed >>1 depfile
+.PHONY: dep
+dep: 
+       @if [ -z "$(CC)" ]; then\
+         if [ -z "$C()" ]; then\
+           echo "No compiler specified";\
+           exit 1;\
+         else\
+           echo "C compiler only deps" ;\
+           $(C) $(CFLAGS) -MM  $(C_SOURCE_LIB) $(C_SOURCE_CLI) | sed 's|^.*\.o|$(TMPDIR)/&|' > $(DEPFILE);\
+           echo "deps for C linking";\
+           for i in $(C_BASE_CLI) ; do\
+             $(ECHO) >> $(DEPFILE);\
+             $(ECHO) "$(EXECDIR)/$$i : $(TMPDIR)/$$i.cli.o $(LIBFILE)" >> $(DEPFILE);\
+             $(ECHO) " $(C) -o $(EXECDIR)/$$i $(TMPDIR)/$$i.cli.o $(LINKFLAGS)" >> $(DEPFILE);\
+           done;\
+         fi;\
+       else\
+         $(CC) $(CCFLAGS) -MM  $(CC_SOURCE_LIB) $(CC_SOURCE_CLI) | sed 's|^.*\.o|$(TMPDIR)/&|' > $(DEPFILE);\
+         if [ -z "$C()" ]; then\
+           echo "CC compiler only deps" ;\
+         else\
+           echo "CC and C mixed compile deps" ;\
+           $(C) $(CFLAGS) -MM   $(C_SOURCE_LIB) $(C_SOURCE_CLI) | sed 's|^.*\.o|$(TMPDIR)/&|' > $(DEPFILE);\
+         fi;\
+         echo "deps for CC linking";\
+         for i in $(CC_BASE_CLI) $(C_BASE_CLI) ; do\
+           $(ECHO) >> $(DEPFILE);\
+           $(ECHO) "$(EXECDIR)/$$i : $(TMPDIR)/$$i.cli.o $(LIBFILE)" >> $(DEPFILE);\
+           $(ECHO) "   $(CC) -o $(EXECDIR)/$$i $(TMPDIR)/$$i.cli.o $(LINKFLAGS)" >> $(DEPFILE);\
+         done;\
+       fi
+
+.PHONY: lib
+lib: $(LIBFILE)
+
+$(LIBFILE): $(OBJECT_LIB)
+       ar rcs $(LIBFILE) $(OBJECT_LIB)
+
+.PHONY: exec
+exec: $(LIBFILE)
+       make sub_exec
+
+.PHONY: sub_exec
+sub_exec: $(EXEC)
+
+.PHONY: share
+share:
+       if [ ! -z "$(wildcard $(LIBDIR)/*)" ]; then cp $(LIBDIR)/* $(SHAREDIR)/lib; fi
+       if [ ! -z "$(wildcard $(INCDIR)/*)" ]; then cp $(INCDIR)/* $(SHAREDIR)/include; fi
+       if [ ! -z "$(wildcard $(EXECDIR)/*)" ]; then cp $(EXECDIR)/* $(SHAREDIR)/bin; fi
+
+.PHONY: clean
+clean:
+       for i in $(wildcard tmp/*); do rm $$i || true; done 
+
+.PHONY: dist-clean
+dist-clean: clean
+       for i in $(EXEC); do [ -e $$i ] && rm $$i || true; done 
+       rm $(INCFILE) || true
+       rm $(LIBFILE) || true
+
+-include $(DEPFILE)
+
+# recipes
+
+$(TMPDIR)/%.o : $(SRCDIR)/%.c
+       $(C) $(CFLAGS) -o $@ -c $<
+
+$(TMPDIR)/%.o : $(SRCDIR)/%.cc
+       $(CC) $(CCFLAGS) -o $@ -c $<
+
diff --git a/tool/lib/makefile-trc b/tool/lib/makefile-trc
new file mode 100644 (file)
index 0000000..14b3c4f
--- /dev/null
@@ -0,0 +1,37 @@
+
+# This makefile is usually called through a local makefile rather than directly.
+# The purpose of this makefile is to expand out the tranched C/CC sources, and
+# otherwise to fall through to makefile_cc.
+
+SHELL=/bin/bash
+
+TRCDIR=trc
+
+# these are the sources edited by the programmer
+TRC_FILE= $(wildcard $(TRCDIR)/*.trc.c) $(wildcard $(TRCDIR)/*.trc.cc)
+
+-include makefile-flags
+
+MAKE=/usr/bin/make --no-print-directory -f $(PROJECT_SUBU)/tool/lib/makefile-cc
+#MAKE=/usr/bin/make -f $(PROJECT_SUBU)/tool/lib/makefile-cc
+
+DEPFILE=$(TMPDIR)/makefile-trc.deps
+
+all: version deps lib execs
+
+.PHONY: all version deps lib exec
+all: version deps lib exec
+
+lib:
+       $(MAKE) $@
+
+exec:
+       $(MAKE) $@
+
+share:
+       if [ ! -z "$(wildcard $(EXECDIR)/*)" ]; then cp $(EXECDIR)/* $(PROJECT_SUBU)/tool/bin; fi
+
+%::
+       $(MAKE) $@
+
+dep: 
\ No newline at end of file
diff --git a/tool/lib/makefile_cc b/tool/lib/makefile_cc
deleted file mode 100755 (executable)
index 1fc00e6..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-
-# this makefile is usually called from via make from a local makefile
-
-
-#should add test that incdir is not pwd before deleting the include file in
-#dist-clean currently make is looking for module.h while the include file is
-#always module.lib.h so the lib include is not getting clobbered
-
-SHELL=/bin/bash
-
-#--------------------------------------------------------------------------------
-# defaults
-
-# these are the sources edited by the programmer
-C_SOURCE_LIB=  $(wildcard $(SRCDIR)/*.lib.c)
-C_SOURCE_CLI=  $(wildcard $(SRCDIR)/*.cli.c)
-CC_SOURCE_LIB= $(wildcard $(SRCDIR)/*.lib.cc)
-CC_SOURCE_CLI= $(wildcard $(SRCDIR)/*.cli.cc)
-
-#remove the suffix to get base name
-C_BASE_LIB=  $(sort $(patsubst %.lib.c,  %, $(notdir $(C_SOURCE_LIB))))
-C_BASE_CLI=  $(sort $(patsubst %.cli.c,  %, $(notdir $(C_SOURCE_CLI))))
-CC_BASE_LIB= $(sort $(patsubst %.lib.cc, %, $(notdir $(CC_SOURCE_LIB))))
-CC_BASE_CLI= $(sort $(patsubst %.cli.cc, %, $(notdir $(CC_SOURCE_CLI))))
-
-# two sets of object files, one for the lib, and one for the command line interface progs
-OBJECT_LIB= $(patsubst %, $(TMPDIR)/%.lib.o, $(C_BASE_LIB) $(CC_BASE_LIB))
-OBJECT_CLI= $(patsubst %, $(TMPDIR)/%.cli.o, $(C_BASE_CLI) $(CC_BASE_CLI))
-
-# executables are made from CLI sources
-EXEC= $(patsubst %, $(EXECDIR)/%, $(C_BASE_CLI) $(CC_BASE_CLI))
-
-DEPRDIR=deprecated
-DOCDIR=doc
-EXECDIR=exec
-INCDIR=include
-LIBDIR=lib
-SHAREDIR=../share
-SRCDIR=src
-TESTDIR=test
-TMPDIR=tmp
-TOOLDIR=$(realpath $(PROJECT_SUBU)/tool)
-TRYDIR=try
-
-# a single space literal, for example if you wanted to subsitute commas to
-# spaces: $(subst $(space),;,$(string))
-blank :=
-space :=$(blank)  $(blank)
-
-# prevent make from subsittuing its default for CC
-C=
-CC=
-
-#--------------------------------------------------------------------------------
-# local customization
-#  user must define things needed by the local makefile, the compiler, and flags
-
--include makefile-flags
-
-DEPFILE=$(TMPDIR)/makefile-dep
-LIBFILE=$(LIBDIR)/lib$(MODULE).a
-INCFILE=$(INCDIR)/$(MODULE).h
-
-#--------------------------------------------------------------------------------
-# targets
-
-.PHONY: all
-all: version dep lib exec
-
-.PHONY: version
-version:
-       @echo makefile version 4.0
-       @echo "PWD: " $(PWD)
-       @echo "MAKEFILE_LIST: " $(MAKEFILE_LIST)
-       @echo "C: " $(C)
-       @echo "CFLAGS: " $(CFLAGS)
-       @echo "CC: " $(CC)
-       @echo "CCFLAGS: " $(CCFLAGS)
-       @echo "LINKFLAGS: " $(LINKFLAGS)
-
-.PHONY: info
-info:
-       @echo "DEPRDIR: " $(DEPRDIR)
-       @echo "DOCDIR: " $(DOCDIR)
-       @echo "EXECDIR: " $(EXECDIR)
-       @echo "INCDIR: " $(INCDIR)
-       @echo "LIBDIR: " $(LIBDIR)
-       @echo "TESTDIR: " $(TESTDIR)
-       @echo "TMPDIR: " $(TMPDIR)
-       @echo "TOOLDIR: " $(TOOLDIR)
-       @echo "TRYDIR: " $(TRYDIR)
-       @echo "DEPFILE: " $(DEPFILE)
-       @echo "LIBFILE: " $(LIBFILE)
-       @echo "INCFILE: " $(INCFILE)
-       @echo "C_SOURCE_LIB: " $(C_SOURCE_LIB)
-       @echo "C_SOURCE_CLI: " $(C_SOURCE_CLI)
-       @echo "CC_SOURCE_LIB: " $(CC_SOURCE_LIB)
-       @echo "CC_SOURCE_CLI: " $(CC_SOURCE_CLI)
-       @echo "C_BASE_LIB: " $(C_BASE_LIB)
-       @echo "C_BASE_CLI: " $(C_BASE_CLI)
-       @echo "CC_BASE_LIB: " $(CC_BASE_LIB)
-       @echo "CC_BASE_CLI: " $(CC_BASE_CLI)
-       @echo "OBJECT_LIB: " $(OBJECT_LIB)
-       @echo "OBJECT_CLI: " $(OBJECT_CLI)
-       @echo "EXEC: " $(EXEC)
-
-# should be safe to run this in an already setup or partially setup directory
-.PHONY: setup
-setup:
-       [ ! -e $(DEPRDIR) ] && mkdir $(DEPRDIR) || true
-       [ ! -e $(DOCDIR) ]  && mkdir $(DOCDIR)  || true
-       [ ! -e $(EXECDIR) ] && mkdir $(EXECDIR) || true
-       [ ! -e $(INCDIR) ]  && mkdir $(INCDIR)  || true
-       [ ! -e $(LIBDIR) ]  && mkdir $(LIBDIR)  || true
-       [ ! -e $(SRCDIR) ]  && mkdir $(SRCDIR)  || true
-       [ ! -e $(TESTDIR) ] && mkdir $(TESTDIR) || true
-       [ ! -e $(TMPDIR) ]  && mkdir $(TMPDIR)  || true
-       [ ! -e $(TRYDIR) ]  && mkdir $(TRYDIR)  || true
-
-#better to put the dependency generation into a loop on the source file and specify -MT for the target
-#also should be redirecting only stdout so stderr messages will be displayed >>1 depfile
-.PHONY: dep
-dep: 
-       @if [ -z "$(CC)" ]; then\
-         if [ -z "$C()" ]; then\
-           echo "No compiler specified";\
-           exit 1;\
-         else\
-           echo "C compiler only deps" ;\
-           $(C) $(CFLAGS) -MM  $(C_SOURCE_LIB) $(C_SOURCE_CLI) | sed 's|^.*\.o|$(TMPDIR)/&|' > $(DEPFILE);\
-           echo "deps for C linking";\
-           for i in $(C_BASE_CLI) ; do\
-             $(ECHO) >> $(DEPFILE);\
-             $(ECHO) "$(EXECDIR)/$$i : $(TMPDIR)/$$i.cli.o $(LIBFILE)" >> $(DEPFILE);\
-             $(ECHO) " $(C) -o $(EXECDIR)/$$i $(TMPDIR)/$$i.cli.o $(LINKFLAGS)" >> $(DEPFILE);\
-           done;\
-         fi;\
-       else\
-         $(CC) $(CCFLAGS) -MM  $(CC_SOURCE_LIB) $(CC_SOURCE_CLI) | sed 's|^.*\.o|$(TMPDIR)/&|' > $(DEPFILE);\
-         if [ -z "$C()" ]; then\
-           echo "CC compiler only deps" ;\
-         else\
-           echo "CC and C mixed compile deps" ;\
-           $(C) $(CFLAGS) -MM   $(C_SOURCE_LIB) $(C_SOURCE_CLI) | sed 's|^.*\.o|$(TMPDIR)/&|' > $(DEPFILE);\
-         fi;\
-         echo "deps for CC linking";\
-         for i in $(CC_BASE_CLI) $(C_BASE_CLI) ; do\
-           $(ECHO) >> $(DEPFILE);\
-           $(ECHO) "$(EXECDIR)/$$i : $(TMPDIR)/$$i.cli.o $(LIBFILE)" >> $(DEPFILE);\
-           $(ECHO) "   $(CC) -o $(EXECDIR)/$$i $(TMPDIR)/$$i.cli.o $(LINKFLAGS)" >> $(DEPFILE);\
-         done;\
-       fi
-
-.PHONY: lib
-lib: $(LIBFILE)
-
-$(LIBFILE): $(OBJECT_LIB)
-       ar rcs $(LIBFILE) $(OBJECT_LIB)
-
-.PHONY: exec
-exec: $(LIBFILE)
-       make sub_exec
-
-.PHONY: sub_exec
-sub_exec: $(EXEC)
-
-.PHONY: share
-share:
-       if [ ! -z "$(wildcard $(LIBDIR)/*)" ]; then cp $(LIBDIR)/* $(SHAREDIR)/lib; fi
-       if [ ! -z "$(wildcard $(INCDIR)/*)" ]; then cp $(INCDIR)/* $(SHAREDIR)/include; fi
-       if [ ! -z "$(wildcard $(EXECDIR)/*)" ]; then cp $(EXECDIR)/* $(SHAREDIR)/bin; fi
-
-.PHONY: clean
-clean:
-       for i in $(wildcard tmp/*); do rm $$i || true; done 
-
-.PHONY: dist-clean
-dist-clean: clean
-       for i in $(EXEC); do [ -e $$i ] && rm $$i || true; done 
-       rm $(INCFILE) || true
-       rm $(LIBFILE) || true
-
--include $(DEPFILE)
-
-# recipes
-
-$(TMPDIR)/%.o : $(SRCDIR)/%.c
-       $(C) $(CFLAGS) -o $@ -c $<
-
-$(TMPDIR)/%.o : $(SRCDIR)/%.cc
-       $(CC) $(CCFLAGS) -o $@ -c $<
-
diff --git a/tool/lib/makefile_trc b/tool/lib/makefile_trc
deleted file mode 100644 (file)
index 7cbada4..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-
-# Ideally we would read the tranche sources and see what files they output, and then
-# build the deps accordingly, but this makefile is more primitive approach.
-# Here the programmer must have one output .c file or .cc file per input tranche
-# file and it must be name <base>.{lib,cli}.{c,cc} and the {.c,.cc} output
-# tranche must be named <base>.trc.{c,cc}
-
-# usually we have a bunch of source files and one target, here we have one source
-# file, the tranch file, and a bunch of targets.
-
-# will re-orgnaize the directory structure .. will name the src-da .. etc. to the
-# name of the module, then have a source dir inside that has only the stuff
-# programmer's edit, then get rid of the numbers
-
-SHELL=/bin/bash
-
-TRCDIR=trc
-
-# these are the sources edited by the programmer
-C_TRC_LIB=  $(wildcard $(TRCDIR)/*.lib.c)
-C_TRC_CLI=  $(wildcard $(TRCDIR)/*.cli.c)
-CC_TRC_LIB= $(wildcard $(TRCDIR)/*.lib.cc)
-CC_TRC_CLI= $(wildcard $(TRCDIR)/*.cli.cc)
-
-#remove the suffix to get base name
-C_BASE_LIB=  $(sort $(patsubst %.lib.c,  %, $(notdir $(C_SOURCE_LIB))))
-C_BASE_CLI=  $(sort $(patsubst %.cli.c,  %, $(notdir $(C_SOURCE_CLI))))
-CC_BASE_LIB= $(sort $(patsubst %.lib.cc, %, $(notdir $(CC_SOURCE_LIB))))
-CC_BASE_CLI= $(sort $(patsubst %.cli.cc, %, $(notdir $(CC_SOURCE_CLI))))
-
-# the progreammer must name the c and cc tranches accordingly:
-C_TRC_LIB= $(patasubst %, $(TMPDIR)/%.trc.c, C_BASE_LIB)
-C_TRC_CLI= $(patasubst %, $(TMPDIR)/%.trc.c, C_BASE_CLI)
-CC_TRC_LIB= $(patasubst %, $(TMPDIR)/%.trc.cc, CC_BASE_LIB)
-CC_TRC_CLI= $(patasubst %, $(TMPDIR)/%.trc.cc, CC_BASE_CLI)
-
-# two sets of object files, one for the lib, and one for the command line interface progs
-OBJECT_LIB= $(patsubst %, $(TMDIR)/%.o, $(C_BASE_LIB) $(CC_BASE_LIB))
-OBJECT_CLI= $(patsubst %, $(TMDIR)/%.o, $(C_BASE_CLI) $(CC_BASE_CLI))
-
-# executables are made from CLI sources
-EXEC= (patsubst %, $(EXECDIR)/%, $(C_BASE_CLI) $(CC_BASE_CLI))
-
-#otherwise make provides default values for these
-C=
-CC=
-
--include makefile-flags
-
-DEPFILE=$(TMPDIR)/makefile_dep
-
-# 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
-# multiple separate command arguments to a shell script from one variable value
-blank :=
-space :=$(blank)  $(blank)
-
-all: version deps lib execs
-
-version:
-       @echo makefile version 3.0
-       @echo "PWD: " $(PWD)
-       @echo "MAKEFILE_LIST: " $(MAKEFILE_LIST)
-       @echo "C: " $(C)
-       @echo "CFLAGS: " $(CFLAGS)
-       @echo "CC: " $(CC)
-       @echo "CCFLAGS: " $(CCFLAGS)
-       @echo "LINKFLAGS: " $(LINKFLAGS)
-
-info:
-       @echo "DEPDIR: " $(DEPDIR)
-       @echo "DOCDIR: " $(DOCDIR)
-       @echo "EXECSDIR: " $(EXECSDIR)
-       @echo "INCDIR: " $(INCDIR)
-       @echo "LIBDIR: " $(LIBDIR)
-       @echo "TESTDIR: " $(TESTDIR)
-       @echo "TMPDIR: " $(TMPDIR)
-       @echo "TOOLSDIR: " $(TOOLSDIR)
-       @echo "TRYDIR: " $(TRYDIR)
-       @echo "DEPSFILE: " $(DEPSFILE)
-       @echo "LIBFILE: " $(LIBFILE)
-        @echo "TRC_TRC: " $(TRC_TRC)
-       @echo "C_BASE_LIB: " $(C_BASE_LIB)
-       @echo "C_BASE_CLI: " $(C_BASE_CLI)
-       @echo "CC_BASE_LIB: " $(CC_BASE_LIB)
-       @echo "CC_BASE_CLI: " $(CC_BASE_CLI)
-
-# should be safe to run this in an already setup or partially setup directory
-setup:
-       if [ ! -e $(DEPRDIR) ]; then mkdir $(DEPRDIR); fi
-       if [ ! -e $(DOCDIR) ]; then mkdir $(DOCDIR); fi
-       if [ ! -e $(EXECSDIR) ]; then mkdir $(EXECSDIR); fi
-       if [ ! -e $(INCDIR) ]; then mkdir $(INCDIR); fi
-       if [ ! -e $(LIBDIR) ]; then mkdir $(LIBDIR); fi
-       if [ ! -e $(SRCDIR) ]; then mkdir $(SRCDIR); fi
-       if [ ! -e $(TESTDIR) ]; then mkdir $(TESTDIR); fi
-       if [ ! -e $(TMPDIR) ]; then mkdir $(TMPDIR); fi
-       if [ ! -e $(TRYDIR) ]; then mkdir $(TRYDIR); fi
-
-dep: $(C_TRC_LIB) $(C_TRC_CLI) $(CC_TRC_LIB) $(CC_TRC_CLI)
-       if [ -z "$(CC)" ]; then\
-         if [ -z "$C()" ]; then\
-           echo "No compiler specified";\
-           exit 1;\
-         else\
-           echo "C compiler only deps" ;\
-           $(C) $(CFLAGS) -MM  $(C_TRC_LIB) $(C_TRC_CLI) 1> $(DEPSFILE);\
-           echo "deps for C linking";\
-           for i in $(EXECS) ; do\
-             $(ECHO) >> $(DEPSFILE);\
-             $(ECHO) "$(EXECSDIR)/$$i : $$i.cli.o $(LIBDIR)/$(LIBFILE)" >> $(DEPSFILE);\
-             $(ECHO) " $(C) -o $(EXECSDIR)/$$i $$i.cli.o $(LINKFLAGS)" >> $(DEPSFILE);\
-           done;\
-         fi;\
-       else\
-         $(CC) $(CCFLAGS) -MM  $(CC_TRC_LIB) $(CC_TRC_CLI) 1> $(DEPSFILE);\
-         if [ -z "$C()" ]; then\
-           echo "CC compiler only deps" ;\
-         else\
-           echo "CC and C mixed compile deps" ;\
-           $(C) $(CFLAGS) -MM   $(C_TRC_LIB) $(C_TRC_CLI) 1>> $(DEPSFILE);\
-         fi;\
-         echo "deps for CC linking";\
-         for i in $(EXECS) ; do\
-           $(ECHO) >> $(DEPSFILE);\
-           $(ECHO) "$(EXECSDIR)/$$i : $$i.cli.o $(LIBDIR)/$(LIBFILE)" >> $(DEPSFILE);\
-           $(ECHO) "   $(CC) -o $(EXECSDIR)/$$i $$i.cli.o $(LINKFLAGS)" >> $(DEPSFILE);\
-         done;\
-       fi
-
-lib: 
-       make $(LIBDIR)/$(LIBFILE)
-
-$(LIBDIR)/$(LIBFILE) : $(OBJECTS_LIB)
-       ar rcs $(LIBDIR)/$(LIBFILE) $(OBJECTS_LIB)
-
-exec: $(LIBDIR)/$(LIBFILE)
-       make sub_exec
-
-sub_exec: $(patsubst %,  $(EXECSDIR)/%, $(EXECS))
-
-stage:
-       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
-       -cp $(EXECSDIR)/* $(PROJECT_SUBU)/stage/bin
-
-clean:
-       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)/$(LIBFILE) ]; then rm $(LIBDIR)/$(LIBFILE); fi
-       if [ -f $(DEPSFILE) ]; then rm $(DEPSFILE); fi
-
--include $(DEPSFILE)
-
-# recipes
-#
-%.trc.c : %.lib.c
-       $(TRANCHE) $<
-
-%.trc.c : %.cli.c
-       $(TRANCHE) $<
-
-%.trc.cc : %.lib.cc
-       $(TRANCHE) $<
-
-%.trc.cc : %.cli.cc
-       $(TRANCHE) $<
-
-%.o : %.c
-       $(C) $(CFLAGS) -c $<
-
-%.o : %.cc
-       $(CC) $(CCFLAGS) -c $<
-