Sublime Forum

Is it possible to compile and execute FORTRAN in one build system?


I’m using Sublime Text 3 to run FORTRAN. Here is my build system for FORTRAN:

Every time when I want to get the results, I do the following steps: 1. press ctrl + shift + b and select Fortran to compile the file. 2. press ctrl + shift + b and select Fortran Run to show the result. Is it possible to finish this work in only one time? I mean, I feel tired to press the ctrl + shift + b twice. I modified the build file for several times, but it didn’t work out. Is there any suggestions? Thank you.



Sublime’s build system does not understand dependencies. What you could do is write a makefile that handles the deps, then just invoke make with sublime’s build system.

1 Like


you can chain your shell commands together just like you would without ST involved.

i.e. compile the code, and if it succeeds, execute the resulting binary



um… I don’t know how to create makefile. I searched its usage yesterday, but the tutorial seemed complicated to me. Now what left in my mind are the words like object, compile, and link. I got the feeling that makefile is used for compiling several files and link the results together. But I still don’t know how to write multi-command in a makefile. Could you show me some simple examples? I’m not sure how to invoke make in the build system. I guess it should be _“shell_cmd”: make"?



Do you mean like this “shell_cmd”: “gfortran $file_name -o ${file_base_name} && ${file_base_name}.exe”,

…succeed. Thanks a lot!!



If you do not know how to write a Makefile, write a shell script to build it for you. I used on shell script on this package: