$ ar
Usage: ar [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...
ar -M [<mri-script]
commands:
d - delete file(s) from the archive
m[ab] - move file(s) in the archive
p - print file(s) found in the archive
q[f] - quick append file(s) to the archive
r[ab][f][u] - replace existing or insert new file(s) into the archive
t - display contents of archive
x[o] - extract file(s) from the archive
command specific modifiers:
[a] - put file(s) after [member-name]
[b] - put file(s) before [member-name] (same as [i])
[N] - use instance [count] of name
[f] - truncate inserted file names
[P] - use full path names when matching
[o] - preserve original dates
[u] - only replace files that are newer than current archive contents
generic modifiers:
[c] - do not warn if the library had to be created
[s] - create an archive index (cf. ranlib)
[S] - do not build a symbol table
[v] - be verbose
[V] - display the version number
emulation options:
No emulation specific options
ar: supported targets: pe-i386 pei-i386 elf32-i386 elf32-little elf32-big srec symbolsrec tekhex binary ihex
e.g:
# partially link file (for dynamic download & linking)
# and add it to library for static linking
$(COMP_OBJ): $(TMP_COMP_OBJS)
@$(ECHO) Linking $@
$(MDBG)$(LD) -r -o $@ $(TMP_COMP_OBJS)
ifeq ($(SINGLE_FILES_TO_LIB),yes)
@$(ECHO) Adding $(TMP_COMP_OBJS) to library $(OUTPUT_LIB1)
$(MDBG)$(MYAR) -dc $(LIBOUTPUT_DIR)/$(OUTPUT_LIB1) $(TMP_COMP_OBJS)
$(MDBG)$(MYAR) -qc $(LIBOUTPUT_DIR)/$(OUTPUT_LIB1) $(TMP_COMP_OBJS)
else
@$(ECHO) Adding $@ to library $(OUTPUT_LIB1)
$(MDBG)$(MYAR) -dc $(LIBOUTPUT_DIR)/$(OUTPUT_LIB1) $(notdir $@)
$(MDBG)$(MYAR) -qc $(LIBOUTPUT_DIR)/$(OUTPUT_LIB1) $@
endif
ifeq ($(OUTPUT_OWN_LIB),yes)
@$(ECHO) Adding $(TMP_COMP_OBJS) to own library $(COMP_NAME).a
$(MDBG)$(RM) $(LIBOUTPUT_DIR)/$(COMP_NAME).a
$(MDBG)$(MYAR) -rc $(LIBOUTPUT_DIR)/$(COMP_NAME).a $(TMP_COMP_OBJS)
endif