Created
November 13, 2012 07:17
-
-
Save ajmontag/4064452 to your computer and use it in GitHub Desktop.
A Handy makefile for simple C/C++ applicaitons
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
# 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