Makefile (1216B)
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=integ 38 #BINB=optimB 39 40 # The default "all" depends on A and B 41 42 #all: A B 43 44 45 A: $(BIN) 46 @# Run program and write amoeba positions to file 47 ./$(BIN) 48 49 #B: $(BINB) 50 # ./$(BINB) 2> amoebaB.dat 51 52 $(BIN): $(OBJ) 53 @# Link object files together 54 $(LD) $(LDFLAGS) $(OBJ) -o $(BIN) $(LDLIBS) 55 56 $(BINB): $(OBJB) 57 @# Link object files together 58 $(LD) $(LDFLAGS) $(OBJB) -o $(BINB) $(LDLIBS) 59 60 clean: 61 @# Remove object files 62 rm -f $(OBJ) $(OBJB) 63 @# Remove binaries 64 rm -f $(BIN) $(BINB) 65 @# Remove datafiles and plot 66 #rm -f *.dat *.png 67 @# Remove error logs 68 @#rm -f amoeba.dat amoebaB.dat 69 edit: 70 vim -p Makefile *.cpp *.h 71