From 1d82cd8e431298dc4d441944af16a70ceb3f7425 Mon Sep 17 00:00:00 2001 From: Thomas Walker Lynch Date: Wed, 4 Sep 2024 05:33:03 +0000 Subject: [PATCH] rm deprecated files, makefile tweaks, documentation is for the ologist .. dunno --- developer/deprecated/build.gradle | 269 --------------- developer/deprecated/env_build_2 | 127 ------- developer/deprecated/makefil_clean | 105 ------ developer/deprecated/makefile3 | 84 ----- developer/deprecated/makefile4 | 102 ------ developer/deprecated/makefile_0 | 237 ------------- developer/deprecated/makefile_1 | 323 ------------------ developer/executor/#makefile-project.mk# | 117 +++++++ developer/executor/env_build | 6 + developer/executor/make | 2 +- developer/executor/makefile | 27 -- .../{makefile-project => makefile-project.mk} | 85 ++--- .../{makefile-tool => makefile-tool.mk} | 0 developer/executor/makefile-top.mk | 33 ++ .../#rule_list.txt# | 0 .../{documentation => ologist}/.githolder | 0 .../Cypher_GQL_differences.txt | 0 .../GQL_20240412_rule_list.txt | 0 .../{documentation => ologist}/rule_list.txt | 0 .../rules_by_catebory.txt | 0 .../rules_by_category.html | 0 .../terminal_symbol_list.txt | 0 .../terminal_symbol_list_unsorted.txt | 0 {documentation => ologist}/README.md | 0 .../directory_structure.md | 0 {documentation => ologist}/for_developers.md | 0 {documentation => ologist}/log.md | 0 27 files changed, 204 insertions(+), 1313 deletions(-) delete mode 100644 developer/deprecated/build.gradle delete mode 100755 developer/deprecated/env_build_2 delete mode 100644 developer/deprecated/makefil_clean delete mode 100644 developer/deprecated/makefile3 delete mode 100644 developer/deprecated/makefile4 delete mode 100644 developer/deprecated/makefile_0 delete mode 100644 developer/deprecated/makefile_1 create mode 100644 developer/executor/#makefile-project.mk# delete mode 100644 developer/executor/makefile rename developer/executor/{makefile-project => makefile-project.mk} (57%) rename developer/executor/{makefile-tool => makefile-tool.mk} (100%) create mode 100644 developer/executor/makefile-top.mk rename developer/{documentation => ologist}/#rule_list.txt# (100%) rename developer/{documentation => ologist}/.githolder (100%) rename developer/{documentation => ologist}/Cypher_GQL_differences.txt (100%) rename developer/{documentation => ologist}/GQL_20240412_rule_list.txt (100%) rename developer/{documentation => ologist}/rule_list.txt (100%) rename developer/{documentation => ologist}/rules_by_catebory.txt (100%) rename developer/{documentation => ologist}/rules_by_category.html (100%) rename developer/{documentation => ologist}/terminal_symbol_list.txt (100%) rename developer/{documentation => ologist}/terminal_symbol_list_unsorted.txt (100%) rename {documentation => ologist}/README.md (100%) rename {documentation => ologist}/directory_structure.md (100%) rename {documentation => ologist}/for_developers.md (100%) rename {documentation => ologist}/log.md (100%) diff --git a/developer/deprecated/build.gradle b/developer/deprecated/build.gradle deleted file mode 100644 index 50966c6..0000000 --- a/developer/deprecated/build.gradle +++ /dev/null @@ -1,269 +0,0 @@ -// OpenAI assisted generation from the makefile .. a start on a gradle build file - -plugins { - id 'java' -} - -group 'com.example' -version '1.0-SNAPSHOT' - -sourceCompatibility = 1.8 - -repositories { - mavenCentral() -} - -dependencies { - implementation 'org.antlr:antlr4:4.9.2' // Include the ANTLR runtime library - testImplementation 'junit:junit:4.12' // Include JUnit for testing -} - -// Define environment variables -def javaHome = System.getenv('JAVA_HOME') -def antlrJar = file(System.getenv('ANTLR_JAR')) - -// Define directories -def antlrPrimaryDir = 'ANTLR' -def antlrInDir = "${antlrPrimaryDir}" -def antlrOutDir = 'javac/ANTLR' -def antlrOutDirParent = 'javac' -def tempDir = 'temporary' -def executorDir = 'executor' -def jvmOutDir = 'jvm' - -// Define program paths -def programPrintRuleNameList = "${executorDir}/PrintRuleNameList" -def programSyntaxTreeTest = "${executorDir}/SyntaxTree_Test" -def programSyntaxTree20240412 = "${executorDir}/SyntaxTree_20240412" - -// Define grammar files -def grammarFiles = fileTree(dir: antlrInDir, include: '**/*.g4') - -// Task to set up directories -task setup { - doLast { - mkdir antlrInDir - mkdir antlrOutDirParent - mkdir 'javac' - mkdir jvmOutDir - mkdir executorDir - mkdir 'test' - mkdir 'deprecated' - mkdir 'experiment' - mkdir 'documentation' - mkdir tempDir - } -} - -// Function to generate grammar tasks -def generateGrammarTask(String grammarName) { - task "generate${grammarName}Grammar" { - inputs.file file("${antlrInDir}/${grammarName}.g4") - outputs.dir antlrOutDir - - doLast { - println "Generating grammar files for: ${grammarName}" - exec { - commandLine "${javaHome}/bin/java", '-jar', antlrJar, '-Dlanguage=Java', '-visitor', '-o', antlrOutDirParent, file("${antlrInDir}/${grammarName}.g4") - } - } - } -} - -// Generate grammar tasks for each grammar file -grammarFiles.each { File file -> - def grammarName = file.name.replace('.g4', '') - generateGrammarTask(grammarName) -} - -// Define source sets -sourceSets { - main { - java { - srcDirs = ['javac', antlrOutDir] - } - } -} - -// Task to compile Java files -task compileJava(type: JavaCompile) { - source = sourceSets.main.java - classpath = sourceSets.main.compileClasspath - destinationDir = file(jvmOutDir) -} - -// Task to build JAR file -task buildJar(type: Jar) { - from compileJava.destinationDir - archiveBaseName.set('project') - destinationDirectory.set(file(jvmOutDir)) -} - -// Task to create an executable script -task createScript { - dependsOn buildJar - - doLast { - def jarFile = buildJar.archiveFile.get().asFile - def scriptFile = file("${executorDir}/${project.name}") - - scriptFile.text = """#!/usr/bin/env bash -${javaHome}/bin/java -cp ${jarFile} ${project.name} -""" - scriptFile.setExecutable(true) - } -} - -// Task to clean generated files -task clean(type: Delete) { - delete antlrOutDir - delete jvmOutDir - delete tempDir - delete programPrintRuleNameList - delete programSyntaxTreeTest - delete programSyntaxTree20240412 - delete fileTree(dir: executorDir, exclude: '.githolder') -} - -// Task to print version information -task printVersion { - doLast { - println "ANTLR Jar: ${antlrJar.name}" - println "Java version: ${javaHome}/bin/java -version".execute().text - println "Jar version: ${javaHome}/bin/jar --version".execute().text - println "Gradle version: ${gradle.gradleVersion}" - } -} - -// Default tasks -defaultTasks 'setup', 'generateGQLGrammar', 'compileJava', 'buildJar', 'createScript' - -// Set encoding for JavaCompile tasks -tasks.withType(JavaCompile) { - options.encoding = 'UTF-8' -} - -// Task to build everything -task all { - dependsOn setup, 'generateGQLGrammar', compileJava, buildJar, createScript -} - -// Task to generate grammar files -task grammar { - dependsOn setup, 'generateGQLGrammar' -} - -// Task to compile Java files -task java { - dependsOn setup, compileJava -} - -// Task to clean temporary files -task cleanTemporary(type: Delete) { - delete tempDir -} - -// Task to clean all files -task cleanAll { - dependsOn clean -} - -// Task to clean all files except program files -task cleanAllMinus { - doLast { - delete tempDir - delete antlrOutDir - delete fileTree(dir: jvmOutDir, include: '**/*.class') - } -} - -// Task to clean program files -task cleanProgram { - doLast { - delete programPrintRuleNameList - delete programSyntaxTreeTest - delete programSyntaxTree20240412 - } -} - -// Task to clean class files -task cleanClass { - doLast { - delete fileTree(dir: jvmOutDir, include: '**/*.class') - } -} - -// Task to clean grammar files -task cleanGrammar { - doLast { - delete fileTree(dir: antlrOutDir, include: '**/*.java') - } -} - -// Task to clean a specific program -task cleanProgramSpecific { - doLast { - def programName = project.findProperty('program') ?: '' - if (programName) { - delete fileTree(dir: jvmOutDir, include: "${programName}.jar") - delete fileTree(dir: executorDir, include: "${programName}") - } else { - println "Usage: gradle cleanProgramSpecific -Pprogram=" - } - } -} - -// Task to clean a specific program and everything else -task cleanProgramPlusSpecific { - doLast { - def programName = project.findProperty('program') ?: '' - if (programName) { - delete fileTree(dir: jvmOutDir, include: "${programName}.jar") - delete fileTree(dir: executorDir, include: "${programName}") - delete tempDir - delete antlrOutDir - } else { - println "Usage: gradle cleanProgramPlusSpecific -Pprogram=" - } - } -} - -// Task to clean a specific program and everything else except program files -task cleanProgramMinusSpecific { - doLast { - def programName = project.findProperty('program') ?: '' - if (programName) { - delete fileTree(dir: jvmOutDir, include: "${programName}.jar") - delete fileTree(dir: executorDir, include: "${programName}") - delete tempDir - delete fileTree(dir: jvmOutDir, include: '**/*.class') - } else { - println "Usage: gradle cleanProgramMinusSpecific -Pprogram=" - } - } -} - -// Task to clean a specific grammar -task cleanGrammarSpecific { - doLast { - def grammarName = project.findProperty('grammar') ?: '' - if (grammarName) { - delete fileTree(dir: antlrOutDir, include: "${grammarName}*") - } else { - println "Usage: gradle cleanGrammarSpecific -Pgrammar=" - } - } -} - -// Define tasks for each program -task buildPrintRuleNameList { - dependsOn setup, 'generateGQLGrammar', compileJava -} - -task buildSyntaxTreeTest { - dependsOn setup, 'generateSyntaxTreeGrammar', compileJava -} - -task buildSyntaxTree20240412 { - dependsOn setup, 'generateSyntaxTree20240412Grammar', compileJava -} diff --git a/developer/deprecated/env_build_2 b/developer/deprecated/env_build_2 deleted file mode 100755 index ea2ba30..0000000 --- a/developer/deprecated/env_build_2 +++ /dev/null @@ -1,127 +0,0 @@ -#!/usr/bin/env bash - -# Ensure the script is sourced -if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then - echo "This script must be sourced, not executed. Exiting." - return 1 -fi - - -# Note these suffixes: -# _FL = File List -# _FPL = File Path List -# _DL = Directory List - -# _PRIMARY = stuff not built -# _IN things input to some program -# _OUT things output by some program - -#-------------------------------------------------------------------------------- -# directories -# - -# ANTLR directories -export ANTLR_IN_PRIMARY_DIR="ANTLR" -export ANTLR_OUT_DIR="javac/ANTLR" -export ANTLR_OUT_DIR_PARENT="javac" - -# JAVA directories -export JAVA_COMP_IN_PRIMARY_DIR="javac" -export JAVA_COMP_IN_ANTLR_DIR="${ANTLR_OUT_DIR}" -export JAVA_COMP_IN_DL="${JAVA_COMP_IN_PRIMARY_DIR}:${JAVA_COMP_IN_ANTLR_DIR}" -export JAVA_COMP_OUT_DIR="jvm" - -# JVM -export JVM_IN_DIR="${JAVA_COMP_OUT_DIR}" -export CLASSPATH="${CLASSPATH}:${JVM_IN_DIR}" - -#-------------------------------------------------------------------------------- -# tools used -# -# set by project manager: JAVA_HOME, ANTLR_JAR, DEVELOPER_HOME -# -export JAVA_COMP="${JAVA_HOME}/bin/javac" -export JAVA_INTERP="${JAVA_HOME}/bin/java" -export JAVA_ARCHIVE="${JAVA_HOME}/bin/jar" -export CLASSPATH="$ANTLR_JAR" - -#-------------------------------------------------------------------------------- -# to be built -# -export PROGRAM_PrintRuleNameList="executor/PrintRuleNameList" -export PROGRAM_SyntaxTree_Test="executor/SyntaxTree_Test" -export PROGRAM_SyntaxTree_20240412="executor/SyntaxTree_20240412" - -# an all programs list -export PROGRAM_FPL="${PROGRAM_PrintRuleNameList} ${PROGRAM_SyntaxTree_Test} ${PROGRAM_SyntaxTree_20240412}" - -#-------------------------------------------------------------------------------- -# misc -# -export TEMP_DIR="$DEVELOPER_HOME"/temporary - -#-------------------------------------------------------------------------------- -# ANTLR files -# - -export ANTLR_IN_FPL=$(ls ${ANTLR_IN_PRIMARY_DIR}/*.g4 2>/dev/null) -export ANTLR_GRAMMAR_LIST=$(basename -s .g4 ${ANTLR_IN_FPL}) -if [ -z "${ANTLR_IN_FPL}" ]; then - echo "No ANTLR input grammar files found" -fi - -# This function accepts a grammar name, or a grammar name with an extension; -# and sets a variable of the form ANTLR_OUT__FPL to a list of -# files that ANTLR would produce for . -set_ANTLR_out_fpl_var() { - local grammar=$1 - export ANTLR_OUT_${grammar}_FPL="${ANTLR_OUT_DIR}/${grammar}Lexer.java ${ANTLR_OUT_DIR}/${grammar}Parser.java ${ANTLR_OUT_DIR}/${grammar}BaseVisitor.java ${ANTLR_OUT_DIR}/${grammar}Visitor.java" -} - -# Generate ANTLR_OUT__FPL for each grammar -for grammar in ${ANTLR_GRAMMAR_LIST}; do - set_ANTLR_out_fpl_var ${grammar} -done - -# Combine all individual file lists into ANTLR_OUT_FPL -ANTLR_OUT_FPL="" -for grammar in ${ANTLR_GRAMMAR_LIST}; do - ANTLR_OUT_FPL="${ANTLR_OUT_FPL} $(eval echo \$ANTLR_OUT_${grammar}_FPL)" -done -export ANTLR_OUT_FPL - -#-------------------------------------------------------------------------------- -# Java files -# - -# JAVA input files -export JAVA_COMP_IN_PRIMARY_FPL=$(ls ${JAVA_COMP_IN_PRIMARY_DIR}/*.java 2>/dev/null) -export JAVA_COMP_IN_ANTLR_FPL=${ANTLR_OUT_FPL} -export JAVA_COMP_IN_FPL="${JAVA_COMP_IN_PRIMARY_FPL} ${JAVA_COMP_IN_ANTLR_FPL}" - -# JAVA will produce these output files -export JAVA_COMP_OUT_PRIMARY_FPL=$(echo ${JAVA_COMP_IN_PRIMARY_FPL} | sed "s|${JAVA_COMP_IN_PRIMARY_DIR}/|${JAVA_COMP_OUT_DIR}/|g" | sed "s|.java|.class|g") -export JAVA_COMP_OUT_ANTLR_FPL=$(echo ${JAVA_COMP_IN_ANTLR_FPL} | sed "s|${JAVA_COMP_IN_ANTLR_DIR}/|${JAVA_COMP_OUT_DIR}/|g" | sed "s|.java|.class|g") -export JAVA_COMP_OUT_FPL="${JAVA_COMP_OUT_PRIMARY_FPL} ${JAVA_COMP_OUT_ANTLR_FPL}" - -#-------------------------------------------------------------------------------- -# JAR files -# - -# List of JAR files to be built -JAR_OUT_FPL="" -for program_path in ${PROGRAM_FPL}; do - program_name=$(basename ${program_path}) - class_file="${JAVA_COMP_OUT_DIR}/${program_name}.class" - # Check if the .class file is in JAVA_COMP_OUT_FPL - for item in ${JAVA_COMP_OUT_FPL}; do - # if so add it to the JAR_OUT_FPL - if [[ "${item}" == "${class_file}" ]]; then - jar_file="${JAVA_COMP_OUT_DIR}/${program_name}.jar" - JAR_OUT_FPL="${JAR_OUT_FPL} ${jar_file}" - break - fi - done -done -export JAR_OUT_FPL - diff --git a/developer/deprecated/makefil_clean b/developer/deprecated/makefil_clean deleted file mode 100644 index 7cc647e..0000000 --- a/developer/deprecated/makefil_clean +++ /dev/null @@ -1,105 +0,0 @@ -# 1. clean:temporary - removes files from ./temporary -# 2. General clean targets: -# clean:all - removes all things make built, and thus can be replaced by running make again. -# clean:all- (minus after the all) same as clean:all except for the program files (and their .jar if any) -# clean:program - all program files, i.e. ./exector/ and ./jvm/ for all programs. -# clean:class - class files -# clean:grammar - all generated grammar files - -# 2. -# clean:program: -# similear to clean:program, but only for the named program - -# clean:program+: -# bascially clean:all but only for the named program - -# clean:program-: -# baiscally clean:all- but only for the named program - -# 3. clean:grammar: -# siimilar to clean:grammar, but only for the named grammar - -# Function to clean a list of files -# Accepts a list of files as an argument and deletes the files in the list -# without complaining if a file is not found -define clean_files - echo "Cleaning files: $1";\ - for file in $1; do \ - if [ -e "$$file" ]; then \ - echo rm -f "$$file"; \ - rm -f "$$file"; \ - fi; \ - done -endef - - -# Function to clean the contents of a directory -# Accepts a directory as an argument, checks that the argument is not empty, -# ensures the directory exists, and then deletes the contents of the directory -# (excluding a file called .githolder) -define clean_directory - if [ -z "$1" ]; then \ - echo "Error: Directory argument is empty"; \ - elif [ ! -d "$1" ]; then \ - echo "Error: Directory $1 does not exist"; \ - else \ - : echo "Cleaning directory: $1"; \ - find "$1" -mindepth 1 -maxdepth 1 ! -name '.githolder' -exec rm -rf {} +; \ - touch "$1/.githolder"; \ - fi -endef - -# Function to handle individual cleaning -# Accepts a single option and removes the appropriate files -define do_clean - echo "Cleaning files for option: $1";\ - if [ "$1" = "" ]; then \ - echo "Usage: make clean:< all[-] | program[+/-][:] | grammar[:] | class | temp[orary] >"; \ - elif [ "$1" = "temporary" -o "$1" = "temp" ]; then \ - $(call clean_directory,$(TEMP_DIR)); \ - elif [ "$1" = "all" ]; then \ - $(call clean_directory,$(TEMP_DIR)); \ - $(call clean_files,$(ANTLR_OUT_FPL)); \ - $(call clean_files,$(JAVA_COMP_OUT_FPL)); \ - $(call clean_files,$(PROGRAM_FPL)); \ - elif [ "$1" = "all-" ]; then \ - $(call clean_directory,$(TEMP_DIR)); \ - $(call clean_files,$(ANTLR_OUT_FPL)); \ - $(call clean_files,$(JAVA_COMP_OUT_PRIMARY_FPL)); \ - elif [ "$1" = "program" ]; then \ - $(call clean_files,$(PROGRAM_FPL)); \ - elif [ "$1" = "class" ]; then \ - $(call clean_files,$(JAVA_COMP_OUT_FPL)); \ - elif [ "$1" = "grammar" ]; then \ - $(call clean_files,$(ANTLR_OUT_FPL)); \ - elif [ "$1" = "program:"* ]; then \ - program_name=$${1#program:}; \ - $(call clean_files,$(JAVA_COMP_OUT_DIR)/$${program_name}.jar executor/$${program_name}); \ - elif [ "$1" = "program+:"* ]; then \ - program_name=$${1#program+:}; \ - $(call clean_files,$(JAVA_COMP_OUT_DIR)/$${program_name}.jar executor/$${program_name}); \ - $(call clean_directory,$(TEMP_DIR)); \ - $(call clean_files,$(ANTLR_OUT_FPL)); \ - elif [ "$1" = "program-:"* ]; then \ - program_name=$${1#program-:}; \ - $(call clean_files,$(JAVA_COMP_OUT_DIR)/$${program_name}.jar executor/$${program_name}); \ - $(call clean_directory,$(TEMP_DIR)); \ - $(call clean_files,$(JAVA_COMP_OUT_PRIMARY_FPL)); \ - elif [ "$1" = "grammar:"* ]; then \ - grammar_name=$${1#grammar:}; \ - $(call clean_files,$(ANTLR_OUT_DIR)/$${grammar_name}*); \ - else \ - echo "Unknown clean option: $1"; \ - fi -endef - -# Default clean target -.PHONY: clean -clean: - @echo "Usage: make clean:< all[-] | program[+/-][:] | grammar[:] | class | temp[orary] >" - -# Clean specific program or option -# Calls the do_clean function with the pattern as an argument -.PHONY: clean\:% -clean\:%: - @$(call do_clean,$*) diff --git a/developer/deprecated/makefile3 b/developer/deprecated/makefile3 deleted file mode 100644 index 251ac90..0000000 --- a/developer/deprecated/makefile3 +++ /dev/null @@ -1,84 +0,0 @@ -#================================================================================ -# Make targets -# - -all: setup $(PROGRAM_FPL) - -SyntaxTree_Test: $(ANTLR_OUT_GQL_Test_FPL) - make $(PROGRAM_SyntaxTree_Test) - -SyntaxTree_20240412: $(ANTLR_OUT_GQL_20240412_FPL) - make $(PROGRAM_SyntaxTree_20240412) - -PrintRuleNameList: $(PROGRAM_PrintRuleNameList) - -grammar: setup $(ANTLR_OUT_FPL) - -# Compile all the .java files. -java: setup $(JAVA_COMP_OUT_FPL) - -# Specific grammar targets. Run them like this: -# > make -# e.g. > make GQL_test -$(foreach grammar,$(ANTLR_GRAMMAR_LIST),$(eval $(grammar): $(value ANTLR_OUT_$(grammar)_FPL))) - -.PHONY: version -version: - $(info ANTLR_JAR is '$(notdir $(ANTLR_JAR))') - @ $(JAVA_COMP) --version - @ $(JAVA_ARCHIVE) --version - @ make -v | head -n 1 - @ echo "makefile 0.2" - -.PHONY: setup -# ANTLR automatically creates $(ANTLR_OUT_DIR) -setup: - mkdir -p $(ANTLR_IN_DIR) $(JAVA_COMP_IN_PRIMARY_DIR) $(JVM_IN_DIR) - mkdir -p executor test deprecated experiment documentation temporary - -# Default clean target -.PHONY: setup -clean: - @echo "Use the clean script from the executor directory instead of \`make clean\`" - @executor/clean - -#useful for distinguishing initial make error messages and message generated by rules firing -nothing: - @: - -#================================================================================ -# recipes - -# Without this, GNU make deletes .jar files after making them. -# Surely this is part of a spat between GNU and Sun Microsysitems, where they -# now produce tools that delete each others files ;-) -.PRECIOUS: $(JAVA_COMP_OUT_DIR)/%.jar - -$(ANTLR_OUT_DIR)/%Lexer.java \ -$(ANTLR_OUT_DIR)/%Parser.java \ -$(ANTLR_OUT_DIR)/%BaseVisitor.java \ -$(ANTLR_OUT_DIR)/%Visitor.java: $(ANTLR_IN_DIR)/%.g4 - @echo "making grammar from:" $< - $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $< - -# Rule to build .class files from .java files -$(JAVA_COMP_OUT_DIR)/%.class: $(JAVA_COMP_IN_PRIMARY_DIR)/%.java - @echo "Compiling $<..." - $(JAVA_COMP) -d $(JAVA_COMP_OUT_DIR) -sourcepath $(JAVA_COMP_IN_DL) $< - @echo "Created $@" - -# Rule to build .jar files from .class files -$(JAVA_COMP_OUT_DIR)/%.jar: $(JAVA_COMP_OUT_DIR)/%.class - @echo "Building $*..." - $(JAVA_ARCHIVE) cf $@ -C $(JAVA_COMP_OUT_DIR) $*.class - @echo "Created $@" - -# Rule to create executable scripts from .jar files -executor/%: $(JAVA_COMP_OUT_DIR)/%.jar - @echo "Creating script for $*..." - @echo "#!/usr/bin/env bash" > executor/$* - @echo "$(JAVA_INTERP) -cp $< $*" \$$\@ >> executor/$* - chmod +x executor/$* - @echo "Created script executor/$*" - - diff --git a/developer/deprecated/makefile4 b/developer/deprecated/makefile4 deleted file mode 100644 index 288194f..0000000 --- a/developer/deprecated/makefile4 +++ /dev/null @@ -1,102 +0,0 @@ -# Makefile version 0.2.6cp - -#================================================================================ -# recipes - -# Without this, GNU make deletes .jar files after making them. -# Surely this is part of a spat between GNU and Sun Microsysitems, where they -# now produce tools that delete each others files ;-) -.PRECIOUS: $(JAVA_COMP_OUT_DIR)/%.jar - -# Rule to generate grammar files from .g4 files -$(ANTLR_OUT_DIR)/GQL_20240412Lexer.java: $(ANTLR_IN_PRIMARY_DIR)/GQL_20240412.g4 - @echo "making grammar from:" $< - $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $< - -$(ANTLR_OUT_DIR)/GQL_20240412Parser.java: $(ANTLR_IN_PRIMARY_DIR)/GQL_20240412.g4 - @echo "making grammar from:" $< - $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $< - -$(ANTLR_OUT_DIR)/GQL_20240412BaseVisitor.java: $(ANTLR_IN_PRIMARY_DIR)/GQL_20240412.g4 - @echo "making grammar from:" $< - $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $< - -$(ANTLR_OUT_DIR)/GQL_20240412Visitor.java: $(ANTLR_IN_PRIMARY_DIR)/GQL_20240412.g4 - @echo "making grammar from:" $< - $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $< - -$(ANTLR_OUT_DIR)/GQL_testLexer.java: $(ANTLR_IN_PRIMARY_DIR)/GQL_test.g4 - @echo "making grammar from:" $< - $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $< - -$(ANTLR_OUT_DIR)/GQL_testParser.java: $(ANTLR_IN_PRIMARY_DIR)/GQL_test.g4 - @echo "making grammar from:" $< - $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $< - -$(ANTLR_OUT_DIR)/GQL_testBaseVisitor.java: $(ANTLR_IN_PRIMARY_DIR)/GQL_test.g4 - @echo "making grammar from:" $< - $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $< - -$(ANTLR_OUT_DIR)/GQL_testVisitor.java: $(ANTLR_IN_PRIMARY_DIR)/GQL_test.g4 - @echo "making grammar from:" $< - $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $< - -# Rule to build .class files from .java files in both primary and ANTLR directories -$(JAVA_COMP_OUT_DIR)/%.class: $(JAVA_COMP_IN_PRIMARY_DIR)/%.java $(JAVA_COMP_IN_ANTLR_DIR)/%.java - @echo "Compiling $<..." - $(JAVA_COMP) -d $(JAVA_COMP_OUT_DIR) -sourcepath $(JAVA_COMP_IN_DL) $< - @echo "Created $@" - -# Rule to build .jar files from .class files -$(JAVA_COMP_OUT_DIR)/%.jar: $(JAVA_COMP_OUT_DIR)/%.class - @echo "Building $*..." - $(JAVA_ARCHIVE) cf $@ -C $(JAVA_COMP_OUT_DIR) $*.class - @echo "Created $@" - -# Rule to create executable scripts from .jar files -executor/%: $(JAVA_COMP_OUT_DIR)/%.jar - @echo "Creating script for $*..." - @echo "#!/usr/bin/env bash" > executor/$* - @echo "$(JAVA_INTERP) -cp $< $*" \$$\@ >> executor/$* - chmod +x executor/$* - @echo "Created script executor/$*" - -# Default target -all: setup $(PROGRAM_FPL) - -SyntaxTree_Test: $(ANTLR_OUT_GQL_Test_FPL) - make $(PROGRAM_SyntaxTree_Test) - -SyntaxTree_20240412: $(ANTLR_OUT_DIR)/GQL_20240412Lexer.java $(ANTLR_OUT_DIR)/GQL_20240412Parser.java $(ANTLR_OUT_DIR)/GQL_20240412BaseVisitor.java $(ANTLR_OUT_DIR)/GQL_20240412Visitor.java - make $(PROGRAM_SyntaxTree_20240412) - -PrintRuleNameList: $(PROGRAM_PrintRuleNameList) - -grammar: setup $(ANTLR_OUT_DIR)/GQL_20240412Lexer.java $(ANTLR_OUT_DIR)/GQL_20240412Parser.java $(ANTLR_OUT_DIR)/GQL_20240412BaseVisitor.java $(ANTLR_OUT_DIR)/GQL_20240412Visitor.java $(ANTLR_OUT_DIR)/GQL_testLexer.java $(ANTLR_OUT_DIR)/GQL_testParser.java $(ANTLR_OUT_DIR)/GQL_testBaseVisitor.java $(ANTLR_OUT_DIR)/GQL_testVisitor.java - -# Compile all the .java files. -java: setup $(JAVA_COMP_OUT_FPL) - -.PHONY: version -version: - $(info ANTLR_JAR is '$(notdir $(ANTLR_JAR))') - @ $(JAVA_COMP) --version - @ $(JAVA_ARCHIVE) --version - @ make -v | head -n 1 - @ echo "makefile 0.2.6cp" - -.PHONY: setup -# ANTLR automatically creates $(ANTLR_OUT_DIR) -setup: - mkdir -p $(ANTLR_IN_PRIMARY_DIR) $(JAVA_COMP_IN_PRIMARY_DIR) $(JVM_IN_DIR) - mkdir -p executor test deprecated experiment documentation temporary - -# Default clean target -.PHONY: clean -clean: - @echo "Use the clean script from the executor directory instead of \`make clean\`" - @executor/clean - -# Useful for distinguishing initial make error messages and message generated by rules firing -nothing: - @: diff --git a/developer/deprecated/makefile_0 b/developer/deprecated/makefile_0 deleted file mode 100644 index 5cea41c..0000000 --- a/developer/deprecated/makefile_0 +++ /dev/null @@ -1,237 +0,0 @@ -# GQL_to_Cypher makefile - -#================================================================================ -# Setup the environment -# -# Use `make variable` to print the value assigned to the variables in this section - -#---------------------------------------- -# some notes about setting variables. Save yourself some grief by reading this. -# - -# An example of setting a make variable. Embedded and trailing spaces are -# included in the value, there are 4 of each present in the value for -# ISLAND. Leading spaces are not included. If there is a comment starting with -# a hash, the trailing spaces leading up to it the hash will be included in the -# value. A `:=` will evaluate immediately. A `=` will evaluate at point of variable -# expansion. -ISLAND := land island - -# Note these abbreviations: -# FL = File List, out file lists are those we want make to create -# DL = Directory List - -#---------------------------------------- -# programs used by this makefile -# -JAVA_COMP := $(JAVA_HOME)/bin/javac -JAVA_INTERP := $(JAVA_HOME)/bin/java -JAVA_ARCHIVE := $(JAVA_HOME)/bin/jar - -#---------------------------------------- -# programs being built by this makefile: -# -PRINT_RULE_NAME_LIS := PrintRuleNameList -SYNTAX_TREE_TEST := SyntaxTree_Test -SYNTAX_TREE_20240412 := SyntaxTree_20240412 -# put your version here - -PROGRAM_LIST := $(PRINT_RULE_NAME_LIST) $(SYNTAX_TREE_TEST) $(SYNTAX_TREE_20240412) - -#---------------------------------------- -# ANTLR environment - -# ANTLR directories -ANTLR_IN_DIR := ANTLR -ANTLR_OUT_DIR := javac/ANTLR -ANTLR_OUT_DIR_PARENT := javac - -# ANTLR input files -ANTLR_IN_FL := $(wildcard $(ANTLR_IN_DIR)/*.g4) -ifneq ($(strip $(ANTLR_IN_FL)),) - ($info empty ANTLR_IN_FL) -endif - -# ANTLR will produce these output files. - -# This function accepts a grammar name, or a grammar name with an extension; -# and sets a variable of the form ANTLR_OUT__FL to a list of -# files that ANTLR would produce for . -define set_ANTLR_out_fl_var - ANTLR_OUT_$(basename $(notdir $1))_FL := \ - $(ANTLR_OUT_DIR)/$(basename $(notdir $1))Lexer.java \ - $(ANTLR_OUT_DIR)/$(basename $(notdir $1))Parser.java \ - $(ANTLR_OUT_DIR)/$(basename $(notdir $1))BaseVisitor.java \ - $(ANTLR_OUT_DIR)/$(basename $(notdir $1))Visitor.java -endef - -# Generate an ANTLR_OUT__FL and set it, for each grammar -$(foreach file,$(ANTLR_IN_FL),$(eval $(call set_ANTLR_out_fl_var,$(file)))) - -# Combine all individual file lists into ANTLR_OUT_FL -ANTLR_OUT_FL := $(foreach file,$(ANTLR_IN_FL),$(value ANTLR_OUT_$(basename $(notdir $(file)))_FL)) - - -#---------------------------------------- -# Java environment - -# JAVA directories -JAVA_COMP_IN_PRIMARY_DIR := javac -JAVA_COMP_IN_ANTLR_DIR := $(ANTLR_OUT_DIR) -JAVA_COMP_IN_DL := $(JAVA_COMP_IN_PRIMARY_DIR):$(JAVA_COMP_IN_ANTLR_DIR) -JAVA_COMP_OUT_DIR := jvm - -# JAVA input files -JAVA_COMP_IN_PRIMARY_FL := $(wildcard $(JAVA_COMP_IN_PRIMARY_DIR)/*.java) -JAVA_COMP_IN_ANTLR_FL := $(ANTLR_OUT_FL) -JAVA_COMP_IN_FL := $(JAVA_COMP_IN_PRIMARY_FL) $(JAVA_COMP_IN_ANTLR_FL) - -# JAVA will produce these output files -JAVA_COMP_OUT_PRIMARY_FL := $(patsubst $(JAVA_COMP_IN_PRIMARY_DIR)/%.java,$(JVM_IN_DIR)/%.class,$(JAVA_COMP_IN_PRIMARY_FL)) -JAVA_COMP_OUT_ANTLR_FL := $(patsubst $(JAVA_COMP_IN_ANTLR_DIR)/%.java,$(JVM_IN_DIR)/%.class,$(JAVA_COMP_IN_ANTLR_FL)) -JAVA_COMP_OUT_FL := $(JAVA_COMP_OUT_PRIMARY_FL) $(JAVA_COMP_OUT_ANTLR_FL) - -#---------------------------------------- -# JVM environment - -JVM_IN_DIR := $(JAVA_COMP_OUT_DIR) -CLASSPATH := $(CLASSPATH):$(JVM_IN_DIR) -export CLASSPATH - - -#================================================================================ -# Make targets -# - -# The general make everything targets: -all: setup $(PROGRAM_LIST) -grammar: setup $(ANTLR_OUT_FL) - -# specific programs or program versions: -PrintRuleNameList: PrintRuleNameList.jar -SyntaxTree_Test: $(ANTLR_OUT_SyntaxTree_Test_FL) SyntaxTree_Test.jar -SyntaxTree_20240412: $(ANTLR_OUT_SyntaxTree_20240412_FL) SyntaxTree_20240412.jar - -# Specific grammar targets. Run them like this: -# > make -# e.g. > make GQL_test -# Specific grammar targets. Run them like this: -# > make -# e.g. > make GQL_test - -# Specific grammar targets. Run them like this: -# > make -# e.g. > make GQL_test -define generate_grammar_target -grammar_name := $(basename $(notdir $1)) -$(info Generating target: $(grammar_name) with dependencies: $(value ANTLR_OUT_$(grammar_name)_FL)) -$(basename $(notdir $1)): $(value ANTLR_OUT_$(basename $(notdir $1))_FL) -endef -$(foreach file,$(ANTLR_IN_FL),$(eval $(call generate_grammar_target,$(file)))) - - -# Compile all the .java files. -java: setup $(JAVA_COMP_OUT_FL) - -# print out all variables within quotes so that spaces can be detected -.PHONY: variable -variable: - $(info ISLAND is '$(ISLAND)') - - $(info PRINT_RULE_NAME_LIST is '$(PRINT_RULE_NAME_LIST)') - $(info SYNTAX_TREE_TEST is '$(SYNTAX_TREE_TEST)') - $(info SYNTAX_TREE_20240412 is '$(SYNTAX_TREE_20240412)') - $(info PROGRAM_LIST is '$(PROGRAM_LIST)') - - $(info JAVA_COMP is '$(JAVA_COMP)') - $(info JAVA_INTERP is '$(JAVA_INTERP)') - $(info JAVA_ARCHIVE is '$(JAVA_ARCHIVE)') - - $(info ANTLR_IN_DIR is '$(ANTLR_IN_DIR)') - $(info ANTLR_OUT_DIR is '$(ANTLR_OUT_DIR)') - $(info ANTLR_OUT_DIR_PARENT is '$(ANTLR_OUT_DIR_PARENT)') - $(info ANTLR_IN_FL is '$(ANTLR_IN_FL)') - $(foreach file,$(ANTLR_IN_FL),$(info ANTLR_OUT_$(basename $(notdir $(file)))_FL is '$(value ANTLR_OUT_$(basename $(notdir $(file)))_FL)')) - $(info ANTLR_OUT_FL is '$(ANTLR_OUT_FL)') - - $(info JAVA_COMP_IN_PRIMARY_DIR is '$(JAVA_COMP_IN_PRIMARY_DIR)') - $(info JAVA_COMP_IN_ANTLR_DIR is '$(JAVA_COMP_IN_ANTLR_DIR)') - $(info JAVA_COMP_IN_DL is '$(JAVA_COMP_IN_DL)') - $(info JAVA_COMP_OUT_DIR is '$(JAVA_COMP_OUT_DIR)') - - $(info JAVA_COMP_IN_PRIMARY_FL is '$(JAVA_COMP_IN_PRIMARY_FL)') - $(info JAVA_COMP_IN_ANTLR_FL is '$(JAVA_COMP_IN_ANTLR_FL)') - $(info JAVA_COMP_IN_FL is '$(JAVA_COMP_IN_FL)') - - $(info JAVA_COMP_OUT_PRIMARY_FL is '$(JAVA_COMP_OUT_PRIMARY_FL)') - $(info JAVA_COMP_OUT_ANTLR_FL is '$(JAVA_COMP_OUT_ANTLR_FL)') - $(info JAVA_COMP_OUT_FL is '$(JAVA_COMP_OUT_FL)') - - $(info JVM_IN_DIR is '$(JVM_IN_DIR)') - $(info CLASSPATH is '$(CLASSPATH)') - @: - -.PHONY: version -version: - $(info ANTLR_JAR is '$(notdir $(ANTLR_JAR))') - @ $(JAVA_COMP) --version - @ $(JAVA_ARCHIVE) --version - @ make -v | head -n 1 - @ echo "makefile 0.1" - -.PHONY: setup -setup: - # ANTLR automatically creates $(ANTLR_OUT_DIR) - mkdir -p $(ANTLR_IN_DIR) $(JAVA_COMP_IN_PRIMARY_DIR) $(JVM_IN_DIR) - mkdir -p test deprecated experiment documentation temporary - -.PHONY: clean -clean: - @if [ -n "$(JVM_IN_DIR)" ]; then \ - echo "Cleaning $(JVM_IN_DIR)"; \ - rm -rf $(JVM_IN_DIR)/*; \ - else \ - echo "Warning: JVM_IN_DIR is not set"; \ - fi - @if [ -n "$(ANTLR_OUT_DIR)" ]; then \ - echo "Cleaning $(ANTLR_OUT_DIR)"; \ - rm -rf $(ANTLR_OUT_DIR); \ - else \ - echo "Warning: ANTLR_OUT_DIR is not set"; \ - fi - @if [ -d "temporary" ]; then \ - echo "Cleaning temporary directory"; \ - rm -rf temporary/*; \ - else \ - echo "Warning: temporary directory does not exist"; \ - fi - -#================================================================================ -# recipes - -# ANTLR a run of any of these will make all the files -$(ANTLR_OUT_DIR)/%Lexer.java: $(ANTLR_IN_DIR)/%.g4 - @echo "making grammar from:" $< - $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $< - -$(ANTLR_OUT_DIR)/%Parser.java: $(ANTLR_IN_DIR)/%.g4 - @echo "making grammar from:" $< - $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $< - -$(ANTLR_OUT_DIR)/%BaseVisitor.java: $(ANTLR_IN_DIR)/%.g4 - @echo "making grammar from:" $< - $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $< - -$(ANTLR_OUT_DIR)/%Visitor.java: $(ANTLR_IN_DIR)/%.g4 - @echo "making grammar from:" $< - $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $< - -# Generic recipe for building .jar files and placing scripts in the executor directory -$(JAVA_COMP_OUT_DIR)/%.jar: $(JAVA_COMP_IN_PRIMARY_DIR)/%.java - @echo "Building $*..." - $(JAVA_COMP) -d $(JAVA_COMP_OUT_DIR) -sourcepath $(JAVA_COMP_IN_DL) $< - $(JAVA_ARCHIVE) cf $@ -C $(JVM_IN_DIR) $*.class - @echo "Creating script for $*..." - echo "#!/usr/bin/env bash\n$(JAVA_INTERP) -cp $@ $*" > executor/$*.sh - chmod +x executor/$*.sh - diff --git a/developer/deprecated/makefile_1 b/developer/deprecated/makefile_1 deleted file mode 100644 index 68ff7c0..0000000 --- a/developer/deprecated/makefile_1 +++ /dev/null @@ -1,323 +0,0 @@ -# GQL_to_Cypher makefile - -#================================================================================ -# Setup the environment -# -# Use `make variable` to print the value assigned to each variable in this section - -#---------------------------------------- -# some notes about setting variables. Save yourself some grief by reading this. -# - -# Note these suffixes: -# _FL = File List -# _FPL = File Path List -# _DL = Directory List - -# _PRIMARY means these are primary inputs, this makefile does not build them -# _IN program inputs -# _OUT expected program outputs - -# The following is an example of setting a variable. Use `make variable` -# to prints its value, and note the embedded and trailing spaces. -ISLAND := land island - -#---------------------------------------- -# programs used by this makefile -# -JAVA_COMP := $(JAVA_HOME)/bin/javac -JAVA_INTERP := $(JAVA_HOME)/bin/java -JAVA_ARCHIVE := $(JAVA_HOME)/bin/jar - -#---------------------------------------- -# programs being built by this makefile: -# -PROGRAM_PrintRuleNameList := executor/PrintRuleNameList -PROGRAM_SyntaxTree_Test := executor/SyntaxTree_Test -PROGRAM_SyntaxTree_20240412 := executor/SyntaxTree_20240412 - -PROGRAM_FPL := $(PROGRAM_PrintRuleNameList) $(PROGRAM_SyntaxTree_Test) $(PROGRAM_SyntaxTree_20240412) - -#---------------------------------------- -# misc -# -TEMP_DIR := temporary - -#---------------------------------------- -# ANTLR environment -# Add a `.g4` file into the ANTLR_IN_DIR - -# ANTLR directories -ANTLR_PRIMARY_DIR := ANTLR -ANTLR_IN_DIR := $(ANTLR_PRIMARY_DIR) -ANTLR_OUT_DIR := javac/ANTLR -ANTLR_OUT_DIR_PARENT := javac - - -# ANTLR input files -ANTLR_IN_FPL := $(wildcard $(ANTLR_IN_DIR)/*.g4) -ANTLR_GRAMMAR_LIST := $(basename $(notdir $(ANTLR_IN_FPL))) -ifeq ($(strip $(ANTLR_IN_FPL)),) - $(info No ANTLR input grammar files found) -endif - -# ANTLR will produce these output files. - -# This function accepts a grammar name, or a grammar name with an extension; -# and sets a variable of the form ANTLR_OUT__FPL to a list of -# files that ANTLR would produce for . -define set_ANTLR_out_fpl_var - ANTLR_OUT_$(basename $1)_FPL := \ - $(ANTLR_OUT_DIR)/$(basename $1)Lexer.java \ - $(ANTLR_OUT_DIR)/$(basename $1)Parser.java \ - $(ANTLR_OUT_DIR)/$(basename $1)BaseVisitor.java \ - $(ANTLR_OUT_DIR)/$(basename $1)Visitor.java -endef - -# Generate ANTLR_OUT__FPL for each grammar -$(foreach file,$(ANTLR_GRAMMAR_LIST),$(eval $(call set_ANTLR_out_fpl_var,$(file)))) - -# Combine all individual file lists into ANTLR_OUT_FPL -ANTLR_OUT_FPL := $(foreach file,$(ANTLR_GRAMMAR_LIST),$(value ANTLR_OUT_$(file)_FPL)) - -#---------------------------------------- -# Java environment - -# JAVA directories -JAVA_COMP_IN_PRIMARY_DIR := javac -JAVA_COMP_IN_ANTLR_DIR := $(ANTLR_OUT_DIR) -JAVA_COMP_IN_DL := $(JAVA_COMP_IN_PRIMARY_DIR):$(JAVA_COMP_IN_ANTLR_DIR) -JAVA_COMP_OUT_DIR := jvm - -# JAVA input files -JAVA_COMP_IN_PRIMARY_FPL := $(wildcard $(JAVA_COMP_IN_PRIMARY_DIR)/*.java) -JAVA_COMP_IN_ANTLR_FPL := $(ANTLR_OUT_FPL) -JAVA_COMP_IN_FPL := $(JAVA_COMP_IN_PRIMARY_FPL) $(JAVA_COMP_IN_ANTLR_FPL) - -# JAVA will produce these output files -JAVA_COMP_OUT_PRIMARY_FPL := $(patsubst $(JAVA_COMP_IN_PRIMARY_DIR)/%.java,$(JAVA_COMP_OUT_DIR)/%.class,$(JAVA_COMP_IN_PRIMARY_FPL)) -JAVA_COMP_OUT_ANTLR_FPL := $(patsubst $(JAVA_COMP_IN_ANTLR_DIR)/%.java,$(JAVA_COMP_OUT_DIR)/%.class,$(JAVA_COMP_IN_ANTLR_FPL)) -JAVA_COMP_OUT_FPL := $(JAVA_COMP_OUT_PRIMARY_FPL) $(JAVA_COMP_OUT_ANTLR_FPL) - -#---------------------------------------- -# JVM environment - -JVM_IN_DIR := $(JAVA_COMP_OUT_DIR) -CLASSPATH := $(CLASSPATH):$(JVM_IN_DIR) -export CLASSPATH - - -#================================================================================ -# Make targets -# - -# The general make everything targets: -all: setup $(PROGRAM_FPL) -grammar: setup $(ANTLR_OUT_FPL) - -# specific programs or program versions: -PrintRuleNameList: $(PrintRuleNameList) -SyntaxTree_Test: $(ANTLR_OUT_SyntaxTree_Test_FPL) $(SyntaxTree_Test) -SyntaxTree_20240412: $(ANTLR_OUT_SyntaxTree_20240412_FPL) $(SyntaxTree_20240412) - -# Specific grammar targets. Run them like this: -# > make -# e.g. > make GQL_test -$(foreach grammar,$(ANTLR_GRAMMAR_LIST),$(eval $(grammar): $(value ANTLR_OUT_$(grammar)_FPL))) - -# Compile all the .java files. -java: setup $(JAVA_COMP_OUT_FPL) - -# prints out each variable within quotes so that spaces can be seen -.PHONY: variable -variable: - $(info ISLAND is '$(ISLAND)') - - $(info PROGRAM_PrintRuleNameList is '$(PROGRAM_PrintRuleNameList)') - $(info PROGRAM_SyntaxTree_Test is '$(PROGRAM_SyntaxTree_Test)') - $(info PROGRAM_SyntaxTree_20240412 is '$(PROGRAM_SyntaxTree_20240412)') - $(info PROGRAM_FPL is '$(PROGRAM_FPL)') - - $(info JAVA_COMP is '$(JAVA_COMP)') - $(info JAVA_INTERP is '$(JAVA_INTERP)') - $(info JAVA_ARCHIVE is '$(JAVA_ARCHIVE)') - - $(info TEMP_DIR is '$(TEMP_DIR)') - - $(info ANTLR_PRIMARY_DIR is '$(ANTLR_PRIMARY_DIR)') - $(info ANTLR_IN_DIR is '$(ANTLR_IN_DIR)') - $(info ANTLR_OUT_DIR is '$(ANTLR_OUT_DIR)') - $(info ANTLR_OUT_DIR_PARENT is '$(ANTLR_OUT_DIR_PARENT)') - $(info ANTLR_IN_FPL is '$(ANTLR_IN_FPL)') - $(info ANTLR_GRAMMAR_LIST is '$(ANTLR_GRAMMAR_LIST)') - $(foreach file,$(ANTLR_GRAMMAR_LIST),$(info ANTLR_OUT_$(file)_FPL is '$(value ANTLR_OUT_$(file)_FPL)')) - $(info ANTLR_OUT_FPL is '$(ANTLR_OUT_FPL)') - - $(info JAVA_COMP_IN_PRIMARY_DIR is '$(JAVA_COMP_IN_PRIMARY_DIR)') - $(info JAVA_COMP_IN_ANTLR_DIR is '$(JAVA_COMP_IN_ANTLR_DIR)') - $(info JAVA_COMP_IN_DL is '$(JAVA_COMP_IN_DL)') - $(info JAVA_COMP_OUT_DIR is '$(JAVA_COMP_OUT_DIR)') - - $(info JAVA_COMP_IN_PRIMARY_FPL is '$(JAVA_COMP_IN_PRIMARY_FPL)') - $(info JAVA_COMP_IN_ANTLR_FPL is '$(JAVA_COMP_IN_ANTLR_FPL)') - $(info JAVA_COMP_IN_FPL is '$(JAVA_COMP_IN_FPL)') - - $(info JAVA_COMP_OUT_PRIMARY_FPL is '$(JAVA_COMP_OUT_PRIMARY_FPL)') - $(info JAVA_COMP_OUT_ANTLR_FPL is '$(JAVA_COMP_OUT_ANTLR_FPL)') - $(info JAVA_COMP_OUT_FPL is '$(JAVA_COMP_OUT_FPL)') - - $(info JVM_IN_DIR is '$(JVM_IN_DIR)') - $(info CLASSPATH is '$(CLASSPATH)') - @: - -.PHONY: version -version: - $(info ANTLR_JAR is '$(notdir $(ANTLR_JAR))') - @ $(JAVA_COMP) --version - @ $(JAVA_ARCHIVE) --version - @ make -v | head -n 1 - @ echo "makefile 0.2" - -.PHONY: setup -setup: - # ANTLR automatically creates $(ANTLR_OUT_DIR) - mkdir -p $(ANTLR_IN_DIR) $(JAVA_COMP_IN_PRIMARY_DIR) $(JVM_IN_DIR) - mkdir -p executor test deprecated experiment documentation temporary - - -# 1. clean:temporary - removes files from ./temporary -# 2. General clean targets: -# clean:all - removes all things make built, and thus can be replaced by running make again. -# clean:all- (minus after the all) same as clean:all except for the program files (and their .jar if any) -# clean:program - all program files, i.e. ./exector/ and ./jvm/ for all programs. -# clean:class - class files -# clean:grammar - all generated grammar files - -# 2. -# clean:program: -# similear to clean:program, but only for the named program - -# clean:program+: -# bascially clean:all but only for the named program - -# clean:program-: -# baiscally clean:all- but only for the named program - -# 3. clean:grammar: -# siimilar to clean:grammar, but only for the named grammar - -# Function to clean the contents of a directory -# Accepts a directory as an argument, checks that the argument is not empty, -# ensures the directory exists, and then deletes the contents of the directory -# (excluding a file called .githolder) - -define clean_directory - if [ -z "$1" ]; then \ - echo "Error: Directory argument is empty"; \ - elif [ ! -d "$1" ]; then \ - echo "Error: Directory $1 does not exist"; \ - else \ - echo "Cleaning directory: $1"; \ - find "$1" -mindepth 1 -maxdepth 1 ! -name '.githolder' -exec rm -rf {} +; \ - touch "$1/.githolder"; \ - fi -endef - -# Function to clean a list of files -# Accepts a list of files as an argument and deletes the files in the list -# without complaining if a file is not found -define clean_files - @echo "Cleaning files: $1" - for file in $1; do \ - if [ -e "$$file" ]; then \ - echo rm -f "$$file"; \ - rm -f "$$file"; \ - fi; \ - done -endef - -# Function to handle individual cleaning -# Accepts a single option and removes the appropriate files -define do_clean - echo "Cleaning files for option: $1" - if [ "$1" = "" ]; then \ - echo "Usage: make clean:< all[-] | program[+/-][:] | grammar[:] | class | temp[orary] >"; \ - elif [ "$1" = "temporary" -o "$1" = "temp" ]; then \ - $(call clean_directory,$(TEMP_DIR)); \ - elif [ "$1" = "all" ]; then \ - $(call clean_directory,$(TEMP_DIR)); \ - $(call clean_files,$(ANTLR_OUT_FPL)); \ - $(call clean_files,$(JAVA_COMP_OUT_FPL)); \ - $(call clean_files,$(PROGRAM_FPL)); \ - elif [ "$1" = "all-" ]; then \ - $(call clean_directory,$(TEMP_DIR)); \ - $(call clean_files,$(ANTLR_OUT_FPL)); \ - $(call clean_files,$(JAVA_COMP_OUT_PRIMARY_FPL)); \ - elif [ "$1" = "program" ]; then \ - $(call clean_files,$(PROGRAM_FPL)); \ - elif [ "$1" = "class" ]; then \ - $(call clean_files,$(JAVA_COMP_OUT_FPL)); \ - elif [ "$1" = "grammar" ]; then \ - $(call clean_files,$(ANTLR_OUT_FPL)); \ - elif [ "$1" = "program:"* ]; then \ - program_name=$${1#program:}; \ - $(call clean_files,$(JAVA_COMP_OUT_DIR)/$${program_name}.jar executor/$${program_name}); \ - elif [ "$1" = "program+:"* ]; then \ - program_name=$${1#program+:}; \ - $(call clean_files,$(JAVA_COMP_OUT_DIR)/$${program_name}.jar executor/$${program_name}); \ - $(call clean_directory,$(TEMP_DIR)); \ - $(call clean_files,$(ANTLR_OUT_FPL)); \ - elif [ "$1" = "program-:"* ]; then \ - program_name=$${1#program-:}; \ - $(call clean_files,$(JAVA_COMP_OUT_DIR)/$${program_name}.jar executor/$${program_name}); \ - $(call clean_directory,$(TEMP_DIR)); \ - $(call clean_files,$(JAVA_COMP_OUT_PRIMARY_FPL)); \ - elif [ "$1" = "grammar:"* ]; then \ - grammar_name=$${1#grammar:}; \ - $(call clean_files,$(ANTLR_OUT_DIR)/$${grammar_name}*); \ - else \ - echo "Unknown clean option: $1"; \ - fi -endef - -# Default clean target -.PHONY: clean -clean: - @echo "Usage: make clean:< all[-] | program[+/-][:] | grammar[:] | class | temp[orary] >" - -# Clean specific program or option -# Calls the do_clean function with the pattern as an argument -.PHONY: clean\:% -clean\:%: - $(call do_clean,$*) - -#useful for distinguishing initial make error messages and message generated by rules firing -nothing: - @: - - -#================================================================================ -# recipes - - -# ANTLR a run of any of these will make all the files -$(ANTLR_OUT_DIR)/%Lexer.java \ -$(ANTLR_OUT_DIR)/%Parser.java \ -$(ANTLR_OUT_DIR)/%BaseVisitor.java \ -$(ANTLR_OUT_DIR)/%Visitor.java: $(ANTLR_IN_DIR)/%.g4 - @echo "making grammar from:" $< - $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $< - -# Generic recipe for building .jar files and placing scripts in the executor directory -$(JAVA_COMP_OUT_DIR)/%.jar: $(JAVA_COMP_IN_PRIMARY_DIR)/%.java - @echo "Building $*..." - $(JAVA_COMP) -d $(JAVA_COMP_OUT_DIR) -sourcepath $(JAVA_COMP_IN_DL) $< - $(JAVA_ARCHIVE) cf $@ -C $(JVM_IN_DIR) $*.class - -executor/%: $(JAVA_COMP_OUT_DIR)/%.jar - @echo "Creating script for $*..." - echo "#!/usr/bin/env bash\n$(JAVA_INTERP) -cp $@ $*" > executor/$* - chmod +x executor/$* - - -# LocalWords: makefile diff --git a/developer/executor/#makefile-project.mk# b/developer/executor/#makefile-project.mk# new file mode 100644 index 0000000..42ba4ce --- /dev/null +++ b/developer/executor/#makefile-project.mk# @@ -0,0 +1,117 @@ +#================================================================================ +# Custom make targets +# +$(info project_MAKECMDGOALS: $(MAKECMDGOALS)) + +all: $(EXECUTOR_IN_FPL) + +PrintRuleNameList: $(EXECUTOR_IN_DIR)/PrintRuleNameList + + +#----------------------------------------------- +# Arithmetic + +ANTLR_OUT_Arithmetic_FL := $(shell ANTLR_OUT_FL Arithmetic.g4 -visitor -no-listener -no-tokens) +ANTLR_OUT_Arithmetic_FPL := $(addprefix $(ANTLR_OUT_DIR)/, $(ANTLR_OUT_Arithmetic_FL)) +Arithmetic_Echo: $(ANTLR_OUT_Arithmetic_FPL) $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic_Echo_PrintVisitor.java + @if [ -z "$(ANTLR_OUT_Arithmetic_FPL)" ]; then \ + echo "variable ANTLR_OUT_Arithmetic_FPL empty."; \ + exit 1; \ + fi + $(BIN_MAKE) $(EXECUTOR_IN_DIR)/Arithmetic_Echo + +# Arithmetic_Echo__Test: $(ANTLR_OUT_Arithmetic_FPL) $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic_Echo_PrintVisitor.java +# @if [ -z "$(ANTLR_OUT_Arithmetic_FPL)" ]; then \ +# echo "variable ANTLR_OUT_Arithmetic_FPL empty."; \ +# exit 1; \ +# fi +# $(BIN_MAKE) $(EXECUTOR_IN_DIR)/Arithmetic_Echo__Test + +# Arithmetic_Syntax: $(ANTLR_OUT_Arithmetic_FPL) $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic_Syntax_PrintVisitor.java +# @if [ -z "$(ANTLR_OUT_Arithmetic_FPL)" ]; then \ +# echo "variable ANTLR_OUT_Arithmetic_FPL empty."; \ +# exit 1; \ +# fi +# $(BIN_MAKE) $(EXECUTOR_IN_DIR)/Arithmetic_Syntax + +# Arithmetic_Syntax__Test: $(ANTLR_OUT_Arithmetic_FPL) $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic_Syntax_PrintVisitor.java +# @if [ -z "$(ANTLR_OUT_Arithmetic_FPL)" ]; then \ +# echo "variable ANTLR_OUT_Arithmetic_FPL empty."; \ +# exit 1; \ +# fi +# $(BIN_MAKE) $(EXECUTOR_IN_DIR)/Arithmetic_Syntax__Test + +#----------------------------------------------- +# GQL_20240412 + +ANTLR_OUT_GQL_20240412_FL := $(shell ANTLR_OUT_FL GQL_20240412.g4 -visitor -no-listener -no-tokens) +ANTLR_OUT_GQL_20240412_FPL := $(addprefix $(ANTLR_OUT_DIR)/, $(ANTLR_OUT_GQL_20240412_FL)) + +GQL_20240412_Syntax: $(ANTLR_OUT_GQL_20240412_FPL) $(JAVA_COMP_IN_PRIMARY_DIR)/GQL_20240412_Syntax_PrintVisitor.java + @if [ -z "$(ANTLR_OUT_GQL_20240412_FPL)" ]; then \ + echo "variable ANTLR_OUT_GQL_20240412_FPL empty."; \ + exit 1; \ + fi + $(BIN_MAKE) $(EXECUTOR_IN_DIR)/GQL_20240412_Syntax + +GQL_20240412_Syntax__Test: $(ANTLR_OUT_GQL_20240412_FPL) $(JAVA_COMP_IN_PRIMARY_DIR)/GQL_20240412_Syntax_PrintVisitor.java + @if [ -z "$(ANTLR_OUT_GQL_20240412_FPL)" ]; then \ + echo "variable ANTLR_OUT_GQL_20240412_FPL empty."; \ + exit 1; \ + fi + $(BIN_MAKE) $(EXECUTOR_IN_DIR)/GQL_20240412_Syntax__Test + +TerminalToCategory: + $(BIN_MAKE) $(EXECUTOR_IN_DIR)/TerminalToCategory + +GrammarSplitter: + $(BIN_MAKE) $(EXECUTOR_IN_DIR)/GrammarSplitter + +#----------------------------------------------- +# Compile all the .java files. + +java: $(JAVA_COMP_OUT_FPL) + +#----------------------------------------------- +# useful for distinguishing between initial make error messages and message +# generated by rules firing + +nothing: + @: + +#================================================================================ +# generic targets, aka recipes +# + +$(ANTLR_OUT_DIR)/%Lexer.java \ +$(ANTLR_OUT_DIR)/%Lexer.tokens \ +$(ANTLR_OUT_DIR)/%Parser.java \ +$(ANTLR_OUT_DIR)/%Parser.tokens \ +$(ANTLR_OUT_DIR)/%BaseListener.java \ +$(ANTLR_OUT_DIR)/%Listener.java \ +$(ANTLR_OUT_DIR)/%BaseVisitor.java \ +$(ANTLR_OUT_DIR)/%Visitor.java: $(ANTLR_IN_PRIMARY_FPL) + @echo "making grammar from:" $< + $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $< + +# Rule to build .class files from .java files +$(JAVA_COMP_OUT_DIR)/%.class: $(JAVA_COMP_IN_PRIMARY_DIR)/%.java + @echo "Compiling $<..." + $(JAVA_COMP) -d $(JAVA_COMP_OUT_DIR) -sourcepath $(JAVA_COMP_IN_DL) $< + @echo "Created $@" + +# Without this, GNU make inserts an 'rm -rf' not on the recipe and deletes the .jar files +# after making them. Why make why? +.PRECIOUS: $(JAVA_COMP_OUT_DIR)/%.jar +# Rule to build .jar files from .class files +$(JAVA_COMP_OUT_DIR)/%.jar: $(JAVA_COMP_OUT_DIR)/%.class + @echo "Building $*..." + $(JAVA_ARCHIVE) cf $@ -C $(JAVA_COMP_OUT_DIR) $*.class + @echo "Created $@" + +$(EXECUTOR_IN_DIR)/%: $(JVM_IN_DIR)/%.jar + @echo "Creating script for $*..." + @echo "#!/usr/bin/env bash" > $(EXECUTOR_IN_DIR)/$* + @echo "$(JAVA_INTERP) -cp ${CLASSPATH}:${JVM_IN_DP}:$(JVM_IN_DP)/$*.jar $*" \$$\@ >> $(EXECUTOR_IN_DIR)/$* + chmod +x $(EXECUTOR_IN_DIR)/$* + @echo "Created script $(EXECUTOR_IN_DIR)/$*" diff --git a/developer/executor/env_build b/developer/executor/env_build index fa99ac5..b8f9ef1 100755 --- a/developer/executor/env_build +++ b/developer/executor/env_build @@ -18,6 +18,12 @@ fi # _IN things input to some program # _OUT things output by some program +#-------------------------------------------------------------------------------- +# commands + +export BIN_MAKE=/bin/make + + #-------------------------------------------------------------------------------- # to be built diff --git a/developer/executor/make b/developer/executor/make index 02e3b57..a556a0f 100755 --- a/developer/executor/make +++ b/developer/executor/make @@ -12,4 +12,4 @@ cd "$DEVELOPER_HOME" # in case there have been edits to the environment source "${EXECUTOR_IN_DIR}"/env_build -/usr/bin/make --no-builtin-rules -f "${EXECUTOR_IN_DIR}"/makefile $@ +${BIN_MAKE} --no-builtin-rules -f "${EXECUTOR_IN_DIR}"/makefile-top.mk $@ diff --git a/developer/executor/makefile b/developer/executor/makefile deleted file mode 100644 index d5b6644..0000000 --- a/developer/executor/makefile +++ /dev/null @@ -1,27 +0,0 @@ -# Top level makefile assures we do setup, tools, and project build in correct order. - -.PHONY: all setup tools project - -# The 'all' target now depends on 'tools' and 'project' -all: setup tools project - -.PHONY: version -version: - $(info ANTLR_JAR is '$(notdir $(ANTLR_JAR))') - @ $(JAVA_COMP) --version - @ $(JAVA_ARCHIVE) --version - @ make -v | head -n 1 - @ echo "makefile 0.4" - -setup: - mkdir -p $(ANTLR_IN_PRIMARY_DIR) $(JAVA_COMP_IN_PRIMARY_DIR) $(JVM_IN_DIR) - mkdir -p $(EXECUTOR_IN_DIR) test deprecated experiment documentation temporary - -# Ensure tools like ANTLR_OUT_FL are built before building the project programs -tools: setup - $(MAKE) -f $(EXECUTOR_IN_DIR)/makefile-tool -$(MAKEFLAGS) - -# Run the project makefile and pass any targets or arguments to it -PROJECT_GOALS := $(filter-out setup version,$(MAKECMDGOALS)) -project: setup tools - $(MAKE) -f $(EXECUTOR_IN_DIR)/makefile-project -$(MAKEFLAGS) $(PROJECT_GOALS) diff --git a/developer/executor/makefile-project b/developer/executor/makefile-project.mk similarity index 57% rename from developer/executor/makefile-project rename to developer/executor/makefile-project.mk index 0826e62..ea61056 100644 --- a/developer/executor/makefile-project +++ b/developer/executor/makefile-project.mk @@ -1,81 +1,90 @@ #================================================================================ # Custom make targets # +$(info project_MAKECMDGOALS: $(MAKECMDGOALS)) all: $(EXECUTOR_IN_FPL) PrintRuleNameList: $(EXECUTOR_IN_DIR)/PrintRuleNameList -ANTLR_OUT_Arithmetic_FPL := $(shell ANTLR_OUT_FL Arithmetic.g4 -visitor -no-listener) -Arithmetic_Echo: $(ANTLR_OUT_Arithmetic_FPL) $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic_Echo_PrintVisitor.java - @if [ -z "$(ANTLR_OUT_Arithmetic_FPL)" ]; then \ - echo "variable ANTLR_OUT_Arithmetic_FPL empty."; \ - exit 1; \ - fi - make $(EXECUTOR_IN_DIR)/Arithmetic_Echo - -Arithmetic_Echo__Test: $(ANTLR_OUT_Arithmetic_FPL) $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic_Echo_PrintVisitor.java - @if [ -z "$(ANTLR_OUT_Arithmetic_FPL)" ]; then \ - echo "variable ANTLR_OUT_Arithmetic_FPL empty."; \ - exit 1; \ - fi - make $(EXECUTOR_IN_DIR)/Arithmetic_Echo__Test +#----------------------------------------------- +# Arithmetic -Arithmetic_Syntax: $(ANTLR_OUT_Arithmetic_FPL) $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic_Syntax_PrintVisitor.java - @if [ -z "$(ANTLR_OUT_Arithmetic_FPL)" ]; then \ - echo "variable ANTLR_OUT_Arithmetic_FPL empty."; \ - exit 1; \ - fi - make $(EXECUTOR_IN_DIR)/Arithmetic_Syntax - -Arithmetic_Syntax__Test: $(ANTLR_OUT_Arithmetic_FPL) $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic_Syntax_PrintVisitor.java +ANTLR_OUT_Arithmetic_FL := $(shell ANTLR_OUT_FL Arithmetic.g4 -visitor -no-listener -no-tokens) +ANTLR_OUT_Arithmetic_FPL := $(addprefix $(ANTLR_OUT_DIR)/, $(ANTLR_OUT_Arithmetic_FL)) +Arithmetic_Echo: $(ANTLR_OUT_Arithmetic_FPL) $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic_Echo_PrintVisitor.java @if [ -z "$(ANTLR_OUT_Arithmetic_FPL)" ]; then \ echo "variable ANTLR_OUT_Arithmetic_FPL empty."; \ exit 1; \ fi - make $(EXECUTOR_IN_DIR)/Arithmetic_Syntax__Test + $(BIN_MAKE) $(EXECUTOR_IN_DIR)/Arithmetic_Echo + +# Arithmetic_Echo__Test: $(ANTLR_OUT_Arithmetic_FPL) $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic_Echo_PrintVisitor.java +# @if [ -z "$(ANTLR_OUT_Arithmetic_FPL)" ]; then \ +# echo "variable ANTLR_OUT_Arithmetic_FPL empty."; \ +# exit 1; \ +# fi +# $(BIN_MAKE) $(EXECUTOR_IN_DIR)/Arithmetic_Echo__Test + +# Arithmetic_Syntax: $(ANTLR_OUT_Arithmetic_FPL) $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic_Syntax_PrintVisitor.java +# @if [ -z "$(ANTLR_OUT_Arithmetic_FPL)" ]; then \ +# echo "variable ANTLR_OUT_Arithmetic_FPL empty."; \ +# exit 1; \ +# fi +# $(BIN_MAKE) $(EXECUTOR_IN_DIR)/Arithmetic_Syntax + +# Arithmetic_Syntax__Test: $(ANTLR_OUT_Arithmetic_FPL) $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic_Syntax_PrintVisitor.java +# @if [ -z "$(ANTLR_OUT_Arithmetic_FPL)" ]; then \ +# echo "variable ANTLR_OUT_Arithmetic_FPL empty."; \ +# exit 1; \ +# fi +# $(BIN_MAKE) $(EXECUTOR_IN_DIR)/Arithmetic_Syntax__Test + +#----------------------------------------------- +# GQL_20240412 + +ANTLR_OUT_GQL_20240412_FL := $(shell ANTLR_OUT_FL GQL_20240412.g4 -visitor -no-listener -no-tokens) +ANTLR_OUT_GQL_20240412_FPL := $(addprefix $(ANTLR_OUT_DIR)/, $(ANTLR_OUT_GQL_20240412_FL)) GQL_20240412_Syntax: $(ANTLR_OUT_GQL_20240412_FPL) $(JAVA_COMP_IN_PRIMARY_DIR)/GQL_20240412_Syntax_PrintVisitor.java @if [ -z "$(ANTLR_OUT_GQL_20240412_FPL)" ]; then \ echo "variable ANTLR_OUT_GQL_20240412_FPL empty."; \ exit 1; \ fi - make $(EXECUTOR_IN_DIR)/GQL_20240412_Syntax + $(BIN_MAKE) $(EXECUTOR_IN_DIR)/GQL_20240412_Syntax GQL_20240412_Syntax__Test: $(ANTLR_OUT_GQL_20240412_FPL) $(JAVA_COMP_IN_PRIMARY_DIR)/GQL_20240412_Syntax_PrintVisitor.java @if [ -z "$(ANTLR_OUT_GQL_20240412_FPL)" ]; then \ echo "variable ANTLR_OUT_GQL_20240412_FPL empty."; \ exit 1; \ fi - make $(EXECUTOR_IN_DIR)/GQL_20240412_Syntax__Test + $(BIN_MAKE) $(EXECUTOR_IN_DIR)/GQL_20240412_Syntax__Test TerminalToCategory: - make $(EXECUTOR_IN_DIR)/TerminalToCategory + $(BIN_MAKE) $(EXECUTOR_IN_DIR)/TerminalToCategory GrammarSplitter: - make $(EXECUTOR_IN_DIR)/GrammarSplitter - - - -# make the `.java` files for all grammars -grammar: $(ANTLR_OUT_FPL) - -# Specific grammar targets. Run them like this: -# > make -# e.g. > make GQL_test -$(foreach grammar,$(ANTLR_GRAMMAR_LIST),$(eval $(grammar): $(value ANTLR_OUT_$(grammar)_FPL))) + $(BIN_MAKE) $(EXECUTOR_IN_DIR)/GrammarSplitter +#----------------------------------------------- # Compile all the .java files. + java: $(JAVA_COMP_OUT_FPL) +#----------------------------------------------- +# Clean is program, not a target + # Default clean target .PHONY: clean clean: @echo "Use the clean script from the $(EXECUTOR_IN_DIR) directory instead of \`make clean\`" @$(EXECUTOR_IN_DIR)/clean -#useful for distinguishing initial make error messages and message generated by rules firing +#----------------------------------------------- +# useful for distinguishing between initial make error messages and message +# generated by rules firing + nothing: @: diff --git a/developer/executor/makefile-tool b/developer/executor/makefile-tool.mk similarity index 100% rename from developer/executor/makefile-tool rename to developer/executor/makefile-tool.mk diff --git a/developer/executor/makefile-top.mk b/developer/executor/makefile-top.mk new file mode 100644 index 0000000..b4fef26 --- /dev/null +++ b/developer/executor/makefile-top.mk @@ -0,0 +1,33 @@ +$(info top_MAKECMDGOALS: $(MAKECMDGOALS)) + +.PHONY: all version clean setup tools project + +# The 'all' target now depends on 'tools' and 'project' +all: setup tools project + +version: + $(info ANTLR_JAR is '$(notdir $(ANTLR_JAR))') + @ $(JAVA_COMP) --version + @ $(JAVA_ARCHIVE) --version + @ make -v | head -n 1 + @ echo "makefile 0.4" + +# `clean` is program independent of `make` +clean: + @echo "Use the clean script from the $(EXECUTOR_IN_DIR) directory instead of \`make clean\`" + @$(EXECUTOR_IN_DIR)/clean + +setup: + mkdir -p $(ANTLR_IN_PRIMARY_DIR) $(JAVA_COMP_IN_PRIMARY_DIR) $(JVM_IN_DIR) + mkdir -p $(EXECUTOR_IN_DIR) test deprecated experiment documentation temporary + +# Ensure tools like ANTLR_OUT_FL are built before building the project programs +tools: setup + $(BIN_MAKE) -f $(EXECUTOR_IN_DIR)/makefile-tool.mk -$(MAKEFLAGS) + +project: tools + $(BIN_MAKE) -f $(EXECUTOR_IN_DIR)/makefile-project.mk -$(MAKEFLAGS) + +# all other targets are sent to makefile-project +%: tools + $(BIN_MAKE) -f $(EXECUTOR_IN_DIR)/makefile-project.mk -$(MAKEFLAGS) $@ diff --git a/developer/documentation/#rule_list.txt# b/developer/ologist/#rule_list.txt# similarity index 100% rename from developer/documentation/#rule_list.txt# rename to developer/ologist/#rule_list.txt# diff --git a/developer/documentation/.githolder b/developer/ologist/.githolder similarity index 100% rename from developer/documentation/.githolder rename to developer/ologist/.githolder diff --git a/developer/documentation/Cypher_GQL_differences.txt b/developer/ologist/Cypher_GQL_differences.txt similarity index 100% rename from developer/documentation/Cypher_GQL_differences.txt rename to developer/ologist/Cypher_GQL_differences.txt diff --git a/developer/documentation/GQL_20240412_rule_list.txt b/developer/ologist/GQL_20240412_rule_list.txt similarity index 100% rename from developer/documentation/GQL_20240412_rule_list.txt rename to developer/ologist/GQL_20240412_rule_list.txt diff --git a/developer/documentation/rule_list.txt b/developer/ologist/rule_list.txt similarity index 100% rename from developer/documentation/rule_list.txt rename to developer/ologist/rule_list.txt diff --git a/developer/documentation/rules_by_catebory.txt b/developer/ologist/rules_by_catebory.txt similarity index 100% rename from developer/documentation/rules_by_catebory.txt rename to developer/ologist/rules_by_catebory.txt diff --git a/developer/documentation/rules_by_category.html b/developer/ologist/rules_by_category.html similarity index 100% rename from developer/documentation/rules_by_category.html rename to developer/ologist/rules_by_category.html diff --git a/developer/documentation/terminal_symbol_list.txt b/developer/ologist/terminal_symbol_list.txt similarity index 100% rename from developer/documentation/terminal_symbol_list.txt rename to developer/ologist/terminal_symbol_list.txt diff --git a/developer/documentation/terminal_symbol_list_unsorted.txt b/developer/ologist/terminal_symbol_list_unsorted.txt similarity index 100% rename from developer/documentation/terminal_symbol_list_unsorted.txt rename to developer/ologist/terminal_symbol_list_unsorted.txt diff --git a/documentation/README.md b/ologist/README.md similarity index 100% rename from documentation/README.md rename to ologist/README.md diff --git a/documentation/directory_structure.md b/ologist/directory_structure.md similarity index 100% rename from documentation/directory_structure.md rename to ologist/directory_structure.md diff --git a/documentation/for_developers.md b/ologist/for_developers.md similarity index 100% rename from documentation/for_developers.md rename to ologist/for_developers.md diff --git a/documentation/log.md b/ologist/log.md similarity index 100% rename from documentation/log.md rename to ologist/log.md -- 2.20.1