[petsc-users] makefile for compiling multiple sources
    Matthew Overholt 
    overholt at capesim.com
       
    Fri Mar 18 09:49:02 CDT 2016
    
    
  
Hi,
 
I'm just getting started with PETSc and have been able to configure and run
the examples, but as I'm starting to put together a more substantial code
with multiple source files I haven't been able to find or create a makefile
which works and follows PETSc guidelines.
 
I've configured and am building with the Intel compilers and MKL for blas &
lapack, as per the installation example, and with the C++ language.
 
Here's my makefile --------------------------------------
# 
# makefile for femex1 - PETSc/kde/ex1.c adapted for FEA
#
# Usage: make all
#        make clean
#
# PETSc was configured using the Intel Compilers, MKL, and C++
#
CFLAGS        = 
CPPFLAGS     = 
CLFLAGS      = 
LIBFILES      = ${PETSC_KSP_LIB}
TARGET        = femex1
CLEANFILES   = $(TARGET)
 
include ${PETSC_DIR}/lib/petsc/conf/variables
include ${PETSC_DIR}/lib/petsc/conf/rules
 
OBJFILES = femex1.o \
           shapes.o
 
all: $(TARGET)
 
$(TARGET) : $(OBJFILES) $(LIBFILES)
       ${CLINKER} -o $(TARGET) $(OBJFILES) $(LIBFILES)
 
# femex1.cpp has 'main' and PETSc calls
femex1.o: femex1.cpp lists.h shapes.h  chkopts
       ${PETSC_CXXCOMPILE} femex1.cpp
 
# shapes.cpp does not have any PETSc calls
shapes.o: shapes.cpp shapes.h
       icpc -c shapes.cpp
 
And here's the result ------------------------------------
 
[Matt at HPCL1 mycode]$ make all
/opt/petsc/petsc-3.6.3/linux-gnu-intel/bin/mpicxx -c -wd1572 -g  -fPIC
-I/opt/petsc/petsc-3.6.3/include
-I/opt/petsc/petsc-3.6.3/linux-gnu-intel/include      femex1.cpp
icpc -c shapes.cpp
make: *** No rule to make target
`-Wl,-rpath,/opt/petsc/petsc-3.6.3/linux-gnu-intel/lib', needed by `femex1'.
Stop.
 
---------------------------------------------------------------
So it compiles the two sources, but then fails on the linking step.
 
Thanks in advance.
Matt Overholt
CapeSym, Inc.
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160318/ec0a6f2b/attachment.html>
    
    
More information about the petsc-users
mailing list