# A makefile for the rabbit example that illustrates some basic # properties of make and makefiles. # # Simon Parsons # May 31st 2009 # Default target .PHONY: all all: testrabbit # A rule to build point. # If the pre-requisites exist, then the rule fires. point: point.cpp point.h g++ -c point.cpp -o point.o # A rule to build testpoint # Making the rule point a pre-requisite means that make will run the rule # point before running the rule testpoint. testpoint: point g++ point.o testpoint.cpp -o testpoint # A rule to build rabbit. rabbit: rabbit.cpp rabbit.h g++ -c rabbit.cpp -o rabbit.o # A rule to build testrabbit # Making point.o and rabbit.o pre-requisites means that the rules for making # these will be fired if either file is missing. testrabbit: point.o rabbit.o g++ point.o rabbit.o testrabbit.cpp -o testrabbit # This rule tells make to delete all the output files .PHONY: clean clean: rm -f point.o rm -f rabbit.o rm -f testrabbit rm -f testpoint