Skip to content

Instantly share code, notes, and snippets.

@hustlijian
Created August 27, 2014 13:46
Show Gist options
  • Save hustlijian/7f4de6c7430d2bc2c208 to your computer and use it in GitHub Desktop.
Save hustlijian/7f4de6c7430d2bc2c208 to your computer and use it in GitHub Desktop.
simple c++ makefile
CXXFLAGS=-Wall -g
CC=g++
LDFLAGS=-L/usr/lib
LDLIBS=-lm
all: main
main: main.o expression.o
clean:
rm -f main *.o
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment