Skip to content

Instantly share code, notes, and snippets.

@ajmontag
Created November 13, 2012 07:17
Show Gist options
  • Select an option

  • Save ajmontag/4064452 to your computer and use it in GitHub Desktop.

Select an option

Save ajmontag/4064452 to your computer and use it in GitHub Desktop.

Revisions

  1. ajmontag created this gist Nov 13, 2012.
    26 changes: 26 additions & 0 deletions makefile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    # 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