lavfi: allow building without swscale.
[libav.git] / library.mak
CommitLineData
f038cf3c 1SRC_DIR := $(SRC_PATH)/lib$(NAME)
71c61f62 2
57b4a3dd 3include $(SRC_PATH)/common.mak
71c61f62
MR
4
5LIBVERSION := $(lib$(NAME)_VERSION)
6LIBMAJOR := $(lib$(NAME)_VERSION_MAJOR)
477b3382
MR
7INCINSTDIR := $(INCDIR)/lib$(NAME)
8THIS_LIB := $(SUBDIR)$($(CONFIG_SHARED:yes=S)LIBNAME)
71c61f62 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
MR
18
19$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
20 $(YASMDEP) $(YASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.o=.d)
21 $(YASM) $(YASMFLAGS) -I $(<D)/ -o $@ $<
22
659aa20e
MR
23$(OBJS) $(SUBDIR)%.ho $(TESTOBJS): CPPFLAGS += -DHAVE_AV_CONFIG_H
24$(TESTOBJS): CPPFLAGS += -DTEST
72c2bdeb 25
71c61f62 26$(SUBDIR)$(LIBNAME): $(OBJS)
50e10cbd 27 $(RM) $@
71c61f62
MR
28 $(AR) rc $@ $^ $(EXTRAOBJS)
29 $(RANLIB) $@
71c61f62 30
56540673
MR
31install-headers: install-lib$(NAME)-headers install-lib$(NAME)-pkgconfig
32
451db983
MR
33install-libs-$(CONFIG_STATIC): install-lib$(NAME)-static
34install-libs-$(CONFIG_SHARED): install-lib$(NAME)-shared
35
71c61f62 36define RULES
8a54bfe8 37$(EXAMPLES) $(TESTPROGS) $(TOOLS): %$(EXESUF): %.o
ca903615 38 $$(LD) $(LDFLAGS) -o $$@ $$^ -l$(FULLNAME) $(FFEXTRALIBS) $$(ELIBS)
3fd422ff 39
71c61f62 40$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
63611f31 41 $(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
71c61f62 42
729f953f 43$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SUBDIR)lib$(NAME).ver $(DEP_LIBS)
71c61f62 44 $(SLIB_CREATE_DEF_CMD)
ca903615 45 $$(LD) $(SHFLAGS) $(LDFLAGS) -o $$@ $$(filter %.o,$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
71c61f62
MR
46 $(SLIB_EXTRA_CMD)
47
0c8cc2c4
MR
48clean::
49 $(RM) $(addprefix $(SUBDIR),*-example$(EXESUF) *-test$(EXESUF) $(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
e7e19b15 50 $(CLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%) $(HOSTOBJS) $(HOSTPROGS)
0c8cc2c4
MR
51
52distclean:: clean
e7e19b15 53 $(RM) $(DISTCLEANSUFFIXES:%=$(SUBDIR)%) $(DISTCLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%)
0c8cc2c4 54
71c61f62 55install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
63611f31 56 $(Q)mkdir -p "$(SHLIBDIR)"
2f138f0b
MR
57 $$(INSTALL) -m 755 $$< "$(SHLIBDIR)/$(SLIB_INSTALL_NAME)"
58 $(Q)$(foreach F,$(SLIB_INSTALL_LINKS),cd "$(SHLIBDIR)" && $(LN_S) $(SLIB_INSTALL_NAME) $(F);)
59 $(if $(SLIB_INSTALL_EXTRA_SHLIB),$$(INSTALL) -m 644 $(SLIB_INSTALL_EXTRA_SHLIB:%=$(SUBDIR)%) "$(SHLIBDIR)")
60 $(if $(SLIB_INSTALL_EXTRA_LIB),$(Q)mkdir -p "$(LIBDIR)")
61 $(if $(SLIB_INSTALL_EXTRA_LIB),$$(INSTALL) -m 644 $(SLIB_INSTALL_EXTRA_LIB:%=$(SUBDIR)%) "$(LIBDIR)")
63611f31 62
71c61f62 63install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)
63611f31 64 $(Q)mkdir -p "$(LIBDIR)"
fd676deb 65 $$(INSTALL) -m 644 $$< "$(LIBDIR)"
6cfac0e9 66 $(LIB_INSTALL_EXTRA_CMD)
71c61f62 67
34512bca 68install-lib$(NAME)-headers: $(addprefix $(SUBDIR),$(HEADERS) $(BUILT_HEADERS))
63611f31 69 $(Q)mkdir -p "$(INCINSTDIR)"
34512bca
MR
70 $$(INSTALL) -m 644 $$^ "$(INCINSTDIR)"
71
72install-lib$(NAME)-pkgconfig: $(SUBDIR)lib$(NAME).pc
63611f31 73 $(Q)mkdir -p "$(LIBDIR)/pkgconfig"
34512bca 74 $$(INSTALL) -m 644 $$^ "$(LIBDIR)/pkgconfig"
d3cb93b3
RP
75
76uninstall-libs::
50e10cbd 77 -$(RM) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
d3cb93b3
RP
78 "$(SHLIBDIR)/$(SLIBNAME)" \
79 "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
2f138f0b
MR
80 -$(RM) $(SLIB_INSTALL_EXTRA_SHLIB:%="$(SHLIBDIR)"%)
81 -$(RM) $(SLIB_INSTALL_EXTRA_LIB:%="$(LIBDIR)"%)
50e10cbd 82 -$(RM) "$(LIBDIR)/$(LIBNAME)"
d3cb93b3
RP
83
84uninstall-headers::
50e10cbd
MR
85 $(RM) $(addprefix "$(INCINSTDIR)/",$(HEADERS))
86 $(RM) "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
d3cb93b3 87 -rmdir "$(INCDIR)"
71c61f62
MR
88endef
89
90$(eval $(RULES))
3fd422ff 91
28e1c979 92$(EXAMPLES) $(TESTPROGS) $(TOOLS): $(THIS_LIB) $(DEP_LIBS)
0ea5b442 93$(TESTPROGS): $(SUBDIR)$(LIBNAME)
bbba084b 94
3fd422ff
MR
95examples: $(EXAMPLES)
96testprogs: $(TESTPROGS)