1# Input 2# 3# libname tells the name of the lib and 4# libdir tells directory of lib which also is used as input to 5# mk/subdir.mk 6# conf-file [optional] if set, all objects will depend on $(conf-file) 7# 8# Output 9# 10# updated cleanfiles and 11# updated libfiles, libdirs, libnames and libdeps 12 13 14subdirs = $(libdir) 15include mk/subdir.mk 16ifneq ($(sm),core) # User-mode 17ifeq ($(CFG_ULIBS_GPROF),y) 18cflags-lib$(libname)-$(sm) += -pg 19endif 20endif 21include mk/compile.mk 22 23lib-libfile = $(out-dir)/$(base-prefix)$(libdir)/lib$(libname).a 24cleanfiles := $(cleanfiles) $(lib-libfile) 25libfiles := $(lib-libfile) $(libfiles) 26libdirs := $(out-dir)/$(base-prefix)$(libdir) $(libdirs) 27libnames := $(libname) $(libnames) 28libdeps := $(lib-libfile) $(libdeps) 29 30define process-lib 31ifeq ($(lib-use-ld), y) 32$(lib-libfile): $(objs) 33 @echo ' LD $$@' 34 @mkdir -p $$(dir $$@) 35 $$(q)$$(LD$(sm)) $(lib-ldflags) -o $$@ $$^ 36else 37$(lib-libfile): $(objs) 38 @$(cmd-echo-silent) ' AR $$@' 39 @mkdir -p $$(dir $$@) 40 $$(q)rm -f $$@ && $$(AR$(sm)) rcs $$@ $$^ 41endif 42endef #process-lib 43 44$(eval $(call process-lib)) 45 46$(objs): $(conf-file) 47 48# Clean residues from processing 49objs := 50libname := 51lib-use-ld := 52