working single gate for implementation example/makefile
authorThomas Walker Lynch <eknp9n@reasoningtechnology.com>
Tue, 10 Mar 2026 10:52:41 +0000 (10:52 +0000)
committerThomas Walker Lynch <eknp9n@reasoningtechnology.com>
Tue, 10 Mar 2026 10:52:41 +0000 (10:52 +0000)
developer/authored/Greeter/Greeter.lib.c
developer/authored/Greeter/Math.lib.c
developer/authored/Greeter/hello.CLI.c
developer/tool/make
developer/tool/makefile
shared/tool/makefile/Harmony.mk
shared/tool/makefile/target_library_CLI.mk

index b7be528..4c9b9db 100644 (file)
@@ -1,26 +1,24 @@
-#ifndef GREETER_LIB_C
-#define GREETER_LIB_C
-#ifndef FACE
-  #define GREETER_IMPL
+#ifndef ExampleGreet·Greeter·ONCE
+#define ExampleGreet·Greeter·ONCE
+
+#ifndef ExampleGreet·Greeter
+  #define ExampleGreet·Greeter
 #endif
 
-#define FACE
-#include "math.lib.c"
-#undef FACE
+#include "Math.lib.c"
 
-void Greet·hello_loop(int count);
+void ExampleGreet·Greeter·hello_loop(int count);
 
-#ifdef GREETER_IMPL
+#ifdef ExampleGreet·Greeter
 
 #include <stdio.h>
 
