When there are source and object files added or deleted the ar will not be triggered, if U is used in ARFLAGS, unless make clean or touch command is run. If U is not in ARFLAGS, $? is same as $^. Then it will always be a updated archive by adding the rm -f $@ command.
Thanks. ~ARFLAGS = rv ~(%): % ; ~%.a: ~ rm -f $@ ~ $(AR) $(ARFLAGS) $@ $^ ~lib$(target).a: lib$(target).a($(patsubst %$(ext),%.o,$(wildcard *$(ext))))
