#!/bin/csh # # $Id: Makefile,v 1.3 2017/09/23 00:53:23 jlang Exp $ # # $Log: Makefile,v $ # Revision 1.3 2017/09/23 00:53:23 jlang # Introduced references and const again for this version # # Revision 1.2 2011/10/16 02:51:42 jlang # Added files for lecture 06 # # Revision 1.1 2011/09/27 17:22:20 jlang # Added bounding shape example # # Revision 1.6 2010/09/29 14:28:59 jlang # Separate files for line_segment and point2d. Added test_point and make label test # # Revision 1.5 2008/09/15 18:45:14 jlang # Fixed makefile to create exe # # Revision 1.4 2008/09/15 18:24:13 jlang # Replaced makedepend by gcc # # Revision 1.3 2008/09/15 18:20:18 jlang # *** empty log message *** # # Revision 1.2 2008/09/15 18:19:36 jlang # Added makefile # CXX = g++ ifndef OSTYPE OSTYPE=cygnus # OSTYPE=linux-gnu endif ifeq ($(OSTYPE),linux-gnu) INCDIR = LDLIBDIR = # -L/usr/X11R6/lib LDLIBS = # -lglut -lGLU -lGL -lm # -lglui else LDLIBS = # -lglut32 -lglu32 -lopengl32 -lm # -lglui endif .PHONY: all clean CXXFLAGS += -std=c++11 SRC = fitting.cpp aa_box.cpp point2d.cpp SRC_TEST = test_point.cpp point2d.cpp SRC_TRIANGLE = aa_box.cpp point2d.cpp triangle.cpp SRC_VECTOR = point2d.cpp vector2d.cpp # Default build : all: dependencies fitting test_prog: test_dependencies test triangle_prog: triangle_dependencies tri vector_prog: vector_dependencies vec dependencies: $(SRC:%.cpp=%.d) $(SRC:%.c=%.d) test_dependencies: $(SRC_TEST:%.cpp=%.d) $(SRC_TEST:%.c=%.d) triangle_dependencies: $(SRC_TRIANGLE:%.cpp=%.d) $(SRC_TRIANGLE:%.c=%.d) vector_dependencies: $(SRC_VECTOR:%.cpp=%.d) $(SRC_VECTOR:%.c=%.d) # sed line based on John Graham-Cumming, Dependency Management, # Dr.Dobb's Portal, Apr 01, 2006. %.d:%.cpp $(CXX) $(CXXFLAGS) $(INCDIR) -MG -MM $< | sed 's,\($*\.o\)[ :]*\(.*\), $@ : $$\(wildcard \2\)\n\1 : \2,g' > $@ -include $(SRC:.cpp=.d) -include $(SRC_TEST:.cpp=.d) -include $(SRC_TRIANGLE:.cpp=.d) -include $(SRC_VECTOR:.cpp=.d) fitting: $(SRC:%.cpp=%.o) $(CXX) $(LDLIBDIR) -o $@ $^ $(LDLIBS) test: $(SRC_TEST:%.cpp=%.o) $(CXX) $(LDLIBDIR) -o $@ $^ $(LDLIBS) tri: $(SRC_TRIANGLE:%.cpp=%.o) $(CXX) $(LDLIBDIR) -o $@ $^ $(LDLIBS) vec: $(SRC_VECTOR:%.cpp=%.o) $(CXX) $(LDLIBDIR) -o $@ $^ $(LDLIBS) %.o:%.c $(CC) $(INCDIR) -c $*.c -o $@ %.o:%.cpp $(CXX) $(CXXFLAGS) $(INCDIR) -c $*.cpp -o $@ clean: rm -f *~ *.o *.d