CHANNELDIR = .. # Enable petsc rules, if petsc is set up and an arch is specified ifdef PETSC_ARCH #PETSC_DIR=$(HOME)/petsc include ${PETSC_DIR}/bmake/common/base endif # General-purpose utilities EXECS = addfields.x ascii2field.x changegrid.x couette.x field2ascii.x \ fielddist.x fieldplots.x fieldprops.x L2IP.x linearcombo.x makebasis.x \ movieframes.x perturbfield.x projectfields.x projectseries.x randomfield.x \ symmetrize.x symmetryop.x # Special-purpose utilities OTHEREXECS = eigentable.x makeheatmode.x makestokesmode.x minimizegrid.x \ multibox.x poincare.x seriesdist.x seriesprops.x seriessymmetry.x \ symmphase.x symmseries.x transbasis.x verifyeigs.x multibox.x # Additional programs to be compiled if Octave is present OCT_EXECS = arnoldi.x findorbit.x # podbasis.x PETSC_EXECS = petsc-newton.x BUGGY_EXECS = dealias.x profplot.x newtonloop.x newtonREQB.x newtonRPO.x # Define default C flags for optimized and debugging compilation # Possible additional flags: -mtune=pentium4, -mtune-=athlon64 CFLAGS = -Wall -O2 -fomit-frame-pointer -DNDEBUG DCFLAGS = -Wall -g -DDEBUG PCFLAGS = -Wall -pg -O2 -DNDEBUG ############################################################################### # You shouldn't need to modify anything below this line # Determine if Octave is present by using Octave's octave-config shell script. # Octave is a free Matlab clone whose library provides a C++ interface to LAPACK. USE_OCTAVE = $(shell octave-config -v) ifneq ($(strip $(USE_OCTAVE)),) OCTAVEVERSION = $(shell octave-config -v) OCTAVEINC = -I$(shell octave-config -p OCTINCLUDEDIR) OCTAVELIB = -Wl,-rpath $(shell octave-config -p OCTLIBDIR) -L$(shell octave-config -p OCTLIBDIR) -loctave -lcruft OCTAVEFLAGS = -DHAVE_OCTAVE ALLEXECS = $(EXECS) $(OCT_EXECS) # Special case for borked octave version (used by the "stable" RHEL 4) ifeq ($(strip $(OCTAVEVERSION)), 2.1.57) OCTAVEINC = -I$(shell octave-config -p OCTINCLUDEDIR) -I$(shell octave-config -p OCTINCLUDEDIR)/octave endif else OCTAVEVERSION = OCTAVEINC = OCTAVELIB = OCTAVEFLAGS = ALLEXECS = $(EXECS) endif # Define header and library options for gcc. INCLUDEDIRS = -I$(CHANNELDIR) $(OCTAVEINC) LIBS = $(CHANNELDIR)/lib/libchflow.a $(OCTAVELIB) -lfftw3 -lm DLIBS = -L$(CHANNELDIR)/lib -lchflow-debug $(OCTAVELIB) -lfftw3 -lm PLIBS = -L$(CHANNELDIR)/lib -lchflow-profile $(OCTAVELIB) -lfftw3 -lm # Make optimized objects from source %.o : %.cpp g++ $(CFLAGS) $(OCTAVEFLAGS) $(INCLUDEDIRS) -c $< # Make debugging objects from source %.do : %.cpp g++ $(DCFLAGS) $(OCTAVEFLAGS) $(INCLUDEDIRS) -o $@ -c $< # Make profiling objects from source %.po : %.cpp g++ $(PCFLAGS) $(OCTAVEFLAGS) $(INCLUDEDIRS) -o $@ -c $< petsc-newton.o : petsc-newton.cpp petsc-newton.h g++ -c $(CFLAGS) ${PETSC_INCLUDE} -I.. petsc-newton.cpp petsc-newton.do : petsc-newton.cpp petsc-newton.h g++ -c $(DCFLAGS) ${PETSC_INCLUDE} -I.. petsc-newton.cpp # Build petsc execs %.pcx : %.cpp utilities.o petsc-newton.o g++ $(CFLAGS) ${PETSC_INCLUDE} -I.. $< utilities.o petsc-newton.o ${PETSC_SNES_LIB} $(LIBS) ${PACKAGE_LIBS} -lchflow -o $@ %.pcdx : %.cpp utilities.o petsc-newton.do g++ $(DCFLAGS) ${PETSC_INCLUDE} -I.. $< utilities.o petsc-newton.o $(DLIBS) ${PETSC_SNES_LIB} ${PACKAGE_LIBS} -o $@ # Make optimized executables from objects and libraries %.x: %.o utilities.o $(CHANNELDIR)/lib/libchflow.a g++ $(CFLAGS) $(OCTAVEFLAGS) -o $@ $< $(OBJECTS) utilities.o $(LIBS) # SHARED LIB VERSION, doesn't work on openSUSE-11.0 # Make optimized executables from objects and libraries %.x: %.o utilities.o $(CHANNELDIR)/channelflow/.libs/libchflow.a g++ $(CFLAGS) $(OCTAVEFLAGS) -o $@ $< $(OBJECTS) utilities.o $(LIBS) # Make debugging executables from objects and libraries %.dx: %.do utilities.do $(CHANNELDIR)/lib/libchflow-debug.a g++ $(DCFLAGS) $(OCTAVEFLAGS) -g -o $@ $< $(OBJECTS) utilities.do $(DLIBS) # Make profiling executables from objects and libraries %.px: %.po utilities.po $(CHANNELDIR)/lib/libchflow-profile.a g++ $(PCFLAGS) $(OCTAVEFLAGS) -pg -o $@ $< $(OBJECTS) utilities.po $(PLIBS) all: utilities.o $(ALLEXECS) everything: utilities.o $(ALLEXECS) $(OTHEREXECS) install: utilities.o $(ALLEXECS) mkdir -p ../bin cp $(ALLEXECS) ../bin clean : rm -f *.o *.x *.do *.dx *.asc *.bf *.ff