Skip to content

Instantly share code, notes, and snippets.

@woodbridge
Created February 1, 2015 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woodbridge/7e09aea12dc461edd688 to your computer and use it in GitHub Desktop.
Save woodbridge/7e09aea12dc461edd688 to your computer and use it in GitHub Desktop.
# This Makefile should be used as a template for future Makefiles.
# It’s heavily commented, so hopefully you can understand what each
# line does.
# We’ll use gcc for C compilation and g++ for C++ compilation
CC = gcc
CXX = g++
# Let’s leave a place holder for additional include directories
INCLUDES =
# Compilation options:
# -g for debugging info and -Wall enables all warnings
CFLAGS = -g -Wall $(INCLUDES)
CXXFLAGS = -g -Wall $(INCLUDES)
# Linking options:
# -g for debugging info
LDFLAGS = -g
# List the libraries you need to link with in LDLIBS
# For example, use "-lm" for the math library
LDLIBS =
convert: main.o
main.o: main.c
printf-test: printf-test.o
printf-test.o: printf-test.c
.PHONY: clean
clean:
rm -f *.o a.out core main
# "all" target is useful if your Makefile builds multiple programs.
# Here we’ll have it first do "clean", and rebuild the main target.
.PHONY: all
all: clean main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment