Skip to content

Instantly share code, notes, and snippets.

@ajmontag
Created November 13, 2012 07:17
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 ajmontag/4064452 to your computer and use it in GitHub Desktop.
Save ajmontag/4064452 to your computer and use it in GitHub Desktop.
A Handy makefile for simple C/C++ applicaitons
# Makefile for myProgram
FLAGS = -Wall -g
COMPILEONLY = $(CXX) $(FLAGS) -c $<
LINK = $(CXX) $(FLAGS) -o $@ $+
# All targets to be made
.PHONY: all
all: myProgram
# Executable Targets
myProgram: main.o
$(LINK)
# Object File Targets
main.o: main.cpp utils.h
$(COMPILEONLY)
# Housekeeping targets
.PHONY: clean
clean:
rm *.o
.PHONY: cleandist
cleandist:
rm myProgram *.o
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment