tMakefile - numeric - C++ library with numerical algorithms
 (HTM) git clone git://src.adamsgaard.dk/numeric
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
       tMakefile (3031B)
       ---
            1 # Define compiler
            2 #CXX=g++
            3 
            4 # Define compiler flags (show all warnings)
            5 CXXFLAGS=-Wall
            6 #CXXFLAGS=-std=c++0x
            7 
            8 # Define linker flags
            9 #LDFLAGS=-fopenmp
           10 
           11 # Compile optimized code
           12 CXXFLAGS+=-O2
           13 
           14 # Compile debuggable code
           15 #CXXFLAGS+=-g
           16 
           17 # Compile profilable code
           18 #CXXFLAGS+=-pg
           19 #LDFLAGS+=-pg
           20 
           21 # Define linker
           22 LD=g++
           23 
           24 # All source code files
           25 SRC=$(shell ls *.cpp)
           26 
           27 
           28 # Filenames of source code
           29 SHARED_SRC=ode.cpp check.cpp
           30 SHARED_HEADERS=typedefs.h ode.h functions.h check.h
           31 SRC_A=mainA.cpp $(SHARED_SRC)
           32 HEAD_A=$(SHARED_HEADERS)
           33 SRC_B=mainB.cpp $(SHARED_SRC)
           34 HEAD_B=$(SHARED_HEADERS)
           35 SRC_C=mainC.cpp $(SHARED_SRC)
           36 HEAD_C=$(SHARED_HEADERS)
           37 SRC_D=mainD.cpp $(SHARED_SRC)
           38 HEAD_D=$(SHARED_HEADERS)
           39 
           40 # Filenames of object files
           41 OBJ_A=$(SRC_A:.cpp=.o)
           42 OBJ_B=$(SRC_B:.cpp=.o)
           43 OBJ_C=$(SRC_C:.cpp=.o)
           44 OBJ_D=$(SRC_D:.cpp=.o)
           45 
           46 # Remove file type extension for binary filename
           47 BIN_A=odeA
           48 BIN_B=odeB
           49 BIN_C=odeC
           50 BIN_D=odeD
           51 
           52 # Define editor and options for `make edit`
           53 EDITOR=vim -p
           54 
           55 
           56 # The default "all" depends on A and B
           57 all: A B C D
           58 
           59 A:        plotA.png
           60 
           61 B:        plotB.png
           62 
           63 C:        plotC.png
           64 
           65 D:        plotD.png
           66 
           67 plotA.png: funcA.dat plotA.gp
           68         # Gnuplot: plotA.png
           69         @gnuplot plotA.gp
           70 
           71 plotB.png: funcB.dat plotB.gp
           72         # Gnuplot: plotB.png
           73         @gnuplot plotB.gp
           74 
           75 plotC.png: funcC.dat plotC.gp
           76         # Gnuplot: plotC.png
           77         @gnuplot plotC.gp
           78 
           79 plotD.png: funcD.dat plotD.gp
           80         # Gnuplot: plotD.png
           81         @gnuplot plotD.gp
           82 
           83 funcA.dat: $(BIN_A)
           84         @./$(BIN_A)
           85         
           86 funcB.dat: $(BIN_B)
           87         @./$(BIN_B)
           88 
           89 funcC.dat: $(BIN_C)
           90         @./$(BIN_C)
           91         
           92 funcD.dat: $(BIN_D)
           93         @./$(BIN_D)
           94         
           95 $(BIN_A): $(OBJ_A) $(HEAD_A)
           96         @# Link object files together
           97         $(LD) $(LDFLAGS) $(OBJ_A) -o $@ $(LDLIBS)
           98         
           99 $(BIN_B): $(OBJ_B) $(HEAD_B)
          100         @# Link object files together
          101         $(LD) $(LDFLAGS) $(OBJ_B) -o $@ $(LDLIBS)
          102 
          103 $(BIN_C): $(OBJ_C) $(HEAD_C)
          104         @# Link object files together
          105         $(LD) $(LDFLAGS) $(OBJ_C) -o $@ $(LDLIBS)
          106 
          107 $(BIN_D): $(OBJ_D) $(HEAD_D)
          108         @# Link object files together
          109         $(LD) $(LDFLAGS) $(OBJ_D) -o $@ $(LDLIBS)
          110 
          111 clean:        cleanA cleanB cleanC cleanD
          112 
          113 cleanA: 
          114         @# Remove object files
          115         rm -f $(OBJ_A) 
          116         @# Remove binaries
          117         rm -f $(BIN_A)
          118         @# Remove datafiles and plot
          119         rm -f funcA.dat plotA.png
          120 
          121 cleanB: 
          122         @# Remove object files
          123         rm -f $(OBJ_B) 
          124         @# Remove binaries
          125         rm -f $(BIN_B)
          126         @# Remove datafiles and plot
          127         rm -f funcB.dat plotB.png
          128 
          129 cleanC: 
          130         @# Remove object files
          131         rm -f $(OBJ_C) 
          132         @# Remove binaries
          133         rm -f $(BIN_C)
          134         @# Remove datafiles and plot
          135         rm -f funcC.dat plotC.png
          136 
          137 cleanD: 
          138         @# Remove object files
          139         rm -f $(OBJ_D) 
          140         @# Remove binaries
          141         rm -f $(BIN_D)
          142         # Removing datafile and plot
          143         @rm -f funcD.dat plotD.png
          144 
          145 htmlfiles: html/mainA.cpp.html html/mainB.cpp.html html/mainC.cpp.html html/mainD.cpp.html html/ode.cpp.html html/check.cpp.html html/check.h.html html/functions.h.html html/ode.h.html html/typedefs.h.html html/vector_arithmetic.h.html html/plotA.gp.html html/plotB.gp.html html/plotC.gp.html html/plotD.gp.html html/Makefile.html
          146         # Generating HTML files
          147         rst2html2 README.rst > html/README.html
          148 
          149 html/%.html: %
          150         vim $< +TOhtml +"w $@" +"qall!"
          151 
          152 
          153 edit:
          154         @$(EDITOR) Makefile README.rst *.cpp *.h *.gp
          155