make error:main.o:找不到命令Makefile:目标'all'的配方失败

时间:2017-09-30 15:02:32

标签: makefile fortran petsc

# Makefile for Defmod

FFLAGS =
FPPFLAGS =
LDLIBS =

-include ${PETSC_DIR}/conf/variables
-include ${PETSC_DIR}/conf/rules
-include ${PETSC_DIR}/lib/petsc/conf/variables
-include ${PETSC_DIR}/lib/petsc/conf/rules

OBJS = main.o m_global.o m_local.o m_elems.o m_utils.o

m_utils.o : m_utils.F90
m_elems.o : m_elems.F90 m_utils.o
m_local.o : m_local.F90 m_elems.o
m_global.o: m_global.F90 m_local.o
main.o    : main.F90 m_global.o

all: ${OBJS}
    -${FLINKER} ${OBJS} -o ../defmod ${PETSC_LIB} ${LDLIBS}

当我输入make all时,它弹出:

make[1]: Entering directory '/mnt/c/Users/gxyan/defmod-dev/src'
    main.o m_global.o m_local.o m_elems.o m_utils.o -o ../defmod
    make[1]: main.o: Command not found
    Makefile:21: recipe for target 'all' failed
    make[1]: [all] Error 127 (ignored)
    make[1]: Leaving directory '/mnt/c/Users/gxyan/defmod-dev/src'

并设置了PETSC的所有环境变量。 PETSC的配置使用以下命令完成:

 ./configure --with-cc=gcc --with-fc=gfortran --download-mpich --download-fblaslapack --download-cmake --download-metis --with-debugging=0

那么,出了什么问题?

2 个答案:

答案 0 :(得分:0)

make变量FLINKER未定义,或已定义但具有空字符串值

答案 1 :(得分:0)

您需要先设置PETSC_DIR变量。例如,在BASH中:

export PETSC_DIR=/home/user/petsc

接着是

make all

或者,您可以这样做:

make all PETSC_DIR=/home/user/petsc