simplemake - A simple makefile

Lobsters·13 points·river·over 10 years ago·notabug.org

<p>Hello!</p> <p>I wanted to share a makefile that I have been using for multifile C projects that produce a single binary program. I included a simple hello world example so that it's easy to test this out.</p> <p>The way it works is you list all your .c files in <code>SOURCES=main.c greet.c</code> and it makes targets that compile them into .o object files. It also has a target called <code>main</code> which links all the objects together to make the final program.</p> <p>If you change one of the .c files it will recompile just that one object file before linking them all together to rebuild the binary. This helps a good fast workflow.</p> <p>Hope it's useful! I have been using this as a base for most of my projects. It can be used for other languages than C too if you edit it a little.</p>

Read the full article at notabug.org →

Related stories

Related topics