Prettify make output
[libav.git] / subdir.mak
CommitLineData
71c61f62
MR
1SRC_DIR := $(SRC_PATH_BARE)/lib$(NAME)
2
3include $(SUBDIR)../common.mak
4
5LIBVERSION := $(lib$(NAME)_VERSION)
6LIBMAJOR := $(lib$(NAME)_VERSION_MAJOR)
7
e273b038 8ifdef CONFIG_STATIC
71c61f62
MR
9all: $(SUBDIR)$(LIBNAME)
10
11install-libs: install-lib$(NAME)-static
34512bca 12install-headers: install-lib$(NAME)-headers install-lib$(NAME)-pkgconfig
71c61f62
MR
13
14$(SUBDIR)$(LIBNAME): $(OBJS)
50e10cbd 15 $(RM) $@
71c61f62
MR
16 $(AR) rc $@ $^ $(EXTRAOBJS)
17 $(RANLIB) $@
18endif
19
20INCINSTDIR := $(INCDIR)/lib$(NAME)
21
bea81a52 22THIS_LIB := $(SUBDIR)$($(CONFIG_SHARED:yes=S)LIBNAME)
bbba084b 23
71c61f62 24define RULES
3fd422ff 25$(SUBDIR)%$(EXESUF): $(SUBDIR)%.o
63611f31 26 $$(LD) $(FFLDFLAGS) -o $$@ $$^ -l$(FULLNAME) $(FFEXTRALIBS) $$(ELIBS)
3fd422ff
MR
27
28$(SUBDIR)%-test.o: $(SUBDIR)%.c
63611f31 29 $$(CC) $(CPPFLAGS) $(CFLAGS) -DTEST -c $$(CC_O) $$^
3fd422ff
MR
30
31$(SUBDIR)%-test.o: $(SUBDIR)%-test.c
63611f31 32 $$(CC) $(CPPFLAGS) $(CFLAGS) -DTEST -c $$(CC_O) $$^
3fd422ff
MR
33
34$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
63611f31
MR
35 $$(YASMDEP) $(YASMFLAGS) -I $$(<D)/ -M -o $$@ $$< > $$(@:.o=.d)
36 $$(YASM) $(YASMFLAGS) -I $$(<D)/ -o $$@ $$<
3fd422ff 37
3fd422ff 38clean::
50e10cbd 39 $(RM) $(addprefix $(SUBDIR),*-example$(EXESUF) *-test$(EXESUF) $(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
de4070b5
MR
40 $(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS)))) \
41 $(HOSTOBJS) $(HOSTPROGS)
3fd422ff
MR
42
43distclean:: clean
50e10cbd 44 $(RM) $(addprefix $(SUBDIR),$(DISTCLEANSUFFIXES)) \
3fd422ff
MR
45 $(addprefix $(SUBDIR), $(foreach suffix,$(DISTCLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
46
bea81a52 47ifdef CONFIG_SHARED
71c61f62
MR
48all: $(SUBDIR)$(SLIBNAME)
49
50install-libs: install-lib$(NAME)-shared
51
52$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
63611f31 53 $(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
71c61f62 54
a482e61b 55$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SUBDIR)lib$(NAME).ver
71c61f62 56 $(SLIB_CREATE_DEF_CMD)
63611f31 57 $$(LD) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$(filter %.o,$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
71c61f62
MR
58 $(SLIB_EXTRA_CMD)
59
8e255b8b 60ifdef SUBDIR
76ca42a8 61$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(DEP_LIBS)
71c61f62
MR
62endif
63endif
64
65install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
63611f31 66 $(Q)mkdir -p "$(SHLIBDIR)"
fd676deb 67 $$(INSTALL) -m 755 $$< "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
63611f31
MR
68 $$(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
69 $(Q)cd "$(SHLIBDIR)" && \
71c61f62 70 $(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
63611f31 71 $(Q)cd "$(SHLIBDIR)" && \
71c61f62 72 $(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
63611f31
MR
73 $$(SLIB_INSTALL_EXTRA_CMD)
74
75install-lib$(NAME)-static: MSG = $(LIBDIR)/$(LIBNAME)
76install-lib$(NAME)-shared: MSG = $(LIBDIR)/$(SLIBNAME)
71c61f62
MR
77
78install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)
63611f31 79 $(Q)mkdir -p "$(LIBDIR)"
fd676deb 80 $$(INSTALL) -m 644 $$< "$(LIBDIR)"
63611f31 81 $$(LIB_INSTALL_EXTRA_CMD)
71c61f62 82
34512bca 83install-lib$(NAME)-headers: $(addprefix $(SUBDIR),$(HEADERS) $(BUILT_HEADERS))
63611f31 84 $(Q)mkdir -p "$(INCINSTDIR)"
34512bca
MR
85 $$(INSTALL) -m 644 $$^ "$(INCINSTDIR)"
86
87install-lib$(NAME)-pkgconfig: $(SUBDIR)lib$(NAME).pc
63611f31 88 $(Q)mkdir -p "$(LIBDIR)/pkgconfig"
34512bca 89 $$(INSTALL) -m 644 $$^ "$(LIBDIR)/pkgconfig"
d3cb93b3
RP
90
91uninstall-libs::
50e10cbd 92 -$(RM) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
d3cb93b3
RP
93 "$(SHLIBDIR)/$(SLIBNAME)" \
94 "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
95 -$(SLIB_UNINSTALL_EXTRA_CMD)
50e10cbd 96 -$(RM) "$(LIBDIR)/$(LIBNAME)"
d3cb93b3
RP
97
98uninstall-headers::
50e10cbd
MR
99 $(RM) $(addprefix "$(INCINSTDIR)/",$(HEADERS))
100 $(RM) "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
d3cb93b3 101 -rmdir "$(INCDIR)"
71c61f62
MR
102endef
103
104$(eval $(RULES))
3fd422ff 105
bbba084b
MR
106$(EXAMPLES) $(TESTPROGS): $(THIS_LIB) $(DEP_LIBS)
107
3fd422ff
MR
108examples: $(EXAMPLES)
109testprogs: $(TESTPROGS)