Using Arduino as a standalone compiler
First of all: The Arduino IDE brings its own GCC compiler. It is a version, that can compile for the AVR platform (don't know, if the standard version is capable of that).
When you activate verbose output for compilation in the preferences of your Arduino IDE, you can actually see, what calls to GCC the IDE is doing. You could use that to replicate it.
If you only want to use the sublime text editor for programming and not rebuilding the compilation environment of Arduino for fun (which I wouldn't able to help with), you might wanna have a look at the Arduino-cli. It gives you a tool to invoke important function, that normally the IDE does, via commandline (like installing cores and libraries, compiling and uploading). Thats what I'm currently using with sublime for programming in Arduino. It allows me to invoke building an uploading from sublime without having the Arduino IDE open.
If you want to go that way, here are the sublime-build files, that I use for my Arduino Nanos and ATtiny84s. Maybe you can adapt them for your needs. (Note: I omitted multiple variants, that I use to upload on different com ports, because the com port is the only thing, that changes there. Also I'm on Ubuntu, so on Windows or Mac it might look a bit different)
For the Nano:
{
    &quot;cmd&quot; : [&quot;arduino-cli compile --fqbn arduino:avr:nano&quot;],
    &quot;working_dir&quot;: &quot;$file_path&quot;,
    &quot;shell&quot;:true,
    &quot;file_patterns&quot;:[&quot;*.ino&quot;],
    &quot;variants&quot;: [
        {
            &quot;cmd&quot; : [&quot;arduino-cli compile --fqbn arduino:avr:nano &amp;&amp; arduino-cli upload -v --fqbn arduino:avr:nano:cpu=atmega328old --port /dev/ttyUSB0&quot;],
            &quot;working_dir&quot;: &quot;$file_path&quot;,
            &quot;shell&quot;:true,
            &quot;name&quot;: &quot;Compile &amp; Upload ttyUSB0&quot;
        }
    ]
}

For the ATtiny84:
{
    &quot;cmd&quot; : [&quot;arduino-cli compile --fqbn ATTinyCore:avr:attinyx4:chip=84&quot;],
    &quot;working_dir&quot;: &quot;$file_path&quot;,
    &quot;shell&quot;:true,
    &quot;file_patterns&quot;:[&quot;*.ino&quot;],
    &quot;variants&quot;: [
        {
            &quot;cmd&quot; : [&quot;arduino-cli compile --fqbn ATTinyCore:avr:attinyx4:chip=84 &amp;&amp; arduino-cli upload -v --fqbn ATTinyCore:avr:attinyx4:chip=84 --programmer arduinoasisp --port /dev/ttyUSB0&quot;],
            &quot;working_dir&quot;: &quot;$file_path&quot;,
            &quot;shell&quot;:true,
            &quot;name&quot;: &quot;ATtiny84: Compile &amp; Upload ttyUSB0&quot;
        }
    ]
}