On Tue, 13 Sep 2016, Matthew Knepley wrote: > On Tue, Sep 13, 2016 at 12:16 PM, Timothée Nicolas < > [email protected]> wrote: > > > Hi all, > > > > I can't seem to figure out how to specify my compilation options with > > PETSc. For my makefiles, I've always been using Petsc examples inspired > > makefiles, just tuning them to my needs, and I have never played with > > compilation options so far. Now, I am trying to add some compilation > > options, but they are not taken into account by the compiler. My makefile > > looks like this > > > > all: energy > > > > > > include ${PETSC_DIR}/lib/petsc/conf/variables > > > > include ${PETSC_DIR}/lib/petsc/conf/rules > > > > > > #FLAGS = -g -O0 -fbounds-check > > > > > > > > > > MYFLAGS = -mcmodel=medium -shared-intel > > > > > > OBJS = main.o \ > > > > modules.o \ > > > > diags.o \ > > > > functions.o \ > > > > conservation.o \ > > > > > > EXEC = energy > > > > > > main.o: modules.o \ > > > > functions.o \ > > > > conservation.o \ > > > > diags.o \ > > > > > > energy: $(OBJS) chkopts > > > > -$(FLINKER) -o $(EXEC) $(MYFLAGS) $(FLAGS) $(OBJS) $( > > PETSC_SNES_LIB) > > > > > > clean_all: > > > > $(RM) $(OBJS) $(EXEC) > > > > > > The compiler then executes things like > > > > /opt/mpi/bullxmpi/1.2.8.4/bin/mpif90 -c -fPIC -g -O3 > > -I/ccc/scratch/cont003/gen0198/lutjensh/Timothee/petsc-3.7.3/include > > -I/ccc/scratch/cont003/gen0198/lutjensh/Timothee/ > > petsc-3.7.3/arch-linux2-c-debug/include -I/opt/mpi/bullxmpi/1.2.8.4/ > > include -o modules.o modules.F90 > > > > > > without taking my variable MYFLAGS into account. What may be the reason? > > Also, what does "chkopts" mean ? > > > > 1) You want to change CFLAGS or FFLAGS > > 2) 'chkopts' is an internal check for PETSc > > 3) You realize that it is very dangerous to compile with options not > configure with.
And generally - you have to declare FFLAGS - before the 'include' statement You can set: FPPFLAGS - for preprocessing [or compile only flags] FFLAGS - for compile & link flags For link only flags - you can add them to the link command - as you've done with MYFLAGS.. Satish
