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 16include mk/compile.mk 17 18lib-libfile = $(out-dir)/$(base-prefix)$(libdir)/lib$(libname).a 19cleanfiles := $(cleanfiles) $(lib-libfile) 20libfiles := $(lib-libfile) $(libfiles) 21libdirs := $(out-dir)/$(base-prefix)$(libdir) $(libdirs) 22libnames := $(libname) $(libnames) 23libdeps := $(lib-libfile) $(libdeps) 24 25define process-lib 26ifeq ($(lib-use-ld), y) 27$(lib-libfile): $(objs) 28 @echo ' LD $$@' 29 @mkdir -p $$(dir $$@) 30 $$(q)$$(LD$(sm)) $(lib-ldflags) -o $$@ $$^ 31else 32$(lib-libfile): $(objs) 33 @$(cmd-echo-silent) ' AR $$@' 34 @mkdir -p $$(dir $$@) 35 $$(q)$$(AR$(sm)) rcs $$@ $$^ 36endif 37endef #process-lib 38 39$(eval $(call process-lib)) 40 41$(objs): $(conf-file) 42 43# Clean residues from processing 44objs := 45libname := 46lib-use-ld := 47