tMakefile - numeric - C++ library with numerical algorithms
 (HTM) git clone git://src.adamsgaard.dk/numeric
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
       tMakefile (1611B)
       ---
            1 # Define compiler
            2 CC=g++
            3 
            4 # Define compiler flags (show all warnings)
            5 CPPFLAGS=-Wall
            6 #CPPFLAGS=-std=c++0x
            7 
            8 # Define linker flags
            9 LDFLAGS=
           10 
           11 # Define extra libraries to be dynamically linked
           12 #LDLIBS+=-larmadillo 
           13 #LDLIBS+=-lstdc++
           14 
           15 # Compile optimized code
           16 #CPPFLAGS+=-O2
           17 
           18 # Compile debuggable code
           19 #CPPFLAGS+=-g
           20 
           21 # Compile profilable code
           22 #CPPFLAGS+=-pg
           23 #LDFLAGS+=-pg
           24 
           25 # Define linker
           26 LD=g++
           27 
           28 # Filenames of source code
           29 SRC=$(shell ls *.cpp)
           30 
           31 # Filenames of object files
           32 OBJ=$(SRC:.cpp=.o)
           33 #OBJ=downhill_simplex.o main.o
           34 #OBJB=downhill_simplex.o main.B.o
           35 
           36 # Remove file type extension for binary filename
           37 BIN=mc
           38 #BINB=optimB
           39 
           40 # The default "all" depends on A and B
           41 
           42 #all: A B
           43 
           44 A: performance.png error.png
           45 
           46 %.png: performance.dat
           47         gnuplot plot.gp
           48 
           49 
           50 
           51 performance.dat: $(BIN)
           52         # Removing old performance data
           53         rm -f performance.dat
           54         # Running program and profiling runtime and error
           55         nice ./$(BIN) 10000 > /dev/null
           56         nice ./$(BIN) 20000 > /dev/null
           57         nice ./$(BIN) 50000 > /dev/null
           58         nice ./$(BIN) 100000 > /dev/null
           59         nice ./$(BIN) 200000 > /dev/null
           60         nice ./$(BIN) 500000 > /dev/null
           61         nice ./$(BIN) 1000000 > /dev/null
           62         nice ./$(BIN) 2000000 > /dev/null
           63         nice ./$(BIN) 5000000 > /dev/null
           64 
           65 
           66 #B:        $(BINB)
           67 #        ./$(BINB) 2> amoebaB.dat
           68 
           69 test:        $(BIN)
           70         ./$(BIN)
           71         
           72 $(BIN):        $(OBJ)
           73         @# Link object files together
           74         $(LD) $(LDFLAGS) $(OBJ) -o $(BIN) $(LDLIBS)
           75         
           76 $(BINB): $(OBJB)
           77         @# Link object files together
           78         $(LD) $(LDFLAGS) $(OBJB) -o $(BINB) $(LDLIBS)
           79 
           80 clean: 
           81         @# Remove object files
           82         rm -f $(OBJ) 
           83         @# Remove binaries
           84         rm -f $(BIN)
           85         @# Remove datafiles and plot
           86         rm -f *.dat *.png
           87 edit:
           88         vim -p Makefile *.cpp *.h *.gp
           89