Hi Paul,

I first learnt the knwoledge of ar D and U options from you in this mailing list
years ago.


In my test, if I need to add and remove source files and their object files, I
need to rm the archive first, and rebuild the archive with latest object files.
If I use U option, the ar recipe will not get executed as it is not out-dated.
Unless I run make clean or touch command manually. With D option, the archive
always gets rebuilt with latest object files, though it re-builds there is no
new changes in the source files.


I use the following snippet in my test now.


Thanks


~ARFLAGS  = rsD
~(%): % ;
~%.a:
~ rm -f $@
~ $(AR) $(ARFLAGS) $@ $^
~lib$(target).a: lib$(target).a($(patsubst %$(ext),%.o,$(wildcard *$(ext))))
~.SECONDARY: $(patsubst %$(ext),%.o,$(wildcard *$(ext)))

Reply via email to