2016-07-28 82 views
0

我編譯代碼與此生成的文件編譯文件失敗,`MV:沒有match.`

SHELL = /bin/tcsh 

include ../make.inc 


FC = gfortran 

#-------------------------------------------------------------------- 
# Compiler flags 
#-------------------------------------------------------------------- 

# none 
#FFLAGS = 

# Optimize 
#FFLAGS = -O 

# debug 
#FFLAGS = -g 

# Large memory needed (ifort) 
FFLAGS = -O 


#-------------------------------------------------------------------- 
# Location of files 
#-------------------------------------------------------------------- 

DIR  = ./ 
PLSRC = ./src/ 

PLPROG = ./programs/ 


#-------------------------------------------------------------------- 
# Module flag 
#-------------------------------------------------------------------- 

# Sun Compiler 
#MFLAG = -M 

# Nag Compiler 
#MFLAG = -i 
#MFLAG = -I 

# Absoft Compiler 
#MFLAG = -p 

# Intel or g95 compiler 
MFLAG = -I 

MODULE = $(MFLAG)$(MOD) 

#-------------------------------------------------------------------- 
# Fortran Files 
#-------------------------------------------------------------------- 

PLFILES = gplot.f90 gnuplot.f90 

PLPRFILES = xyplot.f90 

#-------------------------------------------------------------------- 
# Objects Files 
#-------------------------------------------------------------------- 

PLOBJS = $(PLFILES:.f90=.o) 

#-------------------------------------------------------------------- 
# Compile libraries 
#-------------------------------------------------------------------- 

# [email protected] means the target name 
# $? means all dependencies (OBJS) that are new. 
# $< similar to $? but just on dependency rules (%.o : %.f90) 


all : libgplot.a organize pl_progs 

libgplot.a : $(PLOBJS) 
    ar cr [email protected] $(PLOBJS) 
    ranlib [email protected] 
    rm *.o 

%.o : $(PLSRC)%.f90 
    $(FC) $(FFLAGS) -c $< -o [email protected] 

organize : libgplot.a 
    mv *.mod $(MOD) 
    mv *.a $(LIB) 

#-------------------------------------------------------------------- 
# Compile programs 
#-------------------------------------------------------------------- 

pl_progs : xyplot test_plot 

%:  $(PLPROG)%.f90 $(LIB)libgplot.a 
    $(FC) $(FFLAGS) $(MODULE) $< $(LIB)libgplot.a -o $(PROG)[email protected] 
    mv *.mod $(MOD) 

#-------------------------------------------------------------------- 
# Clean 
#-------------------------------------------------------------------- 

clean: 
    rm $(LIB)libgplot.a 

我得到這個

[email protected]:/home/milenko/gprieto/gplot# make 
gfortran -O -c src/gplot.f90 -o gplot.o 
gfortran -O -c src/gnuplot.f90 -o gnuplot.o 
ar cr libgplot.a gplot.o gnuplot.o 
ranlib libgplot.a 
rm *.o 
mv *.mod /usr/local/ 
mv *.a /usr/local/lib/ 
gfortran -O -I/usr/local/ programs/xyplot.f90 /usr/local/lib/libgplot.a -o /usr/local/bin/xyplot 
mv *.mod /usr/local/ 
gfortran -O -I/usr/local/ programs/test_plot.f90 /usr/local/lib/libgplot.a -o /usr/local/bin/test_plot 
mv *.mod /usr/local/ 
mv: No match. 
Makefile:123: recipe for target 'test_plot' failed 
make: *** [test_plot] Error 1 

我不明白,爲什麼在這種情況下,失敗的配方和與xyplot合作。

回答

1

故障發生在

mv *.mod /usr/local/ 
mv: No match. 

沒有*.mod文件mv可以移動,因此觸發一個錯誤。

最可能的原因是test_plot.f90只包含主程序和無模塊。對於這個文件,mv *.mod /usr/local/命令沒有地方。

+0

是的,test_plot.f90只包含主程序。 –