Split global .gitignore file into per-directory files
[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
8c5239b3 13$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
755834e9 14 $(DEPYASM) $(YASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.o=.d)
8c5239b3 15 $(YASM) $(YASMFLAGS) -I $(<D)/ -o $@ $<
0673ede9 16 -$(STRIP) $(STRIPFLAGS) $@
8c5239b3 17
c2626492
MR
18LIBOBJS := $(OBJS) $(SUBDIR)%.h.o $(TESTOBJS)
19$(LIBOBJS) $(LIBOBJS:.o=.i): CPPFLAGS += -DHAVE_AV_CONFIG_H
72c2bdeb 20
71c61f62 21$(SUBDIR)$(LIBNAME): $(OBJS)
50e10cbd 22 $(RM) $@
4436f25a 23 $(AR) $(ARFLAGS) $(AR_O) $^
71c61f62 24 $(RANLIB) $@
71c61f62 25
56540673
MR
26install-headers: install-lib$(NAME)-headers install-lib$(NAME)-pkgconfig
27
451db983
MR
28install-libs-$(CONFIG_STATIC): install-lib$(NAME)-static
29install-libs-$(CONFIG_SHARED): install-lib$(NAME)-shared
30
71c61f62 31define RULES
b339182e
DB
32$(TOOLS): THISLIB = $(FULLNAME:%=$(LD_LIB))
33$(TESTPROGS): THISLIB = $(SUBDIR)$(LIBNAME)
4b895cb2 34
b339182e 35$(TESTPROGS) $(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
bb0babd7 36 $$(LD) $(LDFLAGS) $(LDEXEFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) $(FFEXTRALIBS) $$(ELIBS)
3fd422ff 37
71c61f62 38$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
63611f31 39 $(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
71c61f62 40
729f953f 41$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SUBDIR)lib$(NAME).ver $(DEP_LIBS)
71c61f62 42 $(SLIB_CREATE_DEF_CMD)
4436f25a 43 $$(LD) $(SHFLAGS) $(LDFLAGS) $$(LD_O) $$(filter %.o,$$^) $(FFEXTRALIBS)
71c61f62
MR
44 $(SLIB_EXTRA_CMD)
45
0c8cc2c4 46clean::
b339182e 47 $(RM) $(addprefix $(SUBDIR),*-test$(EXESUF) $(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
395c3feb 48 $(CLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%)
0c8cc2c4
MR
49
50distclean:: clean
e7e19b15 51 $(RM) $(DISTCLEANSUFFIXES:%=$(SUBDIR)%) $(DISTCLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%)
0c8cc2c4 52
71c61f62 53install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
63611f31 54 $(Q)mkdir -p "$(SHLIBDIR)"
2f138f0b
MR
55 $$(INSTALL) -m 755 $$< "$(SHLIBDIR)/$(SLIB_INSTALL_NAME)"
56 $(Q)$(foreach F,$(SLIB_INSTALL_LINKS),cd "$(SHLIBDIR)" && $(LN_S) $(SLIB_INSTALL_NAME) $(F);)
57 $(if $(SLIB_INSTALL_EXTRA_SHLIB),$$(INSTALL) -m 644 $(SLIB_INSTALL_EXTRA_SHLIB:%=$(SUBDIR)%) "$(SHLIBDIR)")
58 $(if $(SLIB_INSTALL_EXTRA_LIB),$(Q)mkdir -p "$(LIBDIR)")
59 $(if $(SLIB_INSTALL_EXTRA_LIB),$$(INSTALL) -m 644 $(SLIB_INSTALL_EXTRA_LIB:%=$(SUBDIR)%) "$(LIBDIR)")
63611f31 60
71c61f62 61install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)
63611f31 62 $(Q)mkdir -p "$(LIBDIR)"
fd676deb 63 $$(INSTALL) -m 644 $$< "$(LIBDIR)"
6cfac0e9 64 $(LIB_INSTALL_EXTRA_CMD)
71c61f62 65
34512bca 66install-lib$(NAME)-headers: $(addprefix $(SUBDIR),$(HEADERS) $(BUILT_HEADERS))
63611f31 67 $(Q)mkdir -p "$(INCINSTDIR)"
34512bca
MR
68 $$(INSTALL) -m 644 $$^ "$(INCINSTDIR)"
69
70install-lib$(NAME)-pkgconfig: $(SUBDIR)lib$(NAME).pc
63611f31 71 $(Q)mkdir -p "$(LIBDIR)/pkgconfig"
34512bca 72 $$(INSTALL) -m 644 $$^ "$(LIBDIR)/pkgconfig"
d3cb93b3
RP
73
74uninstall-libs::
50e10cbd 75 -$(RM) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
d3cb93b3
RP
76 "$(SHLIBDIR)/$(SLIBNAME)" \
77 "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
2f138f0b
MR
78 -$(RM) $(SLIB_INSTALL_EXTRA_SHLIB:%="$(SHLIBDIR)"%)
79 -$(RM) $(SLIB_INSTALL_EXTRA_LIB:%="$(LIBDIR)"%)
50e10cbd 80 -$(RM) "$(LIBDIR)/$(LIBNAME)"
d3cb93b3
RP
81
82uninstall-headers::
a2b4d1df 83 $(RM) $(addprefix "$(INCINSTDIR)/",$(HEADERS) $(BUILT_HEADERS))
50e10cbd 84 $(RM) "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
a2b4d1df 85 -rmdir "$(INCINSTDIR)"
71c61f62
MR
86endef
87
88$(eval $(RULES))
3fd422ff 89
b339182e
DB
90$(TOOLS): $(DEP_LIBS) $(SUBDIR)$($(CONFIG_SHARED:yes=S)LIBNAME)
91$(TESTPROGS): $(DEP_LIBS) $(SUBDIR)$(LIBNAME)
bbba084b 92
3fd422ff 93testprogs: $(TESTPROGS)