From: Thomas Walker Lynch Date: Tue, 6 Aug 2024 07:27:24 +0000 (+0000) Subject: make clean:PrintRuleNameList works X-Git-Url: https://git.reasoningtechnology.com/usr/lib/python2.7/encodings/cp1250.py?a=commitdiff_plain;h=ce8fd8d84e0ff362436b7d612a421f8974dc7417;p=GQL-to-Cypher make clean:PrintRuleNameList works --- diff --git a/developer/executor/PrintRuleNameList b/developer/executor/PrintRuleNameList deleted file mode 100755 index bc89c04..0000000 --- a/developer/executor/PrintRuleNameList +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -/var/user_data/Thomas-developer/GQL_to_Cypher/tool/jdk-22.0.1+8/bin/java -cp jvm/PrintRuleNameList.jar PrintRuleNameList $@ diff --git a/developer/makefile b/developer/makefile index 400e1f9..0b6e080 100644 --- a/developer/makefile +++ b/developer/makefile @@ -191,21 +191,21 @@ setup: # 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:all- (minus after the all) same as clean:all except not 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 - +# similar 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 @@ -239,60 +239,85 @@ define clean_directory 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 \ +define clean_command_parser_1 + if [ "$(token)" = "temporary" ]; then \ + $(call clean_directory,$(TEMP_DIR)); \ + elif [ "$(token)" = "temp" ]; then \ $(call clean_directory,$(TEMP_DIR)); \ - elif [ "$1" = "all" ]; then \ + elif [ "$(token)" = "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 \ + elif [ "$(token)" = "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 \ + elif [ "$(token)" = "program" ]; then \ $(call clean_files,$(PROGRAM_FPL)); \ - elif [ "$1" = "class" ]; then \ + elif [ "$(token)" = "class" ]; then \ $(call clean_files,$(JAVA_COMP_OUT_FPL)); \ - elif [ "$1" = "grammar" ]; then \ + elif [ "$(token)" = "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}); \ + else \ + echo "Unknown clean option: $(token)"; \ + fi +endef + +define clean_command_parser_2 + if [ "$(token)" = "program" ]; then \ + $(call clean_files,$(JAVA_COMP_OUT_DIR)/$(arg).jar executor/$(arg)); \ + elif [ "$(token)" = "program+" ]; then \ + $(call clean_files,$(JAVA_COMP_OUT_DIR)/$(arg).jar executor/$(arg)); \ $(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}); \ + elif [ "$(token)" = "program-" ]; then \ + $(call clean_files,$(JAVA_COMP_OUT_DIR)/$(arg).jar executor/$(arg)); \ $(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}*); \ + elif [ "$(token)" = "grammar" ]; then \ + $(call clean_files,$(ANTLR_OUT_DIR)/$(arg)*); \ + else \ + echo "Unknown clean option: $(token)"; \ + fi +endef + +define clean_command_parser + $(eval token_list := $1) + $(eval token_count := $(words $(token_list))) + $(eval token := $(firstword $(token_list))) + $(eval arg := $(word 2, $(token_list))) + if [ "$(token_count)" -eq 0 ]; then \ + echo "Usage: make clean:< all[-] | program[+/-] | grammar | class | temp[orary] >"; \ + elif [ "$(token_count)" -eq 1 ]; then \ + $(call clean_command_parser_1); \ + elif [ "$(token_count)" -eq 2 ]; then \ + $(call clean_command_parser_2); \ else \ - echo "Unknown clean option: $1"; \ + echo "Invalid number of tokens: $(token_count)"; \ fi endef +# Clean specific program or option +# Calls the clean_command_parser function with the pattern as an argument +.PHONY: clean\:% +clean\:%: + $(eval token_list := $(subst :, ,$*)) + @$(call clean_command_parser,$(token_list)) + + +# Clean specific program or option +# Calls the clean_command_parser function with the pattern as an argument +.PHONY: clean\:% +clean\:%: + @$(call clean_command_parser,$(subst :, ,$*)) + # 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: