Sublime Forum

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

#1

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.

0 Likes

#2

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

#3

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

2 Likes

#4

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"?

0 Likes

#5

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

…succeed. Thanks a lot!!

2 Likes

#6

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:

  1. https://github.com/evandrocoan/SublimeAMXX_Editor/blob/master/AmxxPawn.sh
  2. https://github.com/evandrocoan/SublimeAMXX_Editor/blob/master/AmxxPawn.sublime-build
0 Likes