Porting an homebrew is usually simpler than coding it from scratch. If the code is highly portable (i.e based on standard libraries), there is the possibility that you only need to digit the "make" command, but more usually you have to be an expert coder, experienced of the target system (and sometime of the source system too).
If you need to adapt I/O functions calls or system calls, It's a creative task, not something that can be automated.