Skip to content

Instantly share code, notes, and snippets.

@hustlijian
Created August 27, 2014 13:46

Revisions

  1. hustlijian created this gist Aug 27, 2014.
    11 changes: 11 additions & 0 deletions Makefile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    CXXFLAGS=-Wall -g
    CC=g++
    LDFLAGS=-L/usr/lib
    LDLIBS=-lm

    all: main

    main: main.o expression.o

    clean:
    rm -f main *.o
    29 changes: 29 additions & 0 deletions Makefile.template
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    # http://stackoverflow.com/questions/2481269/how-to-make-simple-c-makefile
    CC=gcc
    CXX=g++
    RM=rm -f
    CPPFLAGS=-g $(shell root-config --cflags)
    LDFLAGS=-g $(shell root-config --ldflags)
    LDLIBS=$(shell root-config --libs)

    SRCS=tool.cc support.cc
    OBJS=$(subst .cc,.o,$(SRCS))

    all: tool

    tool: $(OBJS)
    g++ $(LDFLAGS) -o tool $(OBJS) $(LDLIBS)

    depend: .depend

    .depend: $(SRCS)
    rm -f ./.depend
    $(CXX) $(CPPFLAGS) -MM $^>>./.depend;

    clean:
    $(RM) $(OBJS)

    dist-clean: clean
    $(RM) *~ .dependtool

    include .depend