blob: 389fd41fd41243ed325066624b2f676c99d08b1a [file] [log] [blame]
Pascal Brandb0104772014-06-12 15:56:20 +02001# 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
Jerome Forissierfe52b1f2014-11-06 17:54:51 +01006# conf-file [optional] if set, all objects will depend on $(conf-file)
Pascal Brandb0104772014-06-12 15:56:20 +02007#
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
Jerome Forissier4334e8d2014-09-08 10:53:42 +020018lib-libfile = $(out-dir)/$(base-prefix)$(libdir)/lib$(libname).a
Pascal Brandb0104772014-06-12 15:56:20 +020019cleanfiles := $(cleanfiles) $(lib-libfile)
20libfiles := $(lib-libfile) $(libfiles)
Jerome Forissier4334e8d2014-09-08 10:53:42 +020021libdirs := $(out-dir)/$(base-prefix)$(libdir) $(libdirs)
Pascal Brandb0104772014-06-12 15:56:20 +020022libnames := $(libname) $(libnames)
23libdeps := $(lib-libfile) $(libdeps)
24
Jerome Forissier699f50a2014-10-28 17:22:45 +010025define process-lib
26ifeq ($(lib-use-ld), y)
Pascal Brandb0104772014-06-12 15:56:20 +020027$(lib-libfile): $(objs)
Jerome Forissier699f50a2014-10-28 17:22:45 +010028 @echo ' LD $$@'
29 @mkdir -p $$(dir $$@)
30 $$(q)$$(LD) $(lib-ldflags) -o $$@ $$^
31else
32$(lib-libfile): $(objs)
33 @echo ' AR $$@'
34 @mkdir -p $$(dir $$@)
35 $$(q)$$(AR) rcs $$@ $$^
36endif
37endef #process-lib
38
39$(eval $(call process-lib))
Pascal Brandb0104772014-06-12 15:56:20 +020040
Jerome Forissierfe52b1f2014-11-06 17:54:51 +010041$(objs): $(conf-file)
42
Pascal Brandb0104772014-06-12 15:56:20 +020043# Clean residues from processing
44objs :=
Jerome Forissier73dc7282014-09-25 16:04:03 +020045libname :=
Jerome Forissier699f50a2014-10-28 17:22:45 +010046lib-use-ld :=