Tag Archives: Makefile

Have your Makefile upload built binary to a target

A colleague of mine introduced me to this really handy pice of command line software that has helped me in my daily work since then: curl.

By simply adding a few extra lines to the end of my final rule of the Makefile I’m currently using I can now have the newly built binary automatically uploaded to a any folder on an target board of my liking, without having to do all these steps myself:

# Build finaly binary. If "IP" is defined on command line, upload
# built binary using curl.
$(TARGET_NAME).out : ...
ifdef IP
curl -T $(TARGET_NAME).out ftp://x:x@$(IP)/c/bin/

Simly add the IP address to use when invoking the Makefile, and you’re all set:

$ make IP=