I am using a make.bat file to compile my Fortran code. To compile using the ifort command, I first need to initialize the compiler by executing ifortvarsbat intel64 command where I had to setup the path variable.
This works fine, however, the path keeps increasing in size and says command too long after 3-4 runs. Now, I open a command prompt, run the make.bat file once and then comment the ifort setup section so my successive run of the make.bat do not set the path multiple times.
I was hoping I could write an IF ELSE command to check whether ifort command executes or not and only set the path and call ifortvars if its not already set. This would save me commenting and uncommenting the make.bat file every time I open a new command prompt.
Unfortunately, I don't know much about batch script writing. Can someone help me with this.
@echo on
@echo ==============================================
@echo Setting Intel Fortran Compiler, please wait ...
@echo ==============================================
::set MY_PATH=C:\Program Files (x86)\Intel\Composer XE 2013\bin
::call "%MY_PATH%"\ifortvars.bat intel64
::call "%MY_PATH%"\ifortvars.bat ia32
@echo ==============================================
@echo Compiling program:
@echo ==============================================
:: -O3 option is used to optimize the code
ifort -O3 "Main.F90"