mp3dec: move XING/Info and VBRI parsing into their own functions
[libav.git] / library.mak
CommitLineData
57b4a3dd 1include $(SRC_PATH)/common.mak
71c61f62
MR
2
3LIBVERSION := $(lib$(NAME)_VERSION)
4LIBMAJOR := $(lib$(NAME)_VERSION_MAJOR)
304b806c 5LIBMINOR := $(lib$(NAME)_VERSION_MINOR)
477b3382 6INCINSTDIR := $(INCDIR)/lib$(NAME)
71c61f62 7
b3fab1f2
JG
8INSTHEADERS := $(INSTHEADERS) $(HEADERS:%=$(SUBDIR)%)
9
451db983
MR
10all-$(CONFIG_STATIC): $(SUBDIR)$(LIBNAME)
11all-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME)
12
a854bcdb 13$(SUBDIR)%-test.o: $(SUBDIR)%-test.c
659aa20e 14 $(COMPILE_C)
8c5239b3 15
a854bcdb 16$(SUBDIR)%-test.o: $(SUBDIR)%.c
659aa20e 17 $(COMPILE_C)
8c5239b3 18
c2626492
MR
19$(SUBDIR)%-test.i: $(SUBDIR)%-test.c
20 $(CC) $(CCFLAGS) $(CC_E) $<
21
22$(SUBDIR)%-test.i: $(SUBDIR)%.c
23 $(CC) $(CCFLAGS) $(CC_E) $<
24
8c5239b3 25$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
755834e9 26 $(DEPYASM) $(YASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.o=.d)
8c5239b3 27 $(YASM) $(YASMFLAGS) -I $(<D)/ -o $@ $<
0673ede9 28 -$(STRIP) $(STRIPFLAGS) $@
8c5239b3 29
c2626492
MR
30LIBOBJS := $(OBJS) $(SUBDIR)%.h.o $(TESTOBJS)
31$(LIBOBJS) $(LIBOBJS:.o=.i): CPPFLAGS += -DHAVE_AV_CONFIG_H
32$(TESTOBJS) $(TESTOBJS:.o=.i): CPPFLAGS += -DTEST
72c2bdeb 33
71c61f62 34$(SUBDIR)$(LIBNAME): $(OBJS)
50e10cbd 35 $(RM) $@
4436f25a 36 $(AR) $(ARFLAGS) $(AR_O) $^
71c61f62 37 $(RANLIB) $@
71c61f62 38
56540673
MR
39install-headers: install-lib$(NAME)-headers install-lib$(NAME)-pkgconfig
40
451db983
MR
41install-libs-$(CONFIG_STATIC): install-lib$(NAME)-static
42install-libs-$(CONFIG_SHARED): install-lib$(NAME)-shared
43
71c61f62 44define RULES
b339182e
DB
45$(TOOLS): THISLIB = $(FULLNAME:%=$(LD_LIB))
46$(TESTPROGS): THISLIB = $(SUBDIR)$(LIBNAME)
4b895cb2 47
b339182e 48$(TESTPROGS) $(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
effe4438 49 $$(LD) $(LDFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) $(FFEXTRALIBS) $$(ELIBS)
3fd422ff 50
71c61f62 51$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
63611f31 52 $(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
71c61f62 53
729f953f 54$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SUBDIR)lib$(NAME).ver $(DEP_LIBS)
71c61f62 55 $(SLIB_CREATE_DEF_CMD)
4436f25a 56 $$(LD) $(SHFLAGS) $(LDFLAGS) $$(LD_O) $$(filter %.o,$$^) $(FFEXTRALIBS)
71c61f62
MR
57 $(SLIB_EXTRA_CMD)
58
0c8cc2c4 59clean::
b339182e 60 $(RM) $(addprefix $(SUBDIR),*-test$(EXESUF) $(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
395c3feb 61 $(CLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%)
0c8cc2c4
MR
62
63distclean:: clean
e7e19b15 64 $(RM) $(DISTCLEANSUFFIXES:%=$(SUBDIR)%) $(DISTCLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%)
0c8cc2c4 65
71c61f62 66install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
63611f31 67 $(Q)mkdir -p "$(SHLIBDIR)"
2f138f0b
MR
68 $$(INSTALL) -m 755 $$< "$(SHLIBDIR)/$(SLIB_INSTALL_NAME)"
69 $(Q)$(foreach F,$(SLIB_INSTALL_LINKS),cd "$(SHLIBDIR)" && $(LN_S) $(SLIB_INSTALL_NAME) $(F);)
70 $(if $(SLIB_INSTALL_EXTRA_SHLIB),$$(INSTALL) -m 644 $(SLIB_INSTALL_EXTRA_SHLIB:%=$(SUBDIR)%) "$(SHLIBDIR)")
71 $(if $(SLIB_INSTALL_EXTRA_LIB),$(Q)mkdir -p "$(LIBDIR)")
72 $(if $(SLIB_INSTALL_EXTRA_LIB),$$(INSTALL) -m 644 $(SLIB_INSTALL_EXTRA_LIB:%=$(SUBDIR)%) "$(LIBDIR)")
63611f31 73
71c61f62 74install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)
63611f31 75 $(Q)mkdir -p "$(LIBDIR)"
fd676deb 76 $$(INSTALL) -m 644 $$< "$(LIBDIR)"
6cfac0e9 77 $(LIB_INSTALL_EXTRA_CMD)
71c61f62 78
34512bca 79install-lib$(NAME)-headers: $(addprefix $(SUBDIR),$(HEADERS) $(BUILT_HEADERS))
63611f31 80 $(Q)mkdir -p "$(INCINSTDIR)"
34512bca
MR
81 $$(INSTALL) -m 644 $$^ "$(INCINSTDIR)"
82
83install-lib$(NAME)-pkgconfig: $(SUBDIR)lib$(NAME).pc
63611f31 84 $(Q)mkdir -p "$(LIBDIR)/pkgconfig"
34512bca 85 $$(INSTALL) -m 644 $$^ "$(LIBDIR)/pkgconfig"
d3cb93b3
RP
86
87uninstall-libs::
50e10cbd 88 -$(RM) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
d3cb93b3
RP
89 "$(SHLIBDIR)/$(SLIBNAME)" \
90 "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
2f138f0b
MR
91 -$(RM) $(SLIB_INSTALL_EXTRA_SHLIB:%="$(SHLIBDIR)"%)
92 -$(RM) $(SLIB_INSTALL_EXTRA_LIB:%="$(LIBDIR)"%)
50e10cbd 93 -$(RM) "$(LIBDIR)/$(LIBNAME)"
d3cb93b3
RP
94
95uninstall-headers::
a2b4d1df 96 $(RM) $(addprefix "$(INCINSTDIR)/",$(HEADERS) $(BUILT_HEADERS))
50e10cbd 97 $(RM) "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
a2b4d1df 98 -rmdir "$(INCINSTDIR)"
71c61f62
MR
99endef
100
101$(eval $(RULES))
3fd422ff 102
b339182e
DB
103$(TOOLS): $(DEP_LIBS) $(SUBDIR)$($(CONFIG_SHARED:yes=S)LIBNAME)
104$(TESTPROGS): $(DEP_LIBS) $(SUBDIR)$(LIBNAME)
bbba084b 105
3fd422ff 106testprogs: $(TESTPROGS)