-void Greet·hello_loop(int count){
+void ExampleGreet·Greeter·hello_loop(int count){
   for(int TM = 0; TM < count; ++TM){
-    int current_count = Math·add(TM ,1);
+    int current_count = ExampleGreet·Math·add(TM ,1);
     printf("Hello iteration: %d\n" ,current_count);
   }
 }
 
-#endif // GREETER_IMPL
-#endif // GREETER_LIB_C
-
+#endif // ExampleGreet·Greeter
+#endif // ExampleGreet·Greeter·ONCE
index 220b392..99dec03 100644 (file)
@@ -1,17 +1,17 @@
-#ifndef ExampleGreet·math·ONCE
-#define ExampleGreet·math·ONCE
+#ifndef ExampleGreet·Math·ONCE
+#define ExampleGreet·Math·ONCE
 
-#ifndef ExampleGreet·math
-  #define ExampleGreet·math
+#ifndef ExampleGreet·Math
+  #define ExampleGreet·Math
 #endif
 
 int ExampleGreet·Math·add(int a ,int b);
 
-#ifdef ExampleGreet·math
+#ifdef ExampleGreet·Math
 
 int ExampleGreet·Math·add(int a ,int b){
   return a + b;
 }
 
-#endif // ExampleGreet·math
-#endif // ExampleGreet·math·ONCE
+#endif // ExampleGreet·Math
+#endif // ExampleGreet·Math·ONCE
index d498dbf..8427efb 100644 (file)
@@ -1,15 +1,13 @@
 #include <stdlib.h>
 #include <stdio.h>
 
-#define FACE
-#include "math.lib.c"
-#include "greeter.lib.c"
-#undef FACE
+#include "Math.lib.c"
+#include "Greeter.lib.c"
 
 void CLI(void){
-  int base_count = Math·add(1 ,2);
+  int base_count = ExampleGreet·Math·add(1 ,2);
   printf("Calculated base loop count: %d\n" ,base_count);
-  Greet·hello_loop(base_count);
+  ExampleGreet·Greeter·hello_loop(base_count);
 }
 
 int main(int argc ,char **argv){
index 740321f..1c5922c 100755 (executable)
@@ -1,19 +1,24 @@
 #!/usr/bin/env bash
 script_afp=$(realpath "${BASH_SOURCE[0]}")
 
-# input guards
+setup_must_be="developer/tool/setup"
+if [ "$SETUP" != "$setup_must_be" ]; then
+  echo "$(script_fp):: error: must be run in the $setup_must_be environment"
+  exit 1
+fi
 
-  setup_must_be="developer/tool/setup"
-  if [ "$SETUP" != "$setup_must_be" ]; then
-    echo "$(script_fp):: error: must be run in the $setup_must_be environment"
-    exit 1
-  fi
-
-set -e
+set -euo pipefail # RT-style shell safety
 set -x
 
+  # Command is first, Namespace is second
+  CMD="${1:-usage}"
+  NAMESPACE_ARG="${2:-}"
+
   cd "$REPO_HOME/developer" || exit 1
-  /bin/make -f tool/makefile $@
+
+  # Pass both to the orchestrator
+  NAMESPACE="$NAMESPACE_ARG" /bin/make -f tool/makefile "$CMD"
 
 set +x
 echo "$(script_fn) done."
+
index 2d5d057..98d86a0 100644 (file)
@@ -5,6 +5,12 @@
 RT_MAKEFILE_DP := $(REPO_HOME)/shared/tool/makefile
 include $(RT_MAKEFILE_DP)/Harmony.mk
 
+# If a namespace is provided, update the source directory
+ifneq ($(NAMESPACE),)
+  C_SOURCE_DIR := authored/$(NAMESPACE)
+  export C_SOURCE_DIR
+endif
+
 .PHONY: usage 
 usage:
        @printf "Usage: make [usage|version|information|all|lib|CLI|kmod|clean]\n"
@@ -23,6 +29,8 @@ information:
        @printf "local ----------------------------------------\n"
        -@echo CURDIR='$(CURDIR)'
        @echo REPO_HOME="$(REPO_HOME)"
+       @echo NAMESPACE="$(NAMESPACE)"
+       @echo C_SOURCE_DIR="$(C_SOURCE_DIR)"
        @echo KMOD_BUILD_DIR="/lib/modules/$(shell uname -r)/build"
        @echo CURDIR="$(CURDIR)"
        @printf "target_library_CLI.mk ----------------------------------------\n"
index da5efc6..f46a73d 100644 (file)
@@ -14,7 +14,6 @@ CFLAGS           += -MMD -MP
 CFLAGS           += -include "$(REPO_HOME)/shared/tool/makefile/RT_global.h"
 CFLAGS           += -I $(C_SOURCE_DIR)
 
-
 # Project administrators can override this in their local makefile
 LIBRARY_NAME     ?= $(PROJECT)
 LIBRARY_NAME     := $(subst -,_,$(LIBRARY_NAME))
@@ -33,3 +32,4 @@ KMOD_CCFLAGS     ?= -I $(KMOD_SOURCE_DIR)
 # Pass the global header to Kbuild exactly as done for user-space
 KMOD_CCFLAGS     += -include $(REPO_HOME)/shared/tool/makefile/RT_global.h
 KMOD_OUTPUT_DIR  ?= scratchpad/kmod
+
index 2d28b76..65b71ad 100644 (file)
@@ -100,9 +100,15 @@ clean:
 
 
 # recipes
+#$(OBJECT_DIR)/%.o: $(C_SOURCE_DIR)/%.c
+#      @mkdir -p $(OBJECT_DIR)
+#      $(C) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
+
+# The local logic checks if NAMESPACE is defined, and if the target is a .lib.o file
 $(OBJECT_DIR)/%.o: $(C_SOURCE_DIR)/%.c
        @mkdir -p $(OBJECT_DIR)
-       $(C) $(CFLAGS) -o $@ -c $<
+       $(C) $(CFLAGS) $(if $(and $(NAMESPACE),$(findstring .lib,$@)),-D$(NAMESPACE)·$(basename $*),) -o $@ -c $<
+
 
 $(MACHINE_DIR)/%: $(OBJECT_DIR)/%.CLI.o
        @mkdir -p $(MACHINE_DIR)