Updating the makefile for Arduino IDE

I have connected an Arduino Uno to the Raspberry Pi via SPI (with the reset line) and Serial and am able to upload the code via SPI using the following command:
avrdude -c gpio -p m328p -U flash:w:firmware.hex
I want to upload the code to the Arduino from the IDE itself running on the Raspberry Pi. For this I have burnt the bootloader and and use the default Serial Port of the Raspberry Pi to upload the code. This works fine. Now the problem is that since I am using just the Serial lines, the Arduino does not reset automatically and I have to press the reset button before the uploading starts.

I was trying to update the Makefile of the Arduino IDE which it uses to generate the firmware files and upload the code but I am unable to do so. It would be great if someone could help me with this to find out which is exact makefile, which is used for the process and how to insert the code to reset the Arduino just before uploading (this resets the Arduino avrdude -c gpio -p m328p).

Thanks,
Karan

I was trying to update the Makefile of the Arduino IDE which it uses to generate the firmware files and upload the code

The IDE doesn't use a make file.