How to rebuild libsam library?

I want to rebuild the libsam library for the Arduino Due after making some changes in one of the source functions (particularly the function UDD_Send in uotghs_device.c). I tried to recompile the ino script using the arduino IDE but the function didn't change. As I may understand this is due to the fact that arduino uses precompiled libraries (libsam_sam3x8e_gcc_rel.a in this case) that are installed during the installation with no need of rebuilding each time we upload a sketch.

I tried to rebuild the libsam library using the makefile for the library (located in ...\Arduino15\packages\arduino\hardware\sam\1.6.9\system\libsam\build_gcc), but I have no luck. I tried using the ggc compiler of cygwin but I am not really an expert and I don't know if this is the good choice.

Does anyone know how to rebuild the libsam library? which compiler should I use?

Any help will be appreciate