I am using different environment variables for each compiler in my bash profile. I then import the respective variable in the respective tup variant and assign it to a variable I call COMPILER. That $(COMPILER) variable is then used in the rule. This way, each variant can create complete custom setups, including compiler options, etc. for each platform I am building.
So, for example, for OSX, it will look like this... ifdef OSX import PROJECT_OSX_COMPILER=gcc COMPILER = $(PROJECT_OSX_COMPILER) CFLAGS += -fdiagnostics-color=always CFLAGS += -mmacosx-version-min=10.13 endif For Windows, for example, it will then look like this ifdef WIN32 import PROJECT_WIN32_COMPILER=clang import PROJECT_WIN32_SYSTEM_INCLUDE COMPILER = $(PROJECT_WIN32_COMPILER) OUTNAME = libogg.lib CFLAGS += -target x86_64-pc-win32 CFLAGS += -fdeclspec CFLAGS += -D_CRT_SECURE_NO_WARNINGS CFLAGS += -D_CRT_NONSTDC_NO_DEPRECATE CFLAGS += -DWIN32_LEAN_AND_MEAN CFLAGS += -isystem "$(PROJECT_WIN32_SYSTEM_INCLUDE)" endif and so on... This is not exactly what you're asking but, perhaps, it will give you an idea for a different approach. Guido On Tuesday, November 1, 2022 at 8:11:31 AM UTC-7 Satish K wrote: Hello, I have several projects using different versions of the same compiler. Since Tup takes the PATH from system environment on windows, it will find the first one in the PATH that matches the name and uses it. I know that I can use different system environment variables specific to compiler version to get around this behavior. However, we have a simple practice of using batch files to set the Path before executing makefile. Is it possible to use batch files to set the compiler path before invoking Tup ? Thanks, Satish K -- -- tup-users mailing list email: [email protected] unsubscribe: [email protected] options: http://groups.google.com/group/tup-users?hl=en --- You received this message because you are subscribed to the Google Groups "tup-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tup-users/2b830d9d-4f9b-4537-bacd-69e04396bdccn%40googlegroups.com.
