1 SRC_DIR := $(SRC_PATH_BARE)/lib$(NAME)
3 include $(SUBDIR)../common.mak
5 LIBVERSION := $(lib$(NAME)_VERSION)
6 LIBMAJOR := $(lib$(NAME)_VERSION_MAJOR)
9 all: $(SUBDIR)$(LIBNAME)
11 install-libs: install-lib$(NAME)-static
13 $(SUBDIR)$(LIBNAME): $(OBJS)
15 $(AR) rc $@ $^ $(EXTRAOBJS)
19 install-headers: install-lib$(NAME)-headers install-lib$(NAME)-pkgconfig
21 INCINSTDIR := $(INCDIR)/lib$(NAME)
23 THIS_LIB := $(SUBDIR)$($(CONFIG_SHARED:yes=S)LIBNAME)
26 $(SUBDIR)%$(EXESUF): $(SUBDIR)%.o
27 $$(LD) $(FFLDFLAGS) -o $$@ $$^ -l$(FULLNAME) $(FFEXTRALIBS) $$(ELIBS)
29 $(SUBDIR)%-test.o: $(SUBDIR)%.c
30 $$(CC) $(CPPFLAGS) $(CFLAGS) -DTEST -c $$(CC_O) $$^
32 $(SUBDIR)%-test.o: $(SUBDIR)%-test.c
33 $$(CC) $(CPPFLAGS) $(CFLAGS) -DTEST -c $$(CC_O) $$^
35 $(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
36 $$(YASMDEP) $(YASMFLAGS) -I $$(<D)/ -M -o $$@ $$< > $$(@:.o=.d)
37 $$(YASM) $(YASMFLAGS) -I $$(<D)/ -o $$@ $$<
40 $(RM) $(addprefix $(SUBDIR),*-example$(EXESUF) *-test$(EXESUF) $(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
41 $(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS)))) \
42 $(HOSTOBJS) $(HOSTPROGS)
45 $(RM) $(addprefix $(SUBDIR),$(DISTCLEANSUFFIXES)) \
46 $(addprefix $(SUBDIR), $(foreach suffix,$(DISTCLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
49 all: $(SUBDIR)$(SLIBNAME)
51 install-libs: install-lib$(NAME)-shared
53 $(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
54 $(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
56 $(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SUBDIR)lib$(NAME).ver
57 $(SLIB_CREATE_DEF_CMD)
58 $$(LD) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$(filter %.o,$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
62 $(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(DEP_LIBS)
66 install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
67 $(Q)mkdir -p "$(SHLIBDIR)"
68 $$(INSTALL) -m 755 $$< "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
69 $$(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
70 $(Q)cd "$(SHLIBDIR)" && \
71 $(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
72 $(Q)cd "$(SHLIBDIR)" && \
73 $(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
74 $(SLIB_INSTALL_EXTRA_CMD)
76 install-lib$(NAME)-static: MSG = $(LIBDIR)/$(LIBNAME)
77 install-lib$(NAME)-shared: MSG = $(LIBDIR)/$(SLIBNAME)
79 install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)
80 $(Q)mkdir -p "$(LIBDIR)"
81 $$(INSTALL) -m 644 $$< "$(LIBDIR)"
82 $(LIB_INSTALL_EXTRA_CMD)
84 install-lib$(NAME)-headers: $(addprefix $(SUBDIR),$(HEADERS) $(BUILT_HEADERS))
85 $(Q)mkdir -p "$(INCINSTDIR)"
86 $$(INSTALL) -m 644 $$^ "$(INCINSTDIR)"
88 install-lib$(NAME)-pkgconfig: $(SUBDIR)lib$(NAME).pc
89 $(Q)mkdir -p "$(LIBDIR)/pkgconfig"
90 $$(INSTALL) -m 644 $$^ "$(LIBDIR)/pkgconfig"
93 -$(RM) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
94 "$(SHLIBDIR)/$(SLIBNAME)" \
95 "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
96 -$(SLIB_UNINSTALL_EXTRA_CMD)
97 -$(RM) "$(LIBDIR)/$(LIBNAME)"
100 $(RM) $(addprefix "$(INCINSTDIR)/",$(HEADERS))
101 $(RM) "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
107 $(EXAMPLES) $(TESTPROGS): $(THIS_LIB) $(DEP_LIBS)
109 examples: $(EXAMPLES)
110 testprogs: $(TESTPROGS)