From f4252935c34dd440f71e29ba90d4eef9b194ec84 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 27 Jul 2024 16:41:59 +0200 Subject: [PATCH 1/4] * fixed mkdir output if .makefile-mini folder already exists by adding -p * fixed .c and .cpp files for libraries not including h folders and hpp folders from libraries * .o from .c/.cpp for executables in linux is now suffixed .static.o instead of .o to use same file as .o for staticlibrary --- makefile_mini.mk | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/makefile_mini.mk b/makefile_mini.mk index 7aa4bff..57ecfad 100644 --- a/makefile_mini.mk +++ b/makefile_mini.mk @@ -124,7 +124,7 @@ MM_EXECUTABLE_EXTENSION_OR_DOT:=$(if $(MM_EXECUTABLE_EXTENSION),$(MM_EXECUTABLE_ ifndef OS #< linux # NOTE: $(1) = non cli (see windows version of mm_cli_mkdir) -mm_cli_mkdir=mkdir $(1) +mm_cli_mkdir=mkdir -p $(1) # TODO: not tested # NOTE: $(1) == non cli (see windows version of mm_cli_rmdir) mm_cli_rmdir=rmdir $(1) @@ -1007,7 +1007,7 @@ $(eval $(mm_add_library_infoAboutLibrary).otherSharedlibraries:=$(filter $($(2). $(eval $(mm_add_library_infoAboutLibrary).hAndHppFilepathPerOtherLibrary:=$(call mm_get_filepath_per_h_and_hpp_from_libraries,$($(mm_add_library_infoAboutLibrary).otherLibraries))) $(eval $(mm_add_library_infoAboutLibrary).binaryfilepathPerOtherStaticlibrary:=$(call mm_get_filepath_per_binary_from_staticlibraries,$($(mm_add_library_infoAboutLibrary).otherStaticlibraries) $($(mm_add_library_infoAboutLibrary).otherLibraries))) $(eval $(mm_add_library_infoAboutLibrary).binaryfilepathPerOtherSharedlibrary:=$(call mm_get_filepath_per_binary_from_sharedlibraries,$($(mm_add_library_infoAboutLibrary).otherSharedlibraries) $($(mm_add_library_infoAboutLibrary).otherLibraries))) -$(eval mm_add_library_a:=$(sort $(notdir,$($(mm_add_library_infoAboutLibrary).hAndHppFilepathPerOtherLibrary)))) +$(eval mm_add_library_a:=$(sort $(dir $($(mm_add_library_infoAboutLibrary).hAndHppFilepathPerOtherLibrary)))) $(if $(mm_add_library_oFromC),\ $(call mm_add_o_from_c,$(0),$(mm_add_library_a) $($(2).hAndHppFolders) $($(2).hFolders),$($(2).cGcc),$(mm_add_library_oFromC) $(mm_add_library_oFromLocalC))\ ,) @@ -1130,8 +1130,12 @@ $(if $(filter undefined,$(origin MM_SAFETY)),,\ $(eval MM_INFO_PER_EXECUTABLE+=MM_INFO_PER_EXECUTABLE.$(words $(MM_INFO_PER_EXECUTABLE))) $(eval mm_add_executable_infoAboutExecutable:=$(lastword $(MM_INFO_PER_EXECUTABLE))) $(eval $(mm_add_executable_infoAboutExecutable).name:=$(1)) -$(eval mm_add_executable_oFromC:=$(addsuffix .o,$($(2).c))) -$(eval mm_add_executable_oFromCpp:=$(addsuffix .o,$($(2).cpp))) +$(if $(OS),\ + $(eval mm_add_executable_oFromC:=$(addsuffix .o,$($(2).c)))\ + $(eval mm_add_executable_oFromCpp:=$(addsuffix .o,$($(2).cpp))),\ + $(eval mm_add_executable_oFromC:=$(addsuffix .static.o,$($(2).c)))\ + $(eval mm_add_executable_oFromCpp:=$(addsuffix .static.o,$($(2).cpp)))\ +) $(eval $(mm_add_executable_infoAboutExecutable).o:=$(mm_add_executable_oFromC) $(mm_add_executable_oFromCpp)) $(eval $(mm_add_executable_infoAboutExecutable).libraries:=$(filter $($(2).libraries),$(MM_LIBRARIES))) $(eval $(mm_add_executable_infoAboutExecutable).staticlibraries:=$(filter $($(2).staticlibraries),$(MM_STATICLIBARIES))) From 18e043ae73ad2723089d2a6dd60c0804933b954c Mon Sep 17 00:00:00 2001 From: maarten-laptop Date: Tue, 13 Aug 2024 21:15:01 +0200 Subject: [PATCH 2/4] * now works in chromeos (linux) again + executabletest2 to .gitignore * removed never implemented MM_SHARED in sharedlibrarytest.c that prevented including sharedlibary_mini.h and thus broke SM_IMPORT * added missing ../sharedlibrary-mini/ from hFolders for sharedlibrarytest.c in Makefile - disabled librarytest compilation as can't work without confusingly adding ../sharedlibrary-mini/ to hFolders for staticlibrarytest.c everywhere * mm_cli_rmdir in chromeos now uses rm -d -f as rmdir fails if folder doesn't exist * fixed chromeos mm_cli_hfile_from_file implementation * fixed missing "-fpic -fvisibility" from gcc/g++ because of .shared.o not beig detected correctly in mm_add_o_from_c_or_cpp * fixed missing line continuation in mm_check_add_library_parameters_t * fixed incorrect adding all .oFromLocalC to .localStaticO in mm_add_library, which added too many symbols to .nm file for staticlibrary with any .localC * fixed typos in mm_add_local_staticlibrary_targets + test target now exports current folder and .makefile-mini/ folder to LD_LIBRARY_PATH * fixed a typo that broke running test scripts + .spv.h files are now tested for being a valid .h file by including in testexecutabletest.c * testexecutabletest.c now no longer calls executabletest.exe in chromeos but uses platform-specific executable extension --- .gitignore | 3 ++- Makefile | 27 +++++++++++++++++++--- makefile_mini.mk | 54 +++++++++++++++++++++++++++++++------------- sharedlibrarytest.c | 4 ---- testexecutabletest.c | 8 +++++-- txttest.txt | 1 + 6 files changed, 71 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index f23d6f2..a64d389 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ *.dll *.so *.exe -executabletest \ No newline at end of file +executabletest +executabletest2 \ No newline at end of file diff --git a/Makefile b/Makefile index ee7a31b..b28eab2 100644 --- a/Makefile +++ b/Makefile @@ -54,13 +54,20 @@ $(call mm_add_library_parameters_t,h) h.filetypes:=EMMLibraryfiletype_Shared h.c:=sharedlibrarytest.c #h.libraries:=sharedlibrary-mini: +h.hFolders:=../sharedlibrary-mini/ $(call mm_add_library,sharedlibrarytest,h) $(call mm_add_library_parameters_t,i) i.filetypes:=$(EMMLibraryfiletype_All) i.c:=staticlibrarytest.c sharedlibrarytest.c i.localC:=foldertest/foldertest.c -$(call mm_add_library,librarytest,i) +#i.libraries:=sharedlibrary-mini: +i.hFolders:=../sharedlibrary-mini/ +#$(call mm_add_library,librarytest,i) +# NOTE: ^ +# disabled as currently won't work to add staticlibrarytest.c twice.. +# .. with different hFolders value (librarytest is currently unused.. +# .. anyway) $(call mm_add_executable_parameters_t,j) #j.additionalfiletypes:= @@ -76,15 +83,29 @@ j.libraries:=staticlibrarytest sharedlibrarytest j.hFolders:=../sharedlibrary-mini/ j.lib:=sharedlibrary-mini j.libFolders:=../sharedlibrary-mini/ +# TODO: ^ +# see mm_add_executable_parameters_t for executabletest2 for more info.. +# .. (applies here too) $(call mm_add_executable,executabletest,j) $(call mm_add_executable_parameters_t,k) k.cpp:=executabletest.cpp k.hppFolders:=../sharedlibrary-mini/ # NOTE: ^ -# not sure if wouldn't make more sense to instead use .hFolders for.. -# .. both c and c++ and .hppFolders only for c++? +# could use hAndHppFolders here but there is no .c here hence this is.. +# .. "more-specific" +# TODO: ^ +# not sure if requiring sharedlibrarytest should also automatically.. +# .. require sharedlibrary-mini added to .hppFolders? +# alternative might be to add sharedlibrary-mini: here AGAIN (to.. +# .. k.libraries) for also including .hppFolders? +# TODO: ^ +# maybe sharedlibrarytest should specify .hpm or .hAndHpp for.. +# .. automatically being added to .hAndHppFolders? k.libraries:=staticlibrarytest2 sharedlibrarytest +# TODO: ^ +# requiring sharedlibrarytest should automatically require.. +# .. sharedlibrary-mini k.lib=sharedlibrary-mini k.libFolders:=../sharedlibrary-mini/ $(call mm_add_executable,executabletest2,k) diff --git a/makefile_mini.mk b/makefile_mini.mk index 57ecfad..e6b5c71 100644 --- a/makefile_mini.mk +++ b/makefile_mini.mk @@ -127,7 +127,9 @@ ifndef OS #< linux mm_cli_mkdir=mkdir -p $(1) # TODO: not tested # NOTE: $(1) == non cli (see windows version of mm_cli_rmdir) -mm_cli_rmdir=rmdir $(1) +mm_cli_rmdir=rm -d -f $(1) +# NOTE: ^ +# not using rmdir because that will error if folder doesn't exist mm_cli_rm=rm -f $(1) @@ -209,11 +211,18 @@ ifndef OS #< linux # $(2) == inputfile (cli) # $(3) == outputfile (cli) define mm_cli_hfile_from_file= -$(eval mm_cli_hfile_from_file_a:=$(shell tr -c a-zA-Z0-9 _ $(1))) -$(eval mm_cli_hfile_from_file_b:=$(shell tr a-z A-Z $(mm_cli_hfile_from_file_a))) -echo #ifndef $(mm_hfile_from_file_b)_H`n#define $(mm_cli_hfile_from_file_b)_H`n`n`nchar $(mm_cli_hfile_from_file_a)_h[] = {\" > $(3) -od -An -v -td1 $(2) | tr -s " " | tr -d "\n" | sed -z -e "s/ /, /g;s/^, //;s/, $ //" >> $(3) -echo \"`n`n#endif`n\" >> $(3) +$(strip\ + $(eval $(0)_a:=$(shell echo -n $(1) | tr -c a-zA-Z0-9 _))\ + $(eval $(0)_b:=$(shell echo -n $($(0)_a) | tr a-z A-Z))\ + echo "#ifndef $($(0)_b)_H" > $(3);\ + echo "#define $($(0)_b)_H" >> $(3);\ + echo >> $(3); echo >> $(3);\ + echo -n "char $($(0)_a)_h[] = { " >> $(3);\ + od -An -v -td1 $(2) | tr -s " " | tr -d "\n" | sed -z -e "s/ /, /g;s/^, //;s/, $$$$//" >> $(3);\ + echo " };" >> $(3);\ + echo >> $(3);\ + echo "#endif" >> $(3)\ +) endef # NOTE: ^ # https://unix.stackexchange.com/a/758531 @@ -728,7 +737,7 @@ $(foreach mm_add_o_from_c_or_cpp_o,$(8),\ )\ $(eval mm_add_o_from_c_or_cpp_gccOrG++:=$(7))\ $(if $(OS),,\ - $(if $(patsubst %.shared.o,%,$(mm_add_o_from_c_or_cpp_gccOrG++)),\ + $(if $(filter %.shared.o,$($(0)_o)),\ $(eval mm_add_o_from_c_or_cpp_gccOrG++ +=-fpic -fvisibility=hidden)\ ,)\ )\ @@ -915,7 +924,7 @@ $(call mm_check_if_defined,$(1),$(2).libraries) $(call mm_check_if_defined,$(1),$(2).staticlibraries) $(call mm_check_if_defined,$(1),$(2).sharedlibraries) -$(if $($(2).filetypes), +$(if $($(2).filetypes),\ $(call mm_check_if_valid_values,$(1),$(EMMLibraryfiletype_All),$(2).filetypes)\ $(if $($(2).c) $($(2).cpp),,$(error if $(2).filetypes is not empty.. $(2).c and $(2).cpp may not both be empty in $(1)))\ $(call mm_check_if_valid_values,$(1),%.c,$(2).c)\ @@ -997,7 +1006,7 @@ $(if $(OS),\ $(eval mm_add_library_oFromLocalCpp+=$(mm_add_library_sharedOFromLocalCpp))\ ,)\ ) -$(eval $(mm_add_library_infoAboutLibrary).localStaticO:=$(mm_add_library_oFromLocalC) $(mm_add_library_oFromLocalCpp)) +$(eval $(mm_add_library_infoAboutLibrary).localStaticO:=$($(0)_staticOFromLocalC) $($(0)_staticOFromLocalCpp)) $(eval $(mm_add_library_infoAboutLibrary).h:=$($(2).h)) $(eval $(mm_add_library_infoAboutLibrary).hpp:=$($(2).hpp)) $(eval $(mm_add_library_infoAboutLibrary).cc:=$(if $($(2).cpp),g++,gcc)) @@ -1031,6 +1040,9 @@ endef # TODO: mm_not_add_library and mm_add_library=$(eval $(call mm_not_add_library,<...>))? # ^ # to allow for comments in mm_not_add_library? +# NOTE: ^ +# for shared library .localC is identical to .c +# this is fine as default visibility for .shared.o is hidden? #********************************* executable ********************************* @@ -1354,13 +1366,13 @@ endef # NOTE: $(1) == infoAboutLibrary define mm_add_local_staticlibrary_targets= -$(eval mm_add_staticlibrary_targets_filepathPerLocalStaticO:=$(addprefix .makefile-mini/,$($(1).localStaticO))) -.makefile-mini/$($(1).$(MM_OS)$(MM_STATICLIBRARY_EXTENSION)filepath).nm:$(mm_add_staticlibrary_targets_filepathPerLocalStaticO) +$(eval $(0)_filepathPerLocalStaticO:=$(addprefix .makefile-mini/,$($(1).localStaticO))) +.makefile-mini/$($(1).$(MM_OS)$(MM_STATICLIBRARY_EXTENSION)filepath).nm:$($(0)_filepathPerLocalStaticO) nm -j -g --defined-only $$^ > $$@ -$(eval mm_add_staticlibrary_targets_filepathPerStaticO:=$(addprefix .makefile-mini/,$($(1).staticO))) -.makefile-mini/$($(1).$(MM_OS)$(MM_STATICLIBRARY_EXTENSION)filepath).o:.makefile-mini/$($(1).$(MM_OS)$(MM_STATICLIBRARY_EXTENSION)filepath).nm $(mm_add_staticlibrary_targets_filepathPerStaticO) - ld -r -o $$@ $(mm_add_staticlibrary_targets_filepathPerStaticO) +$(eval $(0)_filepathPerStaticO:=$(addprefix .makefile-mini/,$($(1).staticO))) +.makefile-mini/$($(1).$(MM_OS)$(MM_STATICLIBRARY_EXTENSION)filepath).o:.makefile-mini/$($(1).$(MM_OS)$(MM_STATICLIBRARY_EXTENSION)filepath).nm $($(0)_filepathPerStaticO) + ld -r -o $$@ $($(0)_filepathPerStaticO) objcopy --localize-symbols $$< $$@ $($(1).$(MM_OS)$(MM_STATICLIBRARY_EXTENSION)filepath): .makefile-mini/$($(1).$(MM_OS)$(MM_STATICLIBRARY_EXTENSION)filepath).o $($(1).hAndHppFilepathPerOtherLibrary) @@ -1438,10 +1450,11 @@ define mm_add_test_target= test: $(MM_FILEPATH_PER_BINARY) $(foreach mm_add_test_target_infoAboutTest,$(MM_INFO_PER_TEST),$\ $(foreach mm_add_test_target_executablefilepath,$($(mm_add_test_target_infoAboutTest).filepathPerExecutable),$\ - $(MM_NEWLINE) $(if $(findstring /,$(mm_add_test_target_executablefilepath)),,.$(MM_FOLDER_SEPARATOR))$(mm_add_test_target_executablefilepath)$\ + $(eval $(0)_a:=$(if $(findstring /,$(mm_add_test_target_executablefilepath)),,.$(MM_FOLDER_SEPARATOR))$(mm_add_test_target_executablefilepath))$\ + $(MM_NEWLINE) @$(if $(OS),,export LD_LIBRARY_PATH=$$$$LD_LIBRARY_PATH:./:.makefile-mini/; )$($(0)_a);echo $($(0)_a)$\ )$\ $(foreach mm_add_test_target_script,$($(mm_add_test_target_infoAboutTest).scripts),$\ - $(MM_NEWLINE) $(if $(findstring /,$(mm_add_test_target_executablefilepath)),,.$(MM_FOLDER_SEPARATOR))$(mm_add_test_target_script)$(MM_SCRIPT_EXTENSION)"$\ + $(MM_NEWLINE) $(if $(findstring /,$(mm_add_test_target_executablefilepath)),,.$(MM_FOLDER_SEPARATOR))$(mm_add_test_target_script)$(MM_SCRIPT_EXTENSION)$\ )$\ ) endef @@ -1460,6 +1473,15 @@ endef # Hence for now.. executables and scripts are not run in parallel and.. # .. .executables and .scripts is only for grouping tests (for.. # .. convenience perhaps?) +# NOTE: ^ +# make automatically adds environment variables as Makefile variables.. +# .. (hence $(LD_LIBRARY_PATH) works) and runs each line using a new.. +# .. shell (separate c stdlib system function call?), hence export.. +# .. LD_LIBRARY_PATH=<..> on same line as running executable here +# currently hidden that makefile-mini does this for clearer output +# TODO: this solution won't work if a test executable uses any external.. +# .. sharedlibrary/runs any executable that requires an external.. +# .. sharedlibrary define mm_add_releasezip_target= $(MM_PROJECTNAME).$(MM_OS).zip: $(MM_RELEASEZIP) diff --git a/sharedlibrarytest.c b/sharedlibrarytest.c index f4150b2..1665737 100644 --- a/sharedlibrarytest.c +++ b/sharedlibrarytest.c @@ -1,8 +1,4 @@ -#if MM_SHARED #include -#else -#define SM_EXPORT -#endif SM_EXPORT float sharedlibrarytest() diff --git a/testexecutabletest.c b/testexecutabletest.c index 766dffa..7d02579 100644 --- a/testexecutabletest.c +++ b/testexecutabletest.c @@ -1,3 +1,5 @@ +#include "pixelshadertest.spv.h" //< to test if a valid .h file was generated + #include #include @@ -5,8 +7,10 @@ #if defined(_WIN32) #define FOLDER_SEPARATOR "\\" +#define EXECUTABLE_EXTENSION ".exe" #elif defined(__linux__) #define FOLDER_SEPARATOR "/" +#define EXECUTABLE_EXTENSION "" #else #error os not supported #endif @@ -64,8 +68,8 @@ int test_1() int test_2() { - fputs("." FOLDER_SEPARATOR "executabletest.exe\n", stdout); - int a = system("." FOLDER_SEPARATOR "executabletest.exe"); + fputs("." FOLDER_SEPARATOR "executabletest" EXECUTABLE_EXTENSION "\n", stdout); + int a = system("." FOLDER_SEPARATOR "executabletest" EXECUTABLE_EXTENSION); if(a != 0) { return a; diff --git a/txttest.txt b/txttest.txt index e69de29..30d74d2 100644 --- a/txttest.txt +++ b/txttest.txt @@ -0,0 +1 @@ +test \ No newline at end of file From ad2645e38cabc0412f75a940bd385d58a9d21894 Mon Sep 17 00:00:00 2001 From: maarten-laptop Date: Wed, 14 Aug 2024 11:19:34 +0200 Subject: [PATCH 3/4] * replaced all function-local variables with shorter version using $(0) * fixed glslangValidator check not working in mm_add_shader because of typo --- makefile_mini.mk | 456 +++++++++++++++++++++++------------------------ 1 file changed, 228 insertions(+), 228 deletions(-) diff --git a/makefile_mini.mk b/makefile_mini.mk index e6b5c71..da4f51d 100644 --- a/makefile_mini.mk +++ b/makefile_mini.mk @@ -232,9 +232,9 @@ else #< windows # $(3) == outputfile (cli) define mm_cli_hfile_from_file= $(strip\ - $(eval mm_cli_hfile_from_file_a:=$(shell powershell.exe "\"$(1)\" -Replace \"[^a-zA-Z0-9]\",\"_\""))\ - $(eval mm_cli_hfile_from_file_b:=$(shell powershell.exe ""\"$(mm_cli_hfile_from_file_a)\".ToUpper()"))\ - powershell.exe "$$$$a=(Get-Content -Encoding Byte -Raw $(2) | Out-String).Replace(\"`r`n\",\", \").TrimEnd(\", \"); Set-Content -NoNewline \"#ifndef $(mm_cli_hfile_from_file_b)_H`n#define $(mm_cli_hfile_from_file_b)_H`n`n`nchar $(mm_cli_hfile_from_file_a)_h[] = { $$$$a };`n`n#endif`n\"" $(3)\ + $(eval $(0)_a:=$(shell powershell.exe "\"$(1)\" -Replace \"[^a-zA-Z0-9]\",\"_\""))\ + $(eval $(0)_b:=$(shell powershell.exe ""\"$($(0)_a)\".ToUpper()"))\ + powershell.exe "$$$$a=(Get-Content -Encoding Byte -Raw $(2) | Out-String).Replace(\"`r`n\",\", \").TrimEnd(\", \"); Set-Content -NoNewline \"#ifndef $($(0)_b)_H`n#define $($(0)_b)_H`n`n`nchar $($(0)_a)_h[] = { $$$$a };`n`n#endif`n\"" $(3)\ ) endef endif @@ -246,13 +246,13 @@ endif # NOTE: not the same as $(if $(filter $(1),$(2),,) as mm_equals also.. # .. returns 1 if both $(1) and $(2) are both empty define mm_equals= -$(eval mm_equals_a:=$(strip $(1))) -$(eval mm_equals_b:=$(strip $(2))) -$(eval mm_equals_bAreBothEmpty:=0) -$(if $(mm_equals_a),,$(if $(mm_equals_b),,$(eval mm_equals_bAreBothEmpty:=1))) -$(if $(filter 1,$(mm_equals_bAreBothEmpty)),\ +$(eval $(0)_a:=$(strip $(1))) +$(eval $(0)_b:=$(strip $(2))) +$(eval $(0)_bAreBothEmpty:=0) +$(if $($(0)_a),,$(if $($(0)_b),,$(eval $(0)_bAreBothEmpty:=1))) +$(if $(filter 1,$($(0)_bAreBothEmpty)),\ 1,\ - $(if $(filter $(mm_equals_a),$(mm_equals_b)),1,0)\ + $(if $(filter $($(0)_a),$($(0)_b)),1,0)\ ) endef @@ -269,11 +269,11 @@ endef define mm_switch= $(if $(filter 1,$(call mm_equals,$(1),$(firstword $(2)))),\ $(firstword $(3)),\ - $(eval mm_switch_a:=$(words $(2)))\ - $(if $(filter 1,$(mm_switch_a)),,\ - $(eval mm_switch_b:=$(wordlist 2,$(mm_switch_a),$(2)))\ - $(eval mm_switch_c:=$(wordlist 2,$(mm_switch_a),$(3)))\ - $(call mm_switch,$(1),$(mm_switch_b),$(mm_switch_c))\ + $(eval $(0)_a:=$(words $(2)))\ + $(if $(filter 1,$($(0)_a)),,\ + $(eval $(0)_b:=$(wordlist 2,$($(0)_a),$(2)))\ + $(eval $(0)_c:=$(wordlist 2,$($(0)_a),$(3)))\ + $(call mm_switch,$(1),$($(0)_b),$($(0)_c))\ )\ ) endef @@ -286,13 +286,13 @@ mm_add_or_append_one_element=$(eval $(1)+=$(1).$(words $($(1)))) # NOTE: like $(filter <..>) but using regular expression pattern define mm_filter_using_patterns= $(strip\ - $(eval mm_filter_using_patterns_a:=$(firstword $(2)))\ - $(eval mm_filter_using_patterns_b:=$(wordlist 2,$(words $(2)),$(2)))\ - $(eval mm_filter_using_patterns_c:=$(firstword $(1)))\ - $(eval mm_filter_using_patterns_d:=$(wordlist 2,$(words $(1)),$(1)))\ + $(eval $(0)_a:=$(firstword $(2)))\ + $(eval $(0)_b:=$(wordlist 2,$(words $(2)),$(2)))\ + $(eval $(0)_c:=$(firstword $(1)))\ + $(eval $(0)_d:=$(wordlist 2,$(words $(1)),$(1)))\ $(if $(OS),\ - $(shell powershell "\"$(mm_filter_using_patterns_a)\"$(patsubst %,$(MM_COMMA)\"%\",$(mm_filter_using_patterns_b)) | Select-String -Pattern \"$(mm_filter_using_patterns_c)\"$(patsubst %,$(MM_COMMA)\"%\",$(mm_filter_using_patterns_d))"),\ - $(shell (echo "$(mm_filter_using_patterns_a)"$(patsubst %,; echo "%",$(mm_filter_using_patterns_b))) | grep -i -E "$(mm_filter_using_patterns_c)$(addprefix |,$(mm_filter_using_patterns_d))")\ + $(shell powershell "\"$($(0)_a)\"$(patsubst %,$(MM_COMMA)\"%\",$($(0)_b)) | Select-String -Pattern \"$($(0)_c)\"$(patsubst %,$(MM_COMMA)\"%\",$($(0)_d))"),\ + $(shell (echo "$($(0)_a)"$(patsubst %,; echo "%",$($(0)_b))) | grep -i -E "$($(0)_c)$(addprefix |,$($(0)_d))")\ )\ ) endef @@ -339,16 +339,16 @@ mm_check_if_defined=$(if $(filter undefined,$(origin $(2))),$(error $(2) is not # $(2) == value pattern # $(3) == values variablename define mm_check_if_valid_values= -$(eval mm_check_if_valid_values_a:=$(filter-out $(2),$($(3)))) -$(if $(mm_check_if_valid_values_a),$(error $(3) contains invalid element(s) $(mm_check_if_valid_values_a) in $(1)),) +$(eval $(0)_a:=$(filter-out $(2),$($(3)))) +$(if $($(0)_a),$(error $(3) contains invalid element(s) $($(0)_a) in $(1)),) endef # NOTE: $(1) == functionname # $(2) == value pattern # $(3) == value variablename define mm_check_if_valid_value= -$(eval mm_check_if_valid_value_a:=$(filter-out $(2),$($(3)))) -$(if $(mm_check_if_valid_value_a),$(error $(3) contains invalid value $(mm_check_if_valid_value_a) in $(1)),) +$(eval $(0)_a:=$(filter-out $(2),$($(3)))) +$(if $($(0)_a),$(error $(3) contains invalid value $($(0)_a) in $(1)),) endef #****************************************************************************** @@ -432,23 +432,23 @@ mm_get_binaryfilepath_from_binary=$(if $(filter 1,$(call mm_is_binary_ignored,$( # $(2) == filepath variablename # NOTE: assumes $(1) does not start with .makefile-mini/ define mm_add_binary= -$(eval mm_add_binary_filepath:=) +$(eval $(0)_filepath:=) $(if $(filter 1,$(call mm_is_binary_ignored,$(1))),\ - $(eval mm_add_binary_filepath:=.makefile-mini/$(1))\ + $(eval $(0)_filepath:=.makefile-mini/$(1))\ $(eval MM_IGNOREDBINARIES+=$(1)),\ - $(eval mm_add_binary_filepath:=$(1))\ + $(eval $(0)_filepath:=$(1))\ $(eval MM_NOTIGNOREDBINARIES+=$(1))\ ) -$(eval MM_FILEPATH_PER_BINARY+=$(mm_add_binary_filepath)) -$(eval $(2):=$(mm_add_binary_filepath)) +$(eval MM_FILEPATH_PER_BINARY+=$($(0)_filepath)) +$(eval $(2):=$($(0)_filepath)) endef # NOTE: $(1) == binarypart define mm_get_binarypartfolderpathpart_from_binarypart= $(strip \ - $(eval mm_get_binarypartfolderpathpart_from_binarypart_a:=$(dir $(1)))\ - $(if $(filter ./,$(mm_get_binarypartfolderpathpart_from_binarypart_a)),,\ - $(mm_get_binarypartfolderpathpart_from_binarypart_a)\ + $(eval $(0)_a:=$(dir $(1)))\ + $(if $(filter ./,$($(0)_a)),,\ + $($(0)_a)\ )\ ) endef @@ -456,9 +456,9 @@ endef # NOTE: $(1) == binarypart define mm_get_binarypartfolderpath_from_binarypart= $(strip \ - $(eval mm_get_binarypartfolderpath_from_binarypart_binarypartfolderpathpart:=$(call mm_get_binarypartfolderpathpart_from_binarypart,$(1)))\ - $(if $(mm_get_binarypartfolderpath_from_binarypart_binarypartfolderpathpart),\ - .makefile-mini/$(mm_get_binarypartfolderpath_from_binarypart_binarypartfolderpathpart)\ + $(eval $(0)_binarypartfolderpathpart:=$(call mm_get_binarypartfolderpathpart_from_binarypart,$(1)))\ + $(if $($(0)_binarypartfolderpathpart),\ + .makefile-mini/$($(0)_binarypartfolderpathpart)\ ,)\ ) endef @@ -467,9 +467,9 @@ endef # NOTE: assumes $(1) does not start with .makefile-mini/ define mm_add_binarypart= $(eval MM_BINARYPARTS+=$(1)) -$(eval mm_add_binarypart_binarypartfolderpathpart:=$(call mm_get_binarypartfolderpathpart_from_binarypart,$(1))) -$(if $(filter $(mm_add_binarypart_binarypartfolderpathpart),$(MM_FOLDERPATHPART_PER_BINARYPART)),,\ - $(eval MM_FOLDERPATHPART_PER_BINARYPART+=$(mm_add_binarypart_binarypartfolderpathpart))\ +$(eval $(0)_binarypartfolderpathpart:=$(call mm_get_binarypartfolderpathpart_from_binarypart,$(1))) +$(if $(filter $($(0)_binarypartfolderpathpart),$(MM_FOLDERPATHPART_PER_BINARYPART)),,\ + $(eval MM_FOLDERPATHPART_PER_BINARYPART+=$($(0)_binarypartfolderpathpart))\ ) endef @@ -488,8 +488,8 @@ endef # $(3) == RESOURCETYPE plural # $(4) == resources variablename define mm_check_resources= -$(eval mm_check_resources_a:=$(filter-out $(MM_$(3)),$($(4)))) -$(if $(mm_check_resources_a),$(error $(3) contains element(s) that aren't $(2) in $(1)),) +$(eval $(0)_a:=$(filter-out $(MM_$(3)),$($(4)))) +$(if $($(0)_a),$(error $(3) contains element(s) that aren't $(2) in $(1)),) endef #****************************************************************************** @@ -500,24 +500,24 @@ endef # .. $(2).. returns 1 # otherwise.. returns 0 define mm_is_resource= -$(eval mm_is_resource_bIsResource:=0) -$(foreach mm_is_resource_infoAboutResource,$(MM_INFO_PER_$(1)),\ - $(if $(filter $($(mm_is_resource_infoAboutResource).name),$(2)),\ - $(eval mm_is_resource_bIsResource:=1)\ +$(eval $(0)_bIsResource:=0) +$(foreach $(0)_infoAboutResource,$(MM_INFO_PER_$(1)),\ + $(if $(filter $($($(0)_infoAboutResource).name),$(2)),\ + $(eval $(0)_bIsResource:=1)\ ,)\ ) -$(if $(filter 1,$(mm_is_resource_bIsResource)),1,0) +$(if $(filter 1,$($(0)_bIsResource)),1,0) endef # NOTE: $(1) == RESOURCETYPE # $(2) == variablename(s) # $(3) == resources define mm_get_variables_from_resources= -$(foreach mm_get_variables_from_resources_resource,$(3),\ - $(foreach mm_get_variables_from_resources_infoAboutResource,$(MM_INFO_PER_$(1)),\ - $(if $(filter $($(mm_get_variables_from_resources_infoAboutResource).name),$(mm_get_variables_from_resources_resource)),\ - $(foreach mm_get_variables_from_resources_a,$(2),\ - $($(mm_get_variables_from_resources_infoAboutResource).$(mm_get_variables_from_resources_a))\ +$(foreach $(0)_resource,$(3),\ + $(foreach $(0)_infoAboutResource,$(MM_INFO_PER_$(1)),\ + $(if $(filter $($($(0)_infoAboutResource).name),$($(0)_resource)),\ + $(foreach $(0)_a,$(2),\ + $($($(0)_infoAboutResource).$($(0)_a))\ )\ ,)\ )\ @@ -629,40 +629,40 @@ $(if $(filter undefined,$(origin MM_SAFETY)),,\ $(call mm_check_add_shader_parameters_t,$(0),$(2))\ ) $(call mm_add_or_append_one_element,MM_INFO_PER_SHADER) -$(eval mm_add_shader_infoAboutShader:=$(lastword $(MM_INFO_PER_SHADER))) -$(call mm_info_about_shader_t,$(mm_add_shader_infoAboutShader)) -$(eval $(mm_add_shader_infoAboutShader).name:=$(1)) -$(eval $(mm_add_shader_infoAboutShader).type:=$($(2).type)) -$(eval $(mm_add_shader_infoAboutShader).filetypes:=$($(2).filetypes)) -$(eval $(mm_add_shader_infoAboutShader).spvasm:=$(patsubst %.glsl,%.spvasm,$($(2).glsl))) -$(eval $(mm_add_shader_infoAboutShader).spv:=$($(1).spv)) -$(eval mm_add_shader_bIsSpvasmFromGlsl:=0) -$(foreach mm_add_shader_infoAboutSpvasmFromGlsl,$(MM_INFO_PER_SPVASM_FROM_GLSL),\ - $(if $(filter $($(mm_add_shader_infoAboutSpvasmFromGlsl).spvasm),$($(2).spvasm)),\ - $(if $(filter $($(mm_add_shader_infoAboutSpvasmFromGlsl).type),$($(2).type)),,\ +$(eval $(0)_infoAboutShader:=$(lastword $(MM_INFO_PER_SHADER))) +$(call mm_info_about_shader_t,$($(0)_infoAboutShader)) +$(eval $($(0)_infoAboutShader).name:=$(1)) +$(eval $($(0)_infoAboutShader).type:=$($(2).type)) +$(eval $($(0)_infoAboutShader).filetypes:=$($(2).filetypes)) +$(eval $($(0)_infoAboutShader).spvasm:=$(patsubst %.glsl,%.spvasm,$($(2).glsl))) +$(eval $($(0)_infoAboutShader).spv:=$($(1).spv)) +$(eval $(0)_bIsSpvasmFromGlsl:=0) +$(foreach $(0)_infoAboutSpvasmFromGlsl,$(MM_INFO_PER_SPVASM_FROM_GLSL),\ + $(if $(filter $($($(0)_infoAboutSpvasmFromGlsl).spvasm),$($(2).spvasm)),\ + $(if $(filter $($($(0)_infoAboutSpvasmFromGlsl).type),$($(2).type)),,\ $(error $($(2).spvasm) required more than once but with different type value in $(0))\ )\ - $(if $(filter 0,$(call mm_equals,$($(mm_add_vertexshader_infoAboutSpvasmFromGlsl).glslangValidator).$($(2).glslangValidator)))\ + $(if $(filter 0,$(call mm_equals,$($($(0)_infoAboutSpvasmFromGlsl).glslangValidator).$($(2).glslangValidator)))\ $(error $($(2).spvasm) required more than once but with different glslangValidator value in $(0))\ ,)\ - $(eval mm_add_shader_bIsSpvasmFromGlsl:=1)\ + $(eval $(0)_bIsSpvasmFromGlsl:=1)\ ,)\ ) -$(if $(filter 0,$(mm_add_shader_bIsSpvasmFromGlsl)),\ +$(if $(filter 0,$($(0)_bIsSpvasmFromGlsl)),\ $(call mm_add_or_append_one_element,MM_INFO_PER_SPVASM_FROM_GLSL)\ - $(eval mm_add_shader_infoAboutSpvasmFromGlsl:=$(lastword $(MM_INFO_PER_SPVASM_FROM_GLSL)))\ - $(eval $(mm_add_shader_infoAboutSpvasmFromGlsl).type:=$($(2).type))\ - $(eval $(mm_add_shader_infoAboutSpvasmFromGlsl).spvasm:=$($(mm_add_shader_infoAboutShader).spvasm))\ - $(eval $(mm_add_shader_infoAboutSpvasmFromGlsl).glslangValidator:=$($(2).glslangValidator))\ - $(call mm_add_binarypart,$($(mm_add_shader_infoAboutShader).spvasm))\ + $(eval $(0)_infoAboutSpvasmFromGlsl:=$(lastword $(MM_INFO_PER_SPVASM_FROM_GLSL)))\ + $(eval $($(0)_infoAboutSpvasmFromGlsl).type:=$($(2).type))\ + $(eval $($(0)_infoAboutSpvasmFromGlsl).spvasm:=$($($(0)_infoAboutShader).spvasm))\ + $(eval $($(0)_infoAboutSpvasmFromGlsl).glslangValidator:=$($(2).glslangValidator))\ + $(call mm_add_binarypart,$($($(0)_infoAboutShader).spvasm))\ ,) $(if $(filter EMMShaderfiletype_Shared,$($(2).filetypes)),\ - $(call mm_add_binary,$(1).spv,$(mm_add_shader_infoAboutShader).spvFilepath),\ + $(call mm_add_binary,$(1).spv,$($(0)_infoAboutShader).spvFilepath),\ $(call mm_add_binarypart,$(1).spv)\ - $(eval $(mm_add_shader_infoAboutShader).spvFilepath:=.makefile-mini/$(1).spv)\ + $(eval $($(0)_infoAboutShader).spvFilepath:=.makefile-mini/$(1).spv)\ ) $(if $(filter EMMShaderfiletype_Static,$($(2).filetypes)),\ - $(call mm_add_binary,$(1).spv.h,$(mm_add_shader_infoAboutShader).spvHFilepath)\ + $(call mm_add_binary,$(1).spv.h,$($(0)_infoAboutShader).spvHFilepath)\ ,) endef # TODO: ^ @@ -708,14 +708,14 @@ MM_INFO_PER_O_FROM_CPP:= # NOTE: $(1) == functionname # $(2) == lib define mm_check_lib= -$(eval mm_check_lib_invalidLib:=) -$(foreach mm_check_lib_lib,$($(2)),\ - $(if $(findstring .,$(mm_check_lib_lib)),\ - $(eval mm_check_lib_invalidLib+=$(mm_check_lib_lib))\ +$(eval $(0)_invalidLib:=) +$(foreach $(0)_lib,$($(2)),\ + $(if $(findstring .,$($(0)_lib)),\ + $(eval $(0)_invalidLib+=$($(0)_lib))\ )\ ) -$(if $(mm_check_lib_invalidLib),\ - $(error $(2) contains invalid value(s) $(mm_check_lib_invalidLib) in $(1))\ +$(if $($(0)_invalidLib),\ + $(error $(2) contains invalid value(s) $($(0)_invalidLib) in $(1))\ ,) endef @@ -730,38 +730,38 @@ endef # $(7) == .gcc/.g++ # $(8) == .o define mm_add_o_from_c_or_cpp= -$(foreach mm_add_o_from_c_or_cpp_o,$(8),\ +$(foreach $(0)_o,$(8),\ $(if $(OS),\ - $(eval mm_add_o_from_c_or_cpp_cOrCpp:=$(basename $(mm_add_o_from_c_or_cpp_o))),\ - $(eval mm_add_o_from_c_or_cpp_cOrCpp:=$(basename $(basename $(mm_add_o_from_c_or_cpp_o))))\ + $(eval $(0)_cOrCpp:=$(basename $($(0)_o))),\ + $(eval $(0)_cOrCpp:=$(basename $(basename $($(0)_o))))\ )\ - $(eval mm_add_o_from_c_or_cpp_gccOrG++:=$(7))\ + $(eval $(0)_gccOrG++:=$(7))\ $(if $(OS),,\ $(if $(filter %.shared.o,$($(0)_o)),\ - $(eval mm_add_o_from_c_or_cpp_gccOrG++ +=-fpic -fvisibility=hidden)\ + $(eval $(0)_gccOrG++ +=-fpic -fvisibility=hidden)\ ,)\ )\ - $(eval mm_add_o_from_c_or_cpp_bIsOFromCOrCpp:=0)\ - $(foreach mm_add_o_from_c_or_cpp_infoAboutOFromCOrCpp,$(MM_INFO_PER_O_FROM_$(2)),\ - $(if $(filter $($(mm_add_o_from_c_or_cpp_infoAboutOFromCOrCpp).o),$(mm_add_o_from_c_or_cpp_o)),\ - $(if $(filter 0,$(call mm_equals,$($(mm_add_o_from_c_or_cpp_infoAboutOFromCOrCpp).$(4)Folders),$(6))),\ - $(error $(mm_add_o_from_c_or_cpp_o) required more than once but with different $(4)Folders value in $(1))\ + $(eval $(0)_bIsOFromCOrCpp:=0)\ + $(foreach $(0)_infoAboutOFromCOrCpp,$(MM_INFO_PER_O_FROM_$(2)),\ + $(if $(filter $($($(0)_infoAboutOFromCOrCpp).o),$($(0)_o)),\ + $(if $(filter 0,$(call mm_equals,$($($(0)_infoAboutOFromCOrCpp).$(4)Folders),$(6))),\ + $(error $($(0)_o) required more than once but with different $(4)Folders value in $(1))\ ,)\ - $(if $(filter 0,$(call mm_equals,$($(mm_add_o_from_c_or_cpp_infoAboutOFromCOrCpp).$(5)),$(mm_add_o_from_c_or_cpp_gccOrG++))),\ - $(error $(mm_add_o_from_c_or_cpp_o) required more than once but with different $(5) value in $(1))\ + $(if $(filter 0,$(call mm_equals,$($($(0)_infoAboutOFromCOrCpp).$(5)),$($(0)_gccOrG++))),\ + $(error $($(0)_o) required more than once but with different $(5) value in $(1))\ ,)\ - $(eval mm_add_o_from_c_or_cpp_bIsOFromCOrCpp:=1)\ + $(eval $(0)_bIsOFromCOrCpp:=1)\ ,)\ )\ - $(if $(filter 0,$(mm_add_o_from_c_or_cpp_bIsOFromCOrCpp)),\ + $(if $(filter 0,$($(0)_bIsOFromCOrCpp)),\ $(call mm_add_or_append_one_element,MM_INFO_PER_O_FROM_$(2))\ - $(eval mm_add_o_from_c_or_cpp_infoAboutOFromCOrCpp:=$(lastword $(MM_INFO_PER_O_FROM_$(2))))\ - $(call mm_info_about_o_from_c_or_cpp_t,$(mm_add_o_from_c_or_cpp_infoAboutOFromCOrCpp))\ - $(eval $(mm_add_o_from_c_or_cpp_infoAboutOFromCOrCpp).$(3):=$(mm_add_o_from_c_or_cpp_cOrCpp))\ - $(eval $(mm_add_o_from_c_or_cpp_infoAboutOFromCOrCpp).$(4)Folders:=$(6))\ - $(eval $(mm_add_o_from_c_or_cpp_infoAboutOFromCOrCpp).$(5):=$(mm_add_o_from_c_or_cpp_gccOrG++))\ - $(eval $(mm_add_o_from_c_or_cpp_infoAboutOFromCOrCpp).o:=$(mm_add_o_from_c_or_cpp_o))\ - $(call mm_add_binarypart,$(mm_add_o_from_c_or_cpp_o))\ + $(eval $(0)_infoAboutOFromCOrCpp:=$(lastword $(MM_INFO_PER_O_FROM_$(2))))\ + $(call mm_info_about_o_from_c_or_cpp_t,$($(0)_infoAboutOFromCOrCpp))\ + $(eval $($(0)_infoAboutOFromCOrCpp).$(3):=$($(0)_cOrCpp))\ + $(eval $($(0)_infoAboutOFromCOrCpp).$(4)Folders:=$(6))\ + $(eval $($(0)_infoAboutOFromCOrCpp).$(5):=$($(0)_gccOrG++))\ + $(eval $($(0)_infoAboutOFromCOrCpp).o:=$($(0)_o))\ + $(call mm_add_binarypart,$($(0)_o))\ ,)\ ) endef @@ -896,10 +896,10 @@ define mm_check_libraries_and_staticlibraries_and_sharedlibraries= $(call mm_check_libraries,$(1),$(2).libraries) $(call mm_check_libraries,$(1).$(2).staticlibraries) $(call mm_check_libraries,$(1).$(2).sharedlibraries) -$(eval mm_check_libraries_and_staticlibraries_and_sharedlibraries_a:=$(filter $($(2).staticlibraries),$($(2).libraries))) -$(if $(mm_check_libraries_and_staticlibraries_and_sharedlibraries_a),$(error $(mm_check_libraries_and_staticlibraries_and_sharedlibraries_a) specified both in $(2).libraries and $(2).staticlibraries) in $(1),) -$(eval mm_check_libraries_and_staticlibraries_and_sharedlibraries_b:=$(filter $($(2).sharedlibraries),$($(2).libraries))) -$(if $(mm_check_libraries_and_staticlibraries_and_sharedlibraries_b),$(error $(mm_check_libraries_and_staticlibraries_and_sharedlibraries_b) specified both in $(2).libraries and $(2).sharedlibaries) in $(1),) +$(eval $(0)_a:=$(filter $($(2).staticlibraries),$($(2).libraries))) +$(if $($(0)_a),$(error $($(0)_a) specified both in $(2).libraries and $(2).staticlibraries) in $(1),) +$(eval $(0)_b:=$(filter $($(2).sharedlibraries),$($(2).libraries))) +$(if $($(0)_b),$(error $($(0)_b) specified both in $(2).libraries and $(2).sharedlibaries) in $(1),) endef # NOTE: $(1) == functionname @@ -965,73 +965,73 @@ $(if $(filter undefined,$(origin MM_SAFETY)),,\ $(call mm_check_add_library_parameters_t,$(0),$(2))\ ) $(eval MM_INFO_PER_LIBRARY+=MM_INFO_PER_LIBRARY.$(words $(MM_INFO_PER_LIBRARY))) -$(eval mm_add_library_infoAboutLibrary:=$(lastword $(MM_INFO_PER_LIBRARY))) -$(call mm_info_about_library_t,$(mm_add_library_infoAboutLibrary)) -$(eval $(mm_add_library_infoAboutLibrary).name:=$(1)) -$(eval $(mm_add_library_infoAboutLibrary).filetypes:=$($(2).filetypes)) -$(eval mm_add_library_oFromC:=) -$(eval mm_add_library_oFromLocalC:=) -$(eval mm_add_library_oFromCpp:=) -$(eval mm_add_library_oFromLocalCpp:=) +$(eval $(0)_infoAboutLibrary:=$(lastword $(MM_INFO_PER_LIBRARY))) +$(call mm_info_about_library_t,$($(0)_infoAboutLibrary)) +$(eval $($(0)_infoAboutLibrary).name:=$(1)) +$(eval $($(0)_infoAboutLibrary).filetypes:=$($(2).filetypes)) +$(eval $(0)_oFromC:=) +$(eval $(0)_oFromLocalC:=) +$(eval $(0)_oFromCpp:=) +$(eval $(0)_oFromLocalCpp:=) $(if $(OS),\ - $(eval mm_add_library_oFromC:=$(addsuffix .o,$($(2).c)))\ - $(eval mm_add_library_oFromLocalC:=$(addsuffix .o,$($(2).localC)))\ - $(eval mm_add_library_oFromCpp:=$(addsuffix .o,$($(2).cpp)))\ - $(eval mm_add_library_oFromLocalCpp:=$(addsuffix .o,$($(2).localCpp)))\ - $(eval $(mm_add_library_infoAboutLibrary).o:=$(mm_add_library_oFromC) $(mm_add_library_oFromLocalC) $(mm_add_library_oFromCpp) $(mm_add_library_oFromLocalCpp))\ - $(eval $(mm_add_library_infoAboutLibrary).staticO:=$($(mm_add_library_infoAboutLibrary).o))\ - $(eval $(mm_add_library_infoAboutLibrary).sharedO:=$($(mm_add_library_infoAboutLibrary).o)),\ - $(if $(filter EMMLibraryfiletype_Static,$($(mm_add_library_infoAboutLibrary).filetypes)),\ - $(eval mm_add_library_staticOFromC:=$(addsuffix .static.o,$($(2).c)))\ - $(eval mm_add_library_staticOFromLocalC:=$(addsuffix .static.o,$($(2).localC)))\ - $(eval mm_add_library_staticOFromCpp:=$(addsuffix .static.o,$($(2).cpp)))\ - $(eval mm_add_library_staticOFromLocalCpp:=$(addsuffix .static.o,$($(2).localCpp)))\ - $(eval $(mm_add_library_infoAboutLibrary).staticO:=$(mm_add_library_staticOFromC) $(mm_add_library_staticOFromLocalC) $(mm_add_library_staticOFromCpp) $(mm_add_library_staticOFromLocalCpp))\ - $(eval $(mm_add_library_infoAboutLibrary).o+=$($(mm_add_library_infoAboutLibrary).staticO))\ - $(eval mm_add_library_oFromC+=$(mm_add_library_staticOFromC))\ - $(eval mm_add_library_oFromLocalC+=$(mm_add_library_staticOFromLocalC))\ - $(eval mm_add_library_oFromCpp+=$(mm_add_library_staticOFromCpp))\ - $(eval mm_add_library_oFromLocalCpp+=$(mm_add_library_staticOFromLocalCpp))\ + $(eval $(0)_oFromC:=$(addsuffix .o,$($(2).c)))\ + $(eval $(0)_oFromLocalC:=$(addsuffix .o,$($(2).localC)))\ + $(eval $(0)_oFromCpp:=$(addsuffix .o,$($(2).cpp)))\ + $(eval $(0)_oFromLocalCpp:=$(addsuffix .o,$($(2).localCpp)))\ + $(eval $($(0)_infoAboutLibrary).o:=$($(0)_oFromC) $($(0)_oFromLocalC) $($(0)_oFromCpp) $($(0)_oFromLocalCpp))\ + $(eval $($(0)_infoAboutLibrary).staticO:=$($($(0)_infoAboutLibrary).o))\ + $(eval $($(0)_infoAboutLibrary).sharedO:=$($($(0)_infoAboutLibrary).o)),\ + $(if $(filter EMMLibraryfiletype_Static,$($($(0)_infoAboutLibrary).filetypes)),\ + $(eval $(0)_staticOFromC:=$(addsuffix .static.o,$($(2).c)))\ + $(eval $(0)_staticOFromLocalC:=$(addsuffix .static.o,$($(2).localC)))\ + $(eval $(0)_staticOFromCpp:=$(addsuffix .static.o,$($(2).cpp)))\ + $(eval $(0)_staticOFromLocalCpp:=$(addsuffix .static.o,$($(2).localCpp)))\ + $(eval $($(0)_infoAboutLibrary).staticO:=$($(0)_staticOFromC) $($(0)_staticOFromLocalC) $($(0)_staticOFromCpp) $($(0)_staticOFromLocalCpp))\ + $(eval $($(0)_infoAboutLibrary).o+=$($($(0)_infoAboutLibrary).staticO))\ + $(eval $(0)_oFromC+=$($(0)_staticOFromC))\ + $(eval $(0)_oFromLocalC+=$($(0)_staticOFromLocalC))\ + $(eval $(0)_oFromCpp+=$($(0)_staticOFromCpp))\ + $(eval $(0)_oFromLocalCpp+=$($(0)_staticOFromLocalCpp))\ ,)\ - $(if $(filter EMMLibraryfiletype_Shared,$($(mm_add_library_infoAboutLibrary).filetypes)),\ - $(eval mm_add_library_sharedOFromC:=$(addsuffix .shared.o,$($(2).c)))\ - $(eval mm_add_library_sharedOFromLocalC:=$(addsuffix .shared.o,$($(2).localC)))\ - $(eval mm_add_library_sharedOFromCpp:=$(addsuffix .shared.o,$($(2).cpp)))\ - $(eval mm_add_library_sharedOFromLocalCpp:=$(addsuffix .shared.o,$($(2).localCpp)))\ - $(eval $(mm_add_library_infoAboutLibrary).sharedO:=$(mm_add_library_sharedOFromC) $(mm_add_library_sharedOFromLocalC) $(mm_add_library_sharedOFromCpp) $(mm_add_library_sharedOFromLocalCpp))\ - $(eval $(mm_add_library_infoAboutLibrary).o+=$($(mm_add_library_infoAboutLibrary).sharedO))\ - $(eval mm_add_library_oFromC+=$(mm_add_library_sharedOFromC))\ - $(eval mm_add_library_oFromLocalC+=$(mm_add_library_sharedOFromLocalC))\ - $(eval mm_add_library_oFromCpp+=$(mm_add_library_sharedOFromCpp))\ - $(eval mm_add_library_oFromLocalCpp+=$(mm_add_library_sharedOFromLocalCpp))\ + $(if $(filter EMMLibraryfiletype_Shared,$($($(0)_infoAboutLibrary).filetypes)),\ + $(eval $(0)_sharedOFromC:=$(addsuffix .shared.o,$($(2).c)))\ + $(eval $(0)_sharedOFromLocalC:=$(addsuffix .shared.o,$($(2).localC)))\ + $(eval $(0)_sharedOFromCpp:=$(addsuffix .shared.o,$($(2).cpp)))\ + $(eval $(0)_sharedOFromLocalCpp:=$(addsuffix .shared.o,$($(2).localCpp)))\ + $(eval $($(0)_infoAboutLibrary).sharedO:=$($(0)_sharedOFromC) $($(0)_sharedOFromLocalC) $($(0)_sharedOFromCpp) $($(0)_sharedOFromLocalCpp))\ + $(eval $($(0)_infoAboutLibrary).o+=$($($(0)_infoAboutLibrary).sharedO))\ + $(eval $(0)_oFromC+=$($(0)_sharedOFromC))\ + $(eval $(0)_oFromLocalC+=$($(0)_sharedOFromLocalC))\ + $(eval $(0)_oFromCpp+=$($(0)_sharedOFromCpp))\ + $(eval $(0)_oFromLocalCpp+=$($(0)_sharedOFromLocalCpp))\ ,)\ ) -$(eval $(mm_add_library_infoAboutLibrary).localStaticO:=$($(0)_staticOFromLocalC) $($(0)_staticOFromLocalCpp)) -$(eval $(mm_add_library_infoAboutLibrary).h:=$($(2).h)) -$(eval $(mm_add_library_infoAboutLibrary).hpp:=$($(2).hpp)) -$(eval $(mm_add_library_infoAboutLibrary).cc:=$(if $($(2).cpp),g++,gcc)) -$(eval $(mm_add_library_infoAboutLibrary).otherLibraries:=$(filter $($(2).libraries),$(MM_LIBRARIES))) -$(eval $(mm_add_library_infoAboutLibrary).otherStaticlibraries:=$(filter $($(2).staticlibraries),$(MM_STATICLIBRARIES))) -$(eval $(mm_add_library_infoAboutLibrary).otherSharedlibraries:=$(filter $($(2).sharedlibraries),$(MM_SHAREDLIBRARIES))) -$(eval $(mm_add_library_infoAboutLibrary).hAndHppFilepathPerOtherLibrary:=$(call mm_get_filepath_per_h_and_hpp_from_libraries,$($(mm_add_library_infoAboutLibrary).otherLibraries))) -$(eval $(mm_add_library_infoAboutLibrary).binaryfilepathPerOtherStaticlibrary:=$(call mm_get_filepath_per_binary_from_staticlibraries,$($(mm_add_library_infoAboutLibrary).otherStaticlibraries) $($(mm_add_library_infoAboutLibrary).otherLibraries))) -$(eval $(mm_add_library_infoAboutLibrary).binaryfilepathPerOtherSharedlibrary:=$(call mm_get_filepath_per_binary_from_sharedlibraries,$($(mm_add_library_infoAboutLibrary).otherSharedlibraries) $($(mm_add_library_infoAboutLibrary).otherLibraries))) -$(eval mm_add_library_a:=$(sort $(dir $($(mm_add_library_infoAboutLibrary).hAndHppFilepathPerOtherLibrary)))) -$(if $(mm_add_library_oFromC),\ - $(call mm_add_o_from_c,$(0),$(mm_add_library_a) $($(2).hAndHppFolders) $($(2).hFolders),$($(2).cGcc),$(mm_add_library_oFromC) $(mm_add_library_oFromLocalC))\ +$(eval $($(0)_infoAboutLibrary).localStaticO:=$($(0)_staticOFromLocalC) $($(0)_staticOFromLocalCpp)) +$(eval $($(0)_infoAboutLibrary).h:=$($(2).h)) +$(eval $($(0)_infoAboutLibrary).hpp:=$($(2).hpp)) +$(eval $($(0)_infoAboutLibrary).cc:=$(if $($(2).cpp),g++,gcc)) +$(eval $($(0)_infoAboutLibrary).otherLibraries:=$(filter $($(2).libraries),$(MM_LIBRARIES))) +$(eval $($(0)_infoAboutLibrary).otherStaticlibraries:=$(filter $($(2).staticlibraries),$(MM_STATICLIBRARIES))) +$(eval $($(0)_infoAboutLibrary).otherSharedlibraries:=$(filter $($(2).sharedlibraries),$(MM_SHAREDLIBRARIES))) +$(eval $($(0)_infoAboutLibrary).hAndHppFilepathPerOtherLibrary:=$(call mm_get_filepath_per_h_and_hpp_from_libraries,$($($(0)_infoAboutLibrary).otherLibraries))) +$(eval $($(0)_infoAboutLibrary).binaryfilepathPerOtherStaticlibrary:=$(call mm_get_filepath_per_binary_from_staticlibraries,$($($(0)_infoAboutLibrary).otherStaticlibraries) $($($(0)_infoAboutLibrary).otherLibraries))) +$(eval $($(0)_infoAboutLibrary).binaryfilepathPerOtherSharedlibrary:=$(call mm_get_filepath_per_binary_from_sharedlibraries,$($($(0)_infoAboutLibrary).otherSharedlibraries) $($($(0)_infoAboutLibrary).otherLibraries))) +$(eval $(0)_a:=$(sort $(dir $($($(0)_infoAboutLibrary).hAndHppFilepathPerOtherLibrary)))) +$(if $($(0)_oFromC),\ + $(call mm_add_o_from_c,$(0),$($(0)_a) $($(2).hAndHppFolders) $($(2).hFolders),$($(2).cGcc),$($(0)_oFromC) $($(0)_oFromLocalC))\ ,) -$(if $(mm_add_library_oFromCpp),\ - $(call mm_add_o_from_cpp,$(0),$(mm_add_library_a) $($(2).hAndHppFolders) $($(2).hppFolders),$($(2).cppG++),$(mm_add_library_oFromCpp) $(mm_add_library_oFromLocalCpp))\ +$(if $($(0)_oFromCpp),\ + $(call mm_add_o_from_cpp,$(0),$($(0)_a) $($(2).hAndHppFolders) $($(2).hppFolders),$($(2).cppG++),$($(0)_oFromCpp) $($(0)_oFromLocalCpp))\ ,) $(if $(filter EMMLibraryfiletype_Static,$($(2).filetypes)),\ - $(if $(strip $($(mm_add_library_infoAboutLibrary).localStaticO)),\ + $(if $(strip $($($(0)_infoAboutLibrary).localStaticO)),\ $(call mm_add_binarypart,lib$(1)$(MM_STATICLIBRARY_EXTENSION).nm)\ $(call mm_add_binarypart,lib$(1)$(MM_STATICLIBRARY_EXTENSION).o)\ ,)\ - $(call mm_add_binary,lib$(1)$(MM_STATICLIBRARY_EXTENSION),$(mm_add_library_infoAboutLibrary).$(MM_OS)$(MM_STATICLIBRARY_EXTENSION)filepath)\ + $(call mm_add_binary,lib$(1)$(MM_STATICLIBRARY_EXTENSION),$($(0)_infoAboutLibrary).$(MM_OS)$(MM_STATICLIBRARY_EXTENSION)filepath)\ ,) $(if $(filter EMMLibraryfiletype_Shared,$($(2).filetypes)),\ - $(call mm_add_binary,lib$(1)$(MM_SHAREDLIBRARY_EXTENSION),$(mm_add_library_infoAboutLibrary).$(MM_OS)$(MM_SHAREDLIBRARY_EXTENSION)filepath)\ + $(call mm_add_binary,lib$(1)$(MM_SHAREDLIBRARY_EXTENSION),$($(0)_infoAboutLibrary).$(MM_OS)$(MM_SHAREDLIBRARY_EXTENSION)filepath)\ ,) $(eval MM_LIBRARIES+=$(1)) endef @@ -1140,38 +1140,38 @@ $(if $(filter undefined,$(origin MM_SAFETY)),,\ $(call mm_check_add_executable_parameters_t,$(0),$(2))\ ) $(eval MM_INFO_PER_EXECUTABLE+=MM_INFO_PER_EXECUTABLE.$(words $(MM_INFO_PER_EXECUTABLE))) -$(eval mm_add_executable_infoAboutExecutable:=$(lastword $(MM_INFO_PER_EXECUTABLE))) -$(eval $(mm_add_executable_infoAboutExecutable).name:=$(1)) +$(eval $(0)_infoAboutExecutable:=$(lastword $(MM_INFO_PER_EXECUTABLE))) +$(eval $($(0)_infoAboutExecutable).name:=$(1)) $(if $(OS),\ - $(eval mm_add_executable_oFromC:=$(addsuffix .o,$($(2).c)))\ - $(eval mm_add_executable_oFromCpp:=$(addsuffix .o,$($(2).cpp))),\ - $(eval mm_add_executable_oFromC:=$(addsuffix .static.o,$($(2).c)))\ - $(eval mm_add_executable_oFromCpp:=$(addsuffix .static.o,$($(2).cpp)))\ + $(eval $(0)_oFromC:=$(addsuffix .o,$($(2).c)))\ + $(eval $(0)_oFromCpp:=$(addsuffix .o,$($(2).cpp))),\ + $(eval $(0)_oFromC:=$(addsuffix .static.o,$($(2).c)))\ + $(eval $(0)_oFromCpp:=$(addsuffix .static.o,$($(2).cpp)))\ ) -$(eval $(mm_add_executable_infoAboutExecutable).o:=$(mm_add_executable_oFromC) $(mm_add_executable_oFromCpp)) -$(eval $(mm_add_executable_infoAboutExecutable).libraries:=$(filter $($(2).libraries),$(MM_LIBRARIES))) -$(eval $(mm_add_executable_infoAboutExecutable).staticlibraries:=$(filter $($(2).staticlibraries),$(MM_STATICLIBARIES))) -$(eval $(mm_add_executable_infoAboutExecutable).sharedlibraries:=$(filter $($(2).sharedlibraries),$(MM_SHAREDLIBRARIES))) -$(eval $(mm_add_executable_infoAboutExecutable).hAndHppFilepathPerLibrary:=$(call mm_get_filepath_per_h_and_hpp_from_libraries,$($(mm_add_executable_infoAboutExecutable).libraries))) -$(eval $(mm_add_executable_infoAboutExecutable).binaryfilepathPerStaticlibrary:=$(call mm_get_filepath_per_binary_from_staticlibraries,$($(mm_add_executable_infoAboutExecutable).staticlibraries) $($(mm_add_executable_infoAboutExecutable).libraries))) -$(eval $(mm_add_executable_infoAboutExecutable).binaryfilepathPerSharedlibrary:=$(call mm_get_filepath_per_binary_from_sharedlibraries,$($(mm_add_executable_infoAboutExecutable).sharedlibraries) $($(mm_add_executable_infoAboutExecutable).libraries))) -$(eval mm_add_executable_a:=$(patsubst lib%$(MM_STATICLIBRARY_EXTENSION),%,$(notdir $($(mm_add_executable_infoAboutExecutable).binaryfilepathPerStaticlibrary)))) -$(eval mm_add_executable_b:=$(patsubst lib%$(MM_SHAREDLIBRARY_EXTENSION),%,$(notdir $($(mm_add_executable_infoAboutExecutable).binaryfilepathPerSharedlibrary)))) -$(eval mm_add_executable_c:=$(mm_add_executable_a) $(mm_add_executable_b)) -$(eval $(mm_add_executable_infoAboutExecutable).lib:=$(mm_add_executable_c) $($(2).lib)) -$(eval mm_add_executable_d:=$($(mm_add_executable_infoAboutExecutable).binaryfilepathPerStaticlibrary) $($(mm_add_executable_infoAboutExecutable).binaryfilepathPerSharedlibrary)) -$(eval mm_add_executable_e:=$(sort $(dir $(mm_add_executable_d)))) -$(eval $(mm_add_executable_infoAboutExecutable).libFolders:=$(mm_add_executable_e) $($(2).libFolders)) -$(eval $(mm_add_executable_infoAboutExecutable).cc:=$(if $($(2).cpp),g++,gcc)) -$(eval $(mm_add_executable_infoAboutExecutable).gccOrG++:=$($(2).gccOrG++)) -$(eval mm_add_executable_f:=$(sort $(dir $($(mm_add_executable_infoAboutExecutable).hAndHppFilepathPerLibrary)))) -$(if $(mm_add_executable_oFromC),\ - $(call mm_add_o_from_c,$(0),$(mm_add_executable_f) $($(2).hAndHppFolders) $($(2).hFolders),$($(2).cGcc),$(mm_add_executable_oFromC))\ +$(eval $($(0)_infoAboutExecutable).o:=$($(0)_oFromC) $($(0)_oFromCpp)) +$(eval $($(0)_infoAboutExecutable).libraries:=$(filter $($(2).libraries),$(MM_LIBRARIES))) +$(eval $($(0)_infoAboutExecutable).staticlibraries:=$(filter $($(2).staticlibraries),$(MM_STATICLIBARIES))) +$(eval $($(0)_infoAboutExecutable).sharedlibraries:=$(filter $($(2).sharedlibraries),$(MM_SHAREDLIBRARIES))) +$(eval $($(0)_infoAboutExecutable).hAndHppFilepathPerLibrary:=$(call mm_get_filepath_per_h_and_hpp_from_libraries,$($($(0)_infoAboutExecutable).libraries))) +$(eval $($(0)_infoAboutExecutable).binaryfilepathPerStaticlibrary:=$(call mm_get_filepath_per_binary_from_staticlibraries,$($($(0)_infoAboutExecutable).staticlibraries) $($($(0)_infoAboutExecutable).libraries))) +$(eval $($(0)_infoAboutExecutable).binaryfilepathPerSharedlibrary:=$(call mm_get_filepath_per_binary_from_sharedlibraries,$($($(0)_infoAboutExecutable).sharedlibraries) $($($(0)_infoAboutExecutable).libraries))) +$(eval $(0)_a:=$(patsubst lib%$(MM_STATICLIBRARY_EXTENSION),%,$(notdir $($($(0)_infoAboutExecutable).binaryfilepathPerStaticlibrary)))) +$(eval $(0)_b:=$(patsubst lib%$(MM_SHAREDLIBRARY_EXTENSION),%,$(notdir $($($(0)_infoAboutExecutable).binaryfilepathPerSharedlibrary)))) +$(eval $(0)_c:=$($(0)_a) $($(0)_b)) +$(eval $($(0)_infoAboutExecutable).lib:=$($(0)_c) $($(2).lib)) +$(eval $(0)_d:=$($($(0)_infoAboutExecutable).binaryfilepathPerStaticlibrary) $($($(0)_infoAboutExecutable).binaryfilepathPerSharedlibrary)) +$(eval $(0)_e:=$(sort $(dir $($(0)_d)))) +$(eval $($(0)_infoAboutExecutable).libFolders:=$($(0)_e) $($(2).libFolders)) +$(eval $($(0)_infoAboutExecutable).cc:=$(if $($(2).cpp),g++,gcc)) +$(eval $($(0)_infoAboutExecutable).gccOrG++:=$($(2).gccOrG++)) +$(eval $(0)_f:=$(sort $(dir $($($(0)_infoAboutExecutable).hAndHppFilepathPerLibrary)))) +$(if $($(0)_oFromC),\ + $(call mm_add_o_from_c,$(0),$($(0)_f) $($(2).hAndHppFolders) $($(2).hFolders),$($(2).cGcc),$($(0)_oFromC))\ ,) -$(if $(mm_add_executable_oFromCpp),\ - $(call mm_add_o_from_cpp,$(0),$(mm_add_executable_f) $($(2).hAndHppFolders) $($(2).hppFolders),$($(2).cppG++),$(mm_add_executable_oFromCpp))\ +$(if $($(0)_oFromCpp),\ + $(call mm_add_o_from_cpp,$(0),$($(0)_f) $($(2).hAndHppFolders) $($(2).hppFolders),$($(2).cppG++),$($(0)_oFromCpp))\ ,) -$(call mm_add_binary,$(1)$(MM_EXECUTABLE_EXTENSION),$(mm_add_executable_infoAboutExecutable).$(MM_OS)$(MM_EXECUTABLE_EXTENSION_OR_DOT)filepath) +$(call mm_add_binary,$(1)$(MM_EXECUTABLE_EXTENSION),$($(0)_infoAboutExecutable).$(MM_OS)$(MM_EXECUTABLE_EXTENSION_OR_DOT)filepath) $(if $(OS),,\ $(if $(filter EMMAdditionalexecutablefiletypes_Portable,$($(2).additionalfiletypes)),\ $(call mm_add_binary,$(1).AppImage,$(2).linux.AppImagefilepath)\ @@ -1241,16 +1241,16 @@ $(if $(filter undefined,$(origin MM_SAFETY)),,\ $(call mm_check_add_test_parameters_t,$(0),$(2))\ ) $(eval MM_INFO_PER_TEST+=MM_INFO_PER_TEST.$(words $(MM_INFO_PER_TEST))) -$(eval mm_add_test_infoAboutTest:=$(lastword $(MM_INFO_PER_TEST))) -$(eval $(mm_add_test_infoAboutTest).name:=$(1)) -$(foreach mm_add_test_executable,$($(2).executables),\ - $(foreach mm_add_test_infoAboutExecutable,$(MM_INFO_PER_EXECUTABLE),\ - $(if $(filter $(mm_add_test_executable),$($(mm_add_test_infoAboutExecutable).name)),\ - $(eval $(mm_add_test_infoAboutTest).filepathPerExecutable+=$($(mm_add_test_infoAboutExecutable).$(MM_OS)$(MM_EXECUTABLE_EXTENSION_OR_DOT)filepath))\ +$(eval $(0)_infoAboutTest:=$(lastword $(MM_INFO_PER_TEST))) +$(eval $($(0)_infoAboutTest).name:=$(1)) +$(foreach $(0)_executable,$($(2).executables),\ + $(foreach $(0)_infoAboutExecutable,$(MM_INFO_PER_EXECUTABLE),\ + $(if $(filter $($(0)_executable),$($($(0)_infoAboutExecutable).name)),\ + $(eval $($(0)_infoAboutTest).filepathPerExecutable+=$($($(0)_infoAboutExecutable).$(MM_OS)$(MM_EXECUTABLE_EXTENSION_OR_DOT)filepath))\ ,)\ )\ ) -$(eval $(mm_add_test_infoAboutTest).scripts:=$($(2).scripts)) +$(eval $($(0)_infoAboutTest).scripts:=$($(2).scripts)) endef #****************************************************************************** @@ -1315,9 +1315,9 @@ endef # NOTE: $(1) == infoAboutSpvasmFromGlsl define mm_add_spvasm_from_glsl_target= -$(eval mm_add_spvasm_from_glsl_target_a:=$(strip $(call mm_switch,$($(1).type),EMMShadertype_Vertex EMMShadertype_Pixel,vert frag))) +$(eval $(0)_a:=$(strip $(call mm_switch,$($(1).type),EMMShadertype_Vertex EMMShadertype_Pixel,vert frag))) .makefile-mini/$($(1).spvasm):.makefile-mini/%.spvasm:%.glsl | $(call mm_get_binarypartfolderpath_from_binarypart,$($(1).spvasm)) - glslangValidator $($(1).glslangValidator) --quiet -o $(MM_CLI_DEV_NULL) --spirv-dis -V -S $(mm_add_spvasm_from_glsl_target_a) $$< > $$@ + glslangValidator $($(1).glslangValidator) --quiet -o $(MM_CLI_DEV_NULL) --spirv-dis -V -S $($(0)_a) $$< > $$@ endef # NOTE: ^ # -o $(MM_CLI_DEV_NULL) is to work around glslangValidator always.. @@ -1386,9 +1386,9 @@ endef # NOTE: $(1) == infoAboutLibrary define mm_add_staticlibrary_target= -$(eval mm_add_staticlibrary_target_staticO:=$(addprefix .makefile-mini/,$($(1).staticO))) -$($(1).$(MM_OS)$(MM_STATICLIBRARY_EXTENSION)filepath): $(mm_add_staticlibrary_target_staticO) $($(1).hAndHppFilepathPerOtherLibrary) - ar rcs $$@ $(mm_add_staticlibrary_target_staticO) +$(eval $(0)_staticO:=$(addprefix .makefile-mini/,$($(1).staticO))) +$($(1).$(MM_OS)$(MM_STATICLIBRARY_EXTENSION)filepath): $($(0)_staticO) $($(1).hAndHppFilepathPerOtherLibrary) + ar rcs $$@ $($(0)_staticO) endef # NOTE: $(1) == infoAboutLibrary @@ -1398,9 +1398,9 @@ endef # NOTE: $(1) == infoAboutLibrary define mm_add_sharedlibrary_target= -$(eval mm_add_sharedlibrary_target_filepathPerSharedO:=$(addprefix .makefile-mini/,$($(1).sharedO))) -$($(1).$(MM_OS)$(MM_SHAREDLIBRARY_EXTENSION)filepath): $(mm_add_sharedlibrary_target_filepathPerSharedO) $($(1).hAndHppFilepathPerOtherLibrary) - $($(1).cc) -shared -o $$@ $(mm_add_sharedlibrary_target_filepathPerSharedO) +$(eval $(0)_filepathPerSharedO:=$(addprefix .makefile-mini/,$($(1).sharedO))) +$($(1).$(MM_OS)$(MM_SHAREDLIBRARY_EXTENSION)filepath): $($(0)_filepathPerSharedO) $($(1).hAndHppFilepathPerOtherLibrary) + $($(1).cc) -shared -o $$@ $($(0)_filepathPerSharedO) endef # NOTE: $(1) == infoAboutLibrary @@ -1417,9 +1417,9 @@ endif # NOTE: $(1) == infoAboutExecutable define mm_add_executable_targets= -$(eval mm_add_executable_targets_filepathPerO:=$(addprefix .makefile-mini/,$($(1).o))) -$($(1).$(MM_OS)$(MM_EXECUTABLE_EXTENSION_OR_DOT)filepath): $(mm_add_executable_targets_filepathPerO) $($(1).hAndHppFilepathPerLibrary) $($(1).binaryfilepathPerStaticlibrary) $($(1).binaryfilepathPerSharedlibrary) - $($(1).cc) $($(1).gccOrG++) -o $$@ $(mm_add_executable_targets_filepathPerO) $(addprefix -L,$($(1).libFolders)) $(addprefix -l,$($(1).lib)) +$(eval $(0)_filepathPerO:=$(addprefix .makefile-mini/,$($(1).o))) +$($(1).$(MM_OS)$(MM_EXECUTABLE_EXTENSION_OR_DOT)filepath): $($(0)_filepathPerO) $($(1).hAndHppFilepathPerLibrary) $($(1).binaryfilepathPerStaticlibrary) $($(1).binaryfilepathPerSharedlibrary) + $($(1).cc) $($(1).gccOrG++) -o $$@ $($(0)_filepathPerO) $(addprefix -L,$($(1).libFolders)) $(addprefix -l,$($(1).lib)) endef # TODO: ^ # .h prerequisites should be order only such that $$^ here still works @@ -1440,7 +1440,7 @@ $(1): endef define mm_add_folders_targets= -$(foreach mm_add_folders_targets_binarypartfolderpathpart,$(MM_FOLDERPATHPART_PER_BINARYPART),$(call mm_add_folder_target,.makefile-mini/$(mm_add_folders_targets_binarypartfolderpathpart))) +$(foreach $(0)_binarypartfolderpathpart,$(MM_FOLDERPATHPART_PER_BINARYPART),$(call mm_add_folder_target,.makefile-mini/$($(0)_binarypartfolderpathpart))) endef # NOTE: ^ # "subst /,\" because mm_cli_mkdir parameter $(1) is non cli @@ -1448,24 +1448,24 @@ endef define mm_add_test_target= .PHONY: test test: $(MM_FILEPATH_PER_BINARY) - $(foreach mm_add_test_target_infoAboutTest,$(MM_INFO_PER_TEST),$\ - $(foreach mm_add_test_target_executablefilepath,$($(mm_add_test_target_infoAboutTest).filepathPerExecutable),$\ - $(eval $(0)_a:=$(if $(findstring /,$(mm_add_test_target_executablefilepath)),,.$(MM_FOLDER_SEPARATOR))$(mm_add_test_target_executablefilepath))$\ + $(foreach $(0)_infoAboutTest,$(MM_INFO_PER_TEST),$\ + $(foreach $(0)_executablefilepath,$($($(0)_infoAboutTest).filepathPerExecutable),$\ + $(eval $(0)_a:=$(if $(findstring /,$($(0)_executablefilepath)),,.$(MM_FOLDER_SEPARATOR))$($(0)_executablefilepath))$\ $(MM_NEWLINE) @$(if $(OS),,export LD_LIBRARY_PATH=$$$$LD_LIBRARY_PATH:./:.makefile-mini/; )$($(0)_a);echo $($(0)_a)$\ )$\ - $(foreach mm_add_test_target_script,$($(mm_add_test_target_infoAboutTest).scripts),$\ - $(MM_NEWLINE) $(if $(findstring /,$(mm_add_test_target_executablefilepath)),,.$(MM_FOLDER_SEPARATOR))$(mm_add_test_target_script)$(MM_SCRIPT_EXTENSION)$\ + $(foreach $(0)_script,$($($(0)_infoAboutTest).scripts),$\ + $(MM_NEWLINE) $(if $(findstring /,$($(0)_executablefilepath)),,.$(MM_FOLDER_SEPARATOR))$($(0)_script)$(MM_SCRIPT_EXTENSION)$\ )$\ ) endef # NOTE: ^ # I tried.. -# cmd /c "start /b $(mm_add_test_target_script).bat" +# cmd /c "start /b $($(0)_script).bat" # .. which caused powershell to keep cmd.exe open after make returned.. # .. thus having manually call exit,.. # .. https://stackoverflow.com/a/41411671 # Start-Job -ScriptBlock { Set-Location $using:pwd; Invoke-Expression.. -# .. .\$args } -ArgumentList "$(mm_add_test_target_script).bat" +# .. .\$args } -ArgumentList "$($(0)_script).bat" # .. was the closest to working solution I found, but it broke the.. # .. timeout command that I used to test whether scripts where ran in.. # .. parallel, https://stackoverflow.com/a/74843981 @@ -1518,10 +1518,10 @@ endef define mm_add_clean_target= .PHONY: clean clean: - $(foreach mm_add_clean_target_binarypart,$(MM_BINARYPARTS),$(MM_NEWLINE) $(call mm_cli_rm,.makefile-mini/$(mm_add_clean_target_binarypart))) - $(foreach mm_add_clean_target_binarypartfolderpathpart,$(MM_FOLDERPATHPART_PER_BINARYPART),$(MM_NEWLINE) $(call mm_cli_rmdir,.makefile-mini/$(mm_add_clean_target_binarypartfolderpathpart))) - $(foreach mm_add_clean_target_binaryfilepath,$(MM_FILEPATH_PER_BINARY),$(MM_NEWLINE) $(call mm_cli_rm,$(mm_add_clean_target_binaryfilepath))) - $(foreach mm_add_clean_target_release,$(MM_RELEASE),$(MM_NEWLINE) $(call mm_cli_rm,$(mm_add_clean_target_release))) + $(foreach $(0)_binarypart,$(MM_BINARYPARTS),$(MM_NEWLINE) $(call mm_cli_rm,.makefile-mini/$($(0)_binarypart))) + $(foreach $(0)_binarypartfolderpathpart,$(MM_FOLDERPATHPART_PER_BINARYPART),$(MM_NEWLINE) $(call mm_cli_rmdir,.makefile-mini/$($(0)_binarypartfolderpathpart))) + $(foreach $(0)_binaryfilepath,$(MM_FILEPATH_PER_BINARY),$(MM_NEWLINE) $(call mm_cli_rm,$($(0)_binaryfilepath))) + $(foreach $(0)_release,$(MM_RELEASE),$(MM_NEWLINE) $(call mm_cli_rm,$($(0)_release))) endef # NOTE: ^ # $(MM_NEWLINE)$(call <...>) @@ -1544,28 +1544,28 @@ $(eval $(call mm_add_default_target)) $(eval $(call mm_add_folders_targets)) -$(foreach mm_add_makefile_infoAboutSpvasmFromGlsl,$(MM_INFO_PER_SPVASM_FROM_GLSL),$\ -$(eval $(call mm_add_spvasm_from_glsl_target,$(mm_add_makefile_infoAboutSpvasmFromGlsl)))$\ +$(foreach $(0)_infoAboutSpvasmFromGlsl,$(MM_INFO_PER_SPVASM_FROM_GLSL),$\ +$(eval $(call mm_add_spvasm_from_glsl_target,$($(0)_infoAboutSpvasmFromGlsl)))$\ ) -$(foreach mm_add_makefile_infoAboutShader,$(MM_INFO_PER_SHADER),$\ -$(eval $(call mm_add_shader_target,$(mm_add_makefile_infoAboutShader)))$\ +$(foreach $(0)_infoAboutShader,$(MM_INFO_PER_SHADER),$\ +$(eval $(call mm_add_shader_target,$($(0)_infoAboutShader)))$\ ) -$(foreach mm_add_makefile_infoAboutOFromC,$(MM_INFO_PER_O_FROM_C),$\ -$(eval $(call mm_add_o_from_c_target,$(mm_add_makefile_infoAboutOFromC)))$\ +$(foreach $(0)_infoAboutOFromC,$(MM_INFO_PER_O_FROM_C),$\ +$(eval $(call mm_add_o_from_c_target,$($(0)_infoAboutOFromC)))$\ ) -$(foreach mm_add_makefile_infoAboutOFromCpp,$(MM_INFO_PER_O_FROM_CPP),$\ -$(eval $(call mm_add_o_from_cpp_target,$(mm_add_makefile_infoAboutOFromCpp)))$\ +$(foreach $(0)_infoAboutOFromCpp,$(MM_INFO_PER_O_FROM_CPP),$\ +$(eval $(call mm_add_o_from_cpp_target,$($(0)_infoAboutOFromCpp)))$\ ) -$(foreach mm_add_makefile_infoAboutLibrary,$(MM_INFO_PER_LIBRARY),$\ -$(eval $(call mm_add_library_targets,$(mm_add_makefile_infoAboutLibrary)))$\ +$(foreach $(0)_infoAboutLibrary,$(MM_INFO_PER_LIBRARY),$\ +$(eval $(call mm_add_library_targets,$($(0)_infoAboutLibrary)))$\ ) -$(foreach mm_add_makefile_infoAboutExecutable,$(MM_INFO_PER_EXECUTABLE),$\ -$(eval $(call mm_add_executable_targets,$(mm_add_makefile_infoAboutExecutable)))$\ +$(foreach $(0)_infoAboutExecutable,$(MM_INFO_PER_EXECUTABLE),$\ +$(eval $(call mm_add_executable_targets,$($(0)_infoAboutExecutable)))$\ ) $(eval $(call mm_add_test_target)) From 673e4fb22ddad7a313d3fb45c2350131be6a9c11 Mon Sep 17 00:00:00 2001 From: maarten-laptop Date: Wed, 14 Aug 2024 11:33:13 +0200 Subject: [PATCH 4/4] * changed structure of develop branch to be outside of makefile-mini folder with other required *-mini projects added as submodules * changed LICENSE to normal MIT license, as project is starting to contain more content now, and I don't know if a public domain license could be misused by somebody else to try to relicense my work --- .gitmodules | 6 ++++++ .gitignore => makefile-mini/.gitignore | 0 LICENSE => makefile-mini/LICENSE | 8 ++++---- Makefile => makefile-mini/Makefile | 0 executabletest.c => makefile-mini/executabletest.c | 0 executabletest.cpp => makefile-mini/executabletest.cpp | 0 {foldertest => makefile-mini/foldertest}/foldertest.c | 0 {foldertest => makefile-mini/foldertest}/foldertest.h | 0 headertest.h => makefile-mini/headertest.h | 0 makefile_mini.mk => makefile-mini/makefile_mini.mk | 0 mdtest.md => makefile-mini/mdtest.md | 0 .../pixelshadertest.glsl | 0 sharedlibrarytest.c => makefile-mini/sharedlibrarytest.c | 0 staticlibrarytest.c => makefile-mini/staticlibrarytest.c | 0 .../staticlibrarytest.cpp | 0 .../testexecutabletest.c | 0 testscripttest => makefile-mini/testscripttest | 0 testscripttest.bat => makefile-mini/testscripttest.bat | 0 txttest.txt => makefile-mini/txttest.txt | 0 .../vertexshadertest.glsl | 0 sharedlibrary-mini | 1 + test-mini | 1 + 22 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 .gitmodules rename .gitignore => makefile-mini/.gitignore (100%) rename LICENSE => makefile-mini/LICENSE (73%) rename Makefile => makefile-mini/Makefile (100%) rename executabletest.c => makefile-mini/executabletest.c (100%) rename executabletest.cpp => makefile-mini/executabletest.cpp (100%) rename {foldertest => makefile-mini/foldertest}/foldertest.c (100%) rename {foldertest => makefile-mini/foldertest}/foldertest.h (100%) rename headertest.h => makefile-mini/headertest.h (100%) rename makefile_mini.mk => makefile-mini/makefile_mini.mk (100%) rename mdtest.md => makefile-mini/mdtest.md (100%) rename pixelshadertest.glsl => makefile-mini/pixelshadertest.glsl (100%) rename sharedlibrarytest.c => makefile-mini/sharedlibrarytest.c (100%) rename staticlibrarytest.c => makefile-mini/staticlibrarytest.c (100%) rename staticlibrarytest.cpp => makefile-mini/staticlibrarytest.cpp (100%) rename testexecutabletest.c => makefile-mini/testexecutabletest.c (100%) rename testscripttest => makefile-mini/testscripttest (100%) mode change 100644 => 100755 rename testscripttest.bat => makefile-mini/testscripttest.bat (100%) rename txttest.txt => makefile-mini/txttest.txt (100%) rename vertexshadertest.glsl => makefile-mini/vertexshadertest.glsl (100%) create mode 160000 sharedlibrary-mini create mode 160000 test-mini diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..26c7cb3 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "sharedlibrary-mini"] + path = sharedlibrary-mini + url = https://github.com/Wallby/sharedlibrary-mini.git +[submodule "test-mini"] + path = test-mini + url = https://github.com/Wallby/test-mini.git diff --git a/.gitignore b/makefile-mini/.gitignore similarity index 100% rename from .gitignore rename to makefile-mini/.gitignore diff --git a/LICENSE b/makefile-mini/LICENSE similarity index 73% rename from LICENSE rename to makefile-mini/LICENSE index 484d6df..87b5c36 100644 --- a/LICENSE +++ b/makefile-mini/LICENSE @@ -1,12 +1,12 @@ -MIT No Attribution - -Copyright 2023 Martinus Theodorus Johannes Helena ten Velden +Copyright (c) 2024 Martinus Theodorus Johannes Helena ten Velden Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so. +permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A diff --git a/Makefile b/makefile-mini/Makefile similarity index 100% rename from Makefile rename to makefile-mini/Makefile diff --git a/executabletest.c b/makefile-mini/executabletest.c similarity index 100% rename from executabletest.c rename to makefile-mini/executabletest.c diff --git a/executabletest.cpp b/makefile-mini/executabletest.cpp similarity index 100% rename from executabletest.cpp rename to makefile-mini/executabletest.cpp diff --git a/foldertest/foldertest.c b/makefile-mini/foldertest/foldertest.c similarity index 100% rename from foldertest/foldertest.c rename to makefile-mini/foldertest/foldertest.c diff --git a/foldertest/foldertest.h b/makefile-mini/foldertest/foldertest.h similarity index 100% rename from foldertest/foldertest.h rename to makefile-mini/foldertest/foldertest.h diff --git a/headertest.h b/makefile-mini/headertest.h similarity index 100% rename from headertest.h rename to makefile-mini/headertest.h diff --git a/makefile_mini.mk b/makefile-mini/makefile_mini.mk similarity index 100% rename from makefile_mini.mk rename to makefile-mini/makefile_mini.mk diff --git a/mdtest.md b/makefile-mini/mdtest.md similarity index 100% rename from mdtest.md rename to makefile-mini/mdtest.md diff --git a/pixelshadertest.glsl b/makefile-mini/pixelshadertest.glsl similarity index 100% rename from pixelshadertest.glsl rename to makefile-mini/pixelshadertest.glsl diff --git a/sharedlibrarytest.c b/makefile-mini/sharedlibrarytest.c similarity index 100% rename from sharedlibrarytest.c rename to makefile-mini/sharedlibrarytest.c diff --git a/staticlibrarytest.c b/makefile-mini/staticlibrarytest.c similarity index 100% rename from staticlibrarytest.c rename to makefile-mini/staticlibrarytest.c diff --git a/staticlibrarytest.cpp b/makefile-mini/staticlibrarytest.cpp similarity index 100% rename from staticlibrarytest.cpp rename to makefile-mini/staticlibrarytest.cpp diff --git a/testexecutabletest.c b/makefile-mini/testexecutabletest.c similarity index 100% rename from testexecutabletest.c rename to makefile-mini/testexecutabletest.c diff --git a/testscripttest b/makefile-mini/testscripttest old mode 100644 new mode 100755 similarity index 100% rename from testscripttest rename to makefile-mini/testscripttest diff --git a/testscripttest.bat b/makefile-mini/testscripttest.bat similarity index 100% rename from testscripttest.bat rename to makefile-mini/testscripttest.bat diff --git a/txttest.txt b/makefile-mini/txttest.txt similarity index 100% rename from txttest.txt rename to makefile-mini/txttest.txt diff --git a/vertexshadertest.glsl b/makefile-mini/vertexshadertest.glsl similarity index 100% rename from vertexshadertest.glsl rename to makefile-mini/vertexshadertest.glsl diff --git a/sharedlibrary-mini b/sharedlibrary-mini new file mode 160000 index 0000000..5a89c55 --- /dev/null +++ b/sharedlibrary-mini @@ -0,0 +1 @@ +Subproject commit 5a89c55b62e5ccbea8768ba80dbcfd0f61770953 diff --git a/test-mini b/test-mini new file mode 160000 index 0000000..1a76745 --- /dev/null +++ b/test-mini @@ -0,0 +1 @@ +Subproject commit 1a767453021a025af48ceda878981e6202bb3808