From: Thomas Walker Lynch Date: Sun, 21 Jun 2026 13:40:07 +0000 (+0000) Subject: refined developer/tool/make X-Git-Url: https://git.reasoningtechnology.com/%27%20%20%20resolved_path%20%20%20%27?a=commitdiff_plain;h=202823d848257b0b8a48d6c9f24065fd305cc1b2;p=Harmony refined developer/tool/make --- diff --git a/developer/authored/ExampleGreet/Greeter.lib.c b/developer/authored/ExampleGreet/Greeter.lib.c new file mode 100644 index 0000000..1d23879 --- /dev/null +++ b/developer/authored/ExampleGreet/Greeter.lib.c @@ -0,0 +1,20 @@ +#ifndef ExampleGreet·Greeter·ONCE +#define ExampleGreet·Greeter·ONCE + +#include "Math.lib.c" + +void ExampleGreet·Greeter·hello_loop(int count); + +#ifdef ExampleGreet·Greeter + #include + + void ExampleGreet·Greeter·hello_loop(int count){ + for(int TM = 0; TM < count; ++TM){ + int current_count = ExampleGreet·Math·add(TM ,1); + printf("Hello iteration: %d\n" ,current_count); + } + } + +#endif // ExampleGreet·Greeter + +#endif // ExampleGreet·Greeter·ONCE diff --git a/developer/authored/ExampleGreet/Math.lib.c b/developer/authored/ExampleGreet/Math.lib.c new file mode 100644 index 0000000..6f1880e --- /dev/null +++ b/developer/authored/ExampleGreet/Math.lib.c @@ -0,0 +1,12 @@ +#ifndef ExampleGreet·Math·ONCE +#define ExampleGreet·Math·ONCE + +int ExampleGreet·Math·add(int a ,int b); + +#ifdef ExampleGreet·Math + int ExampleGreet·Math·add(int a ,int b){ + return a + b; + } +#endif // ExampleGreet·Math + +#endif // ExampleGreet·Math·ONCE diff --git a/developer/authored/ExampleGreet/hello.CLI.c b/developer/authored/ExampleGreet/hello.CLI.c new file mode 100644 index 0000000..684e2a7 --- /dev/null +++ b/developer/authored/ExampleGreet/hello.CLI.c @@ -0,0 +1,20 @@ +#include +#include + +#include "Math.lib.c" +#include "Greeter.lib.c" + +void CLI(void){ + int base_count = ExampleGreet·Math·add(1 ,2); + printf("Calculated base loop count: %d\n" ,base_count); + ExampleGreet·Greeter·hello_loop(base_count); +} + +int main(int argc ,char **argv){ + (void)argc; + (void)argv; + + CLI(); + + return EXIT_SUCCESS; +} diff --git a/developer/authored/example-greet/Greeter.lib.c b/developer/authored/example-greet/Greeter.lib.c deleted file mode 100644 index 1d23879..0000000 --- a/developer/authored/example-greet/Greeter.lib.c +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef ExampleGreet·Greeter·ONCE -#define ExampleGreet·Greeter·ONCE - -#include "Math.lib.c" - -void ExampleGreet·Greeter·hello_loop(int count); - -#ifdef ExampleGreet·Greeter - #include - - void ExampleGreet·Greeter·hello_loop(int count){ - for(int TM = 0; TM < count; ++TM){ - int current_count = ExampleGreet·Math·add(TM ,1); - printf("Hello iteration: %d\n" ,current_count); - } - } - -#endif // ExampleGreet·Greeter - -#endif // ExampleGreet·Greeter·ONCE diff --git a/developer/authored/example-greet/Math.lib.c b/developer/authored/example-greet/Math.lib.c deleted file mode 100644 index 6f1880e..0000000 --- a/developer/authored/example-greet/Math.lib.c +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef ExampleGreet·Math·ONCE -#define ExampleGreet·Math·ONCE - -int ExampleGreet·Math·add(int a ,int b); - -#ifdef ExampleGreet·Math - int ExampleGreet·Math·add(int a ,int b){ - return a + b; - } -#endif // ExampleGreet·Math - -#endif // ExampleGreet·Math·ONCE diff --git a/developer/authored/example-greet/hello.CLI.c b/developer/authored/example-greet/hello.CLI.c deleted file mode 100644 index 684e2a7..0000000 --- a/developer/authored/example-greet/hello.CLI.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -#include "Math.lib.c" -#include "Greeter.lib.c" - -void CLI(void){ - int base_count = ExampleGreet·Math·add(1 ,2); - printf("Calculated base loop count: %d\n" ,base_count); - ExampleGreet·Greeter·hello_loop(base_count); -} - -int main(int argc ,char **argv){ - (void)argc; - (void)argv; - - CLI(); - - return EXIT_SUCCESS; -} diff --git a/developer/tool/make b/developer/tool/make index 1c5922c..b7e181b 100755 --- a/developer/tool/make +++ b/developer/tool/make @@ -1,24 +1,114 @@ -#!/usr/bin/env bash -script_afp=$(realpath "${BASH_SOURCE[0]}") +#!/usr/bin/env python3 +# -*- mode: python; coding: utf-8; python-indent-offset: 2; indent-tabs-mode: nil -*- +""" +developer/tool/make - Build Orchestrator Wrapper -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 +This script acts as the primary entry point for compiling the project. +It parses colon-separated arguments mapping specific namespace patterns +(including file globs) to their intended build commands. -set -euo pipefail # RT-style shell safety -set -x +A program developer can modify this script to add custom pre-build checks, +custom argument parsing, or project-specific routing logic. +""" - # Command is first, Namespace is second - CMD="${1:-usage}" - NAMESPACE_ARG="${2:-}" +import sys ,os ,subprocess ,fnmatch +from typing import List - cd "$REPO_HOME/developer" || exit 1 +def check_environment() -> None: + setup_must_be = "developer/tool/setup" + current_setup = os.environ.get("SETUP" ,"") + if( current_setup != setup_must_be ): + print(f"developer/tool/make:: error: must be run in the {setup_must_be} environment" ,file=sys.stderr) + sys.exit(1) - # Pass both to the orchestrator - NAMESPACE="$NAMESPACE_ARG" /bin/make -f tool/makefile "$CMD" +def get_namespaces() -> List[str]: + authored_dir = os.path.join(os.environ.get("REPO_HOME" ,".") ,"developer" ,"authored") + if( not os.path.isdir(authored_dir) ): + return [] + + namespaces = [] + for TM_name in os.listdir(authored_dir): + path = os.path.join(authored_dir ,TM_name) + if( os.path.isdir(path) and not TM_name.startswith(".") ): + namespaces.append(TM_name) + namespaces.sort() + return namespaces -set +x -echo "$(script_fn) done." +def print_usage() -> None: + print("Usage: make [[:]*]*\n") + print("Commands:") + print(" all Build library, CLI, and kmod (Default)") + print(" library Build only the library archives") + print(" CLI Build only the CLI executables") + print(" kmod Build kernel modules") + print(" clean Remove build artifacts") + print(" information Display build environment variables\n") + + print("Available namespaces:") + namespaces = get_namespaces() + if( namespaces ): + for TM_ns in namespaces: + print(f" {TM_ns}") + else: + print(" (No namespaces currently found in authored/)") + + print("\nExamples:") + print(" make (Displays this usage message)") + print(" make ExampleGreet (Builds 'all' for ExampleGreet)") + print(" make Ex*:library G*:all:information (Builds 'library' for Ex*, 'all' and 'information' for G*)") + print(" make \"*:clean\" (Cleans all namespaces. Quotes prevent Bash expansion)") +def run_make(cmd: str ,namespace: str) -> None: + env = os.environ.copy() + env["NAMESPACE"] = namespace + + make_cmd = ["/bin/make" ,"-f" ,"tool/makefile" ,cmd] + + try: + subprocess.run(make_cmd ,env=env ,check=True) + except subprocess.CalledProcessError as e: + print(f"make failed for namespace '{namespace}' with exit code {e.returncode}" ,file=sys.stderr) + sys.exit(e.returncode) + +def CLI() -> None: + check_environment() + + repo_home = os.environ.get("REPO_HOME" ,".") + dev_dir = os.path.join(repo_home ,"developer") + os.chdir(dev_dir) + + args = sys.argv[1:] + + if( not args or args[0] in ["usage" ,"help" ,"-h" ,"--help"] ): + print_usage() + sys.exit(0) + + namespaces = get_namespaces() + matched_any = False + + for TM_arg in args: + parts = TM_arg.split(":") + pattern = parts[0] + commands = parts[1:] + + if( not commands ): + commands = ["all"] + + matches = fnmatch.filter(namespaces ,pattern) + + if( not matches ): + print(f"(warning) Pattern '{pattern}' matched no namespaces." ,file=sys.stderr) + continue + + matched_any = True + for TM_ns in matches: + for TM_cmd in commands: + run_make(TM_cmd ,TM_ns) + + if( not matched_any ): + sys.exit(1) + + print("make done.") + +if __name__ == "__main__": + CLI() diff --git a/developer/tool/makefile b/developer/tool/makefile index b15c43b..070c6ca 100644 --- a/developer/tool/makefile +++ b/developer/tool/makefile @@ -3,7 +3,6 @@ .EXPORT_ALL_VARIABLES: 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),) diff --git a/shared/dictionary_style-directory.js b/shared/dictionary_style-directory.js deleted file mode 100644 index 76addfc..0000000 --- a/shared/dictionary_style-directory.js +++ /dev/null @@ -1,4 +0,0 @@ -window.StyleRT_namespaces = { - "RT": window.RT_REPO_ROOT + "shared/linked-project/RT-style-JS_public/consumer/release/RT" - ,"Project": window.RT_REPO_ROOT + "shared/authored/style" -}; diff --git a/shared/tool/penv_to_emacs b/shared/tool/penv_to_emacs new file mode 100755 index 0000000..947efc0 --- /dev/null +++ b/shared/tool/penv_to_emacs @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") + +set -euo pipefail + +if [ -z "${REPO_HOME:-}" ]; then + echo "emacs-sync:: error: REPO_HOME is not set. Source a setup environment first." + exit 1 +fi + +if ! command -v emacsclient >/dev/null 2>&1; then + echo "emacs-sync:: error: emacsclient is not installed or not in PATH." + exit 1 +fi + +# Push variables to the Emacs global environment +emacsclient --eval "(setenv \"REPO_HOME\" \"$REPO_HOME\")" > /dev/null +emacsclient --eval "(setenv \"PROJECT\" \"$PROJECT\")" > /dev/null + +if [ -n "${ROLE:-}" ]; then + emacsclient --eval "(setenv \"ROLE\" \"$ROLE\")" > /dev/null +fi + +# Sync the PATH so Emacs subprocesses find the local tools +emacsclient --eval "(setenv \"PATH\" \"$PATH\")" > /dev/null + +# Update exec-path for native Emacs executable resolution +emacsclient --eval "(setq exec-path (append (parse-colon-path \"$PATH\") (list exec-directory)))" > /dev/null + +echo "Emacs environment synchronized for project: $PROJECT" diff --git a/shared/tool/version b/shared/tool/version index 74007d0..6f36aa7 100755 --- a/shared/tool/version +++ b/shared/tool/version @@ -1,3 +1,3 @@ -echo "Harmony v3.2 2026-05-31" +echo "Harmony v3.3 2026-06-21 13:20:18 Z"