--- /dev/null
+#ifndef GREETER_LIB_C
+#define GREETER_LIB_C
+#ifndef FACE
+ #define GREETER_IMPL
+#endif
+
+#define FACE
+#include "math.lib.c"
+#undef FACE
+
+void Greet·hello_loop(int count);
+
+#ifdef GREETER_IMPL
+
+#include <stdio.h>
+
+void Greet·hello_loop(int count){
+ for(int TM = 0; TM < count; ++TM){
+ int current_count = Math·add(TM ,1);
+ printf("Hello iteration: %d\n" ,current_count);
+ }
+}
+
+#endif // GREETER_IMPL
+#endif // GREETER_LIB_C
+
+#include <stdlib.h>
#include <stdio.h>
-int main(void){ puts("hello from Rabbit CLI"); return 0; }
+
+#define FACE
+#include "math.lib.c"
+#include "greeter.lib.c"
+#undef FACE
+
+void CLI(void){
+ int base_count = Math·add(1 ,2);
+ printf("Calculated base loop count: %d\n" ,base_count);
+ Greet·hello_loop(base_count);
+}
+
+int main(int argc ,char **argv){
+ (void)argc;
+ (void)argv;
+
+ CLI();
+
+ return EXIT_SUCCESS;
+}
--- /dev/null
+#ifndef MATH_LIB_C
+#define MATH_LIB_C
+
+#ifndef FACE
+ #define MATH_IMPL
+#endif
+
+int Math·add(int a ,int b);
+
+#ifdef MATH_IMPL
+
+int Math·add(int a ,int b){
+ return a + b;
+}
+
+#endif // MATH_IMPL
+#endif // MATH_LIB_C
set -e
set -x
- cd "$REPO_HOME"/developer || exit 1
+ cd "$REPO_HOME/developer" || exit 1
/bin/make -f tool/makefile $@
set +x
.EXPORT_ALL_VARIABLES:
RT_MAKEFILE_DP := $(REPO_HOME)/shared/tool/makefile
-include $(RT_MAKEFILE_DP)/environment_RT_1.mk
+include $(RT_MAKEFILE_DP)/Harmony.mk
.PHONY: usage
usage:
--- /dev/null
+# tool/shared/Harmony.mk
+# makefile environment variable defaults.
+# cc is the name of the C compiler, a file called <name>.c is C source code.
+# RT uses header integrated C source files, i.e. the source and the header are the same file
+
+SHELL=/bin/bash
+
+ECHO := printf "%b\n"
+
+C_SOURCE_DIR ?= authored
+C ?= gcc
+CFLAGS ?= -std=gnu11 -Wall -Wextra -Wpedantic -finput-charset=UTF-8
+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))
+
+BUILD_DIR ?= scratchpad/build
+OBJECT_DIR ?= $(BUILD_DIR)/object
+LIBRARY_DIR ?= scratchpad/made
+MACHINE_DIR ?= scratchpad/made
+
+LIBRARY_FILE ?= $(LIBRARY_DIR)/lib$(LIBRARY_NAME).a
+
+LN_FLAGS ?= -L$(LIBRARY_DIR) -L/lib64 -L/lib -l$(LIBRARY_NAME)
+
+KMOD_SOURCE_DIR ?= authored
+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
+++ /dev/null
-#ifndef RT·ENVIRONMENT_H
-#define RT·ENVIRONMENT_H
- #include <stdint.h>
- #include <stdbool.h>
-
- typedef unsigned int uint;
-
- #define Local static
- #define Free(pt) free(pt); (pt) = NULL;
-
-#endif
--- /dev/null
+#ifndef RT_global_H
+#define RT_global_H
+ #include <stdint.h>
+ #include <stdbool.h>
+
+ typedef unsigned int uint;
+
+ #define Local static
+ #define Free(pt) free(pt); (pt) = NULL;
+
+#endif
+++ /dev/null
-# enviroment_RT_1.mk
-# makefile environment variable defaults.
-# cc is the name of the C compiler, a file called <name>.c is C source code.
-# RT uses header integrated C source files, i.e. the source and the header are the same file
-
-SHELL=/bin/bash
-
-# environment_RT_1.mk
-
-ECHO := printf "%b\n"
-
-C_SOURCE_DIR := authored
-C := gcc
-CFLAGS := -std=gnu11 -Wall -Wextra -Wpedantic -finput-charset=UTF-8
-CFLAGS += -MMD -MP
-CFLAGS += -I $(C_SOURCE_DIR)
-
-LIBRARY_NAME := $(PROJECT)
-LIBRARY_NAME := $(subst -,_,$(LIBRARY_NAME))
-
-LIBRARY_DIR := scratchpad
-LIBRARY_FILE := $(LIBRARY_DIR)/lib$(LIBRARY_NAME).a
-
-LN_FLAGS := -L$(LIBRARY_DIR) -L/lib64 -L/lib
-
-MACHINE_DIR := scratchpad/made
-
-KMOD_SOURCE_DIR := cc
-KMOD_CCFLAGS := -I $(KMOD_SOURCE_DIR)
-KMOD_OUTPUT_DIR := scratchpad/kmod
#--------------------------------------------------------------------------------
# defaults for environment variables
-C ?= gcc
-CFLAGS ?=
-C_SOURCE_DIR ?= cc
-BUILD_DIR ?= scratchpad/build
-LIBRARY_FILE ?= $(BUILD_DIR)/made/lib$(PROJECT).a
-MACHINE_DIR ?= $(BUILD_DIR)/made
-OBJECT_DIR ?= $(BUILD_DIR)/object
-LN_FLAGS ?=
+C ?= cc
+CFLAGS ?= -O2 -Wall -Wextra -pedantic
+C_SOURCE_DIR ?= src
+OBJECT_DIR ?= obj
+LIBRARY_DIR ?= lib
+MACHINE_DIR ?= bin
+LN_FLAGS ?= -L$(LIBRARY_DIR) -L/usr/local/lib -L/usr/lib
#--------------------------------------------------------------------------------
# derived variables