GNU Make would not update object files

  Kiến thức lập trình

When i build my project with makefile using this rule:

    $(FC) $(FFLAGS) -c $(patsubst $(OBJDIR)%.o,$(SRCDIR)%.f90,$@) -o $@

when i change my object files, they don’t recompile with make

But when i changed the rule to this:

$(F90OBJS): $(OBJDIR)%.o: $(SRCDIR)%.f90
    $(FC) $(FFLAGS) -c $< -o $@

it suddenly works fine. Why?
It seems to me that the only change is syntax related

New contributor

Gleb I_Eagle_I Zhukov is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.