Makefile不推荐使用的语法

时间:2020-09-05 19:53:32

标签: c makefile fortran

我在编写makefile方面很不好,make向我抛出以下警告:

Makefile:58: *** mixed implicit and normal rules: deprecated syntax

我希望有一对夫妇能帮助我准确地找出我做错了什么?

$(MAPLE_OBJ_DIR) maple_generated_code/%.o : %.f %.h
    $(F77_COMP) %.f 

我有一个目录,其中包含MAPLE_OBJ_DIR = maple_generated_codeF77_COMP = $(F77) -c $(F77FLAGS)

中一堆生成的fortran文件和标头

Makefile的完整相关部分是:

EXECUTABLES     = sphere_comp 
# Miscellaneous files to clean up
MISCDATAFILES   =


MAPLE_OBJ_DIR = maple_generated_code
BIN_DIR = ../bin

MAPLE_OBJS = $(addprefix $(MAPLE_OBJ_DIR)/, \
eval_chi.o eval_kappa.o \
evo_pi_test.o evo_psi_test.o \
mg_lop_ham_cstr.o mg_res_ham_cstr.o mg_relax_kappa.o  mg_res_kappa.o \
mg_lop_1d_cstr.o mg_res_1d_cstr.o mg_relax_1d.o  mg_res_1d.o \
mg_lop_sphere_cstr.o mg_res_sphere_cstr.o mg_relax_sphere.o  mg_res_sphere.o )

OBJS = sphere_comp.o utils.o \

all: $(EXECUTABLES)

$(MAPLE_OBJ_DIR) maple_generated_code/%.o : %.f %.h
    $(F77_COMP) %.f 

.c.o:
    $(CC_COMP) -c $*.c

all: $(EXECUTABLES)

sphere_comp: $(MAPLE_OBJS) $(OBJS)
    $(CC_LOAD) $(MAPLE_OBJS) $(OBJS) $(LIBS) -o sphere_comp
    /bin/mv $(EXECUTABLES) $(BIN_DIR)
    /bin/cp *param $(BIN_DIR)

1 个答案:

答案 0 :(得分:0)

嗯,我很傻。写这篇文章使我明白自己在做什么。我在相关行中有两个目标。应该是:

maple_generated_code/%.o : %.f %.h
    $(F77_COMP) %.f 
相关问题