~ashn/c-boilerplate

Boilerplate code for a new C99 project
Fix typo in README
Rename COPYING -> LICENSE
Clang format

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~ashn/c-boilerplate
read/write
git@git.sr.ht:~ashn/c-boilerplate

You can also use your local clone with git send-email.

#C BOILERPLATE

Boilerplate code for a new C99 project. Includes a Makefile, .clang-format, .gitignore, and some placeholder header & source files.

#How to Use This Repository

#Setup

  1. Download the repository
  2. Remove (rm -rf) .git/
  3. Replace TARGET = foo in Makefile with TARGET = your_binary_name
  4. Replace foo in .gitignore with the $(TARGET) specified in Makefile
  5. Update OBJS and LDLIBS in Makefile as appropriate
  6. Replace LICENSE with whatever license you want

#Makefile Use

$ make CFLAGS='$(C99_DBG)'  # Debug
$ make                      # Release


$ # CC should be gcc, musl-gcc, clang, etc.
$ make CC=clang CFLAGS='$(GNU_DBG)'              # Debug (GNUC compiler)

$ make CC=clang CFLAGS='$(GNU_DBG) $(SANITIZE)'  # Debug (GNUC compiler) with
                                                 # Address Sanitizer, Leak
                                                 # Sanitizer, and UB Sanitizer
                                                 # (UB Sanitizer is glibc only)

$ make CC=clang CFLAGS='$(GNU_REL)'              # Release


$ make format  # Run clang-format on all header & source files in-place


$ make clean  # Remove $(TARGET) and $(OBJS)