A Makefile and directory structure for building new C Projects or Libraries
- Clone or fork this repo
- Remove the
.git
folder and.gitignore
file (if need be) - Rename
LICENSE
toLICENSE.Makefile
- Rename
README.md
toREADME.Makefile.md
- Customize the project layout and
Makefile
to your needs
If you're building an binary,
- In
Makefile
, defineEXE
- Put your code in
src/
- Put your headers in
src/inc/
- Put your tests in
t/
- Then you can type
make
,make test
,make install
,make showconfig
,make WITH_DEBUG=1
,make WITH_PROFILING=1
If you're building a library
- In
Makefile
, defineLNK
- Put your code in
src/lib/
- Put your headers in
include/
- Put your tests in
t/
- Then you can type
make
,make test
,make install
,make showconfig
,make WITH_DEBUG=1
,make WITH_PROFILING=1
With watch
installed, you can do continuous integration, test, or deployment.
- For continuous integration (
make clean all
), typemake start_ci
. To kill it, typemake stop_ci
- For continuous test (
make test
), typemake start_ct
. To kill it, typemake stop_cd
- For continuous deployment (
make install
), typemake start_cd
. To kill it, typemake stop_cd
You can also customize CFLAGS
, LDFLAGS
, DESTDIR
from the command line or in the Makefile