writing and uploading sketch as cpp file
See my post about How the IDE organizes things.

Also see my page about how to avoid the quirks of the IDE sketch file pre-preprocessing.

You can certainly manage without .ino files. As Edgar Bonet says, they are really C++ files with certain pre-processing (see link above).


  but what about these loop() and setup() functions


Effectively, the Arduino IDE supplies a main function that looks like this:

int main ()
  {
  init ();    // initialize hardware, including timers and timer interrupts
  setup ();   // user setup
  while (true)
    loop ();  // stuff to be done repeatedly
  return 0;   // this will never be executed
  }


(It's slightly more complex, to allow for USB where applicable, but that is the idea).


  But still I did not found the step by step guide how to do it.


I'm pretty sure there are a lot of example "make" files around which show the idea.

I have an example here.