Last active
February 2, 2017 05:43
-
-
Save Eskalol/3fc67c85a6a3ed2157cefc113cf07439 to your computer and use it in GitHub Desktop.
Makefile template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC = gcc | |
CFLAGS = -g -Wall -Wextra | |
OBJECTS = #insert objects here example: cool.o | |
PHONY: clean all | |
all: main | |
%.o: %.c | |
$(CC) $(CFLAGS) -c $< -o $@ | |
main: #insert objects needed to precompile example: cool.o | |
$(CC) $(CFLAGS) $^ -o $@ | |
clean: | |
$(RM) $(OBJECTS) main | |
# Useful things to have in your makefile ;) | |
valgrind: | |
valgrind --leak-check=full ./main | |
gdb: | |
gdb -ex=r --args ./main | |
kcachegrind: | |
valgrind --tool=callgrind ./main && kcachegrind & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment