Skip to content

Instantly share code, notes, and snippets.

@felipecustodio
Created December 12, 2016 06:44
Show Gist options
  • Save felipecustodio/b5b6c8d8c5c310104721c47bcdd4c4aa to your computer and use it in GitHub Desktop.
Save felipecustodio/b5b6c8d8c5c310104721c47bcdd4c4aa to your computer and use it in GitHub Desktop.
Makefile template for C college assignments
# using gcc compiler
CC = gcc
# output path and filename
BINARY = ./build/output
# sources directory
SRC = src/main.c
# includes directory
INCLUDES = ./includes
# libraries and flags
LIBS = -lm
FLAGS = -Wall -O0 -g -Wextra
all: compile run
compile:
$(CC) -o $(BINARY) -I$(INCLUDES) $(SRC) $(LIBS)
test:
run clean debug
run:
clear && $(BINARY)
debug:
valgrind --leak-check=full --show-reachable=yes --track-origins=yes $(BINARY)
clean:
rm *.o
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment