Statistics
| Branch: | Revision:

ffmpeg / subdir.mak @ master

History | View | Annotate | Download (3.12 KB)

1
SRC_DIR := $(SRC_PATH_BARE)/lib$(NAME)
2

    
3
include $(SUBDIR)../common.mak
4

    
5
LIBVERSION := $(lib$(NAME)_VERSION)
6
LIBMAJOR   := $(lib$(NAME)_VERSION_MAJOR)
7
INCINSTDIR := $(INCDIR)/lib$(NAME)
8
THIS_LIB   := $(SUBDIR)$($(CONFIG_SHARED:yes=S)LIBNAME)
9

    
10
all-$(CONFIG_STATIC): $(SUBDIR)$(LIBNAME)
11
all-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME)
12

    
13
$(SUBDIR)%-test.o: $(SUBDIR)%-test.c
14
	$(CC) $(CPPFLAGS) $(CFLAGS) -DTEST -c $(CC_O) $^
15

    
16
$(SUBDIR)%-test.o: $(SUBDIR)%.c
17
	$(CC) $(CPPFLAGS) $(CFLAGS) -DTEST -c $(CC_O) $^
18

    
19
$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
20
	$(YASMDEP) $(YASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.o=.d)
21
	$(YASM) $(YASMFLAGS) -I $(<D)/ -o $@ $<
22

    
23
$(OBJS) $(SUBDIR)%.ho $(SUBDIR)%-test.o $(TESTOBJS): CPPFLAGS += -DHAVE_AV_CONFIG_H
24

    
25
$(SUBDIR)$(LIBNAME): $(OBJS)
26
	$(RM) $@
27
	$(AR) rc $@ $^ $(EXTRAOBJS)
28
	$(RANLIB) $@
29

    
30
install-headers: install-lib$(NAME)-headers install-lib$(NAME)-pkgconfig
31

    
32
install-libs-$(CONFIG_STATIC): install-lib$(NAME)-static
33
install-libs-$(CONFIG_SHARED): install-lib$(NAME)-shared
34

    
35
define RULES
36
$(SUBDIR)%$(EXESUF): $(SUBDIR)%.o
37
	$$(LD) $(FFLDFLAGS) -o $$@ $$^ -l$(FULLNAME) $(FFEXTRALIBS) $$(ELIBS)
38

    
39
$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
40
	$(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
41

    
42
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SUBDIR)lib$(NAME).ver
43
	$(SLIB_CREATE_DEF_CMD)
44
	$$(LD) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$(filter %.o,$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
45
	$(SLIB_EXTRA_CMD)
46

    
47
ifdef SUBDIR
48
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(DEP_LIBS)
49
endif
50

    
51
clean::
52
	$(RM) $(addprefix $(SUBDIR),*-example$(EXESUF) *-test$(EXESUF) $(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
53
	    $(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS)))) \
54
	    $(HOSTOBJS) $(HOSTPROGS)
55

    
56
distclean:: clean
57
	$(RM)  $(addprefix $(SUBDIR),$(DISTCLEANSUFFIXES)) \
58
            $(addprefix $(SUBDIR), $(foreach suffix,$(DISTCLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
59

    
60
install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
61
	$(Q)mkdir -p "$(SHLIBDIR)"
62
	$$(INSTALL) -m 755 $$< "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
63
	$$(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
64
	$(Q)cd "$(SHLIBDIR)" && \
65
		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
66
	$(Q)cd "$(SHLIBDIR)" && \
67
		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
68
	$(SLIB_INSTALL_EXTRA_CMD)
69

    
70
install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)
71
	$(Q)mkdir -p "$(LIBDIR)"
72
	$$(INSTALL) -m 644 $$< "$(LIBDIR)"
73
	$(LIB_INSTALL_EXTRA_CMD)
74

    
75
install-lib$(NAME)-headers: $(addprefix $(SUBDIR),$(HEADERS) $(BUILT_HEADERS))
76
	$(Q)mkdir -p "$(INCINSTDIR)"
77
	$$(INSTALL) -m 644 $$^ "$(INCINSTDIR)"
78

    
79
install-lib$(NAME)-pkgconfig: $(SUBDIR)lib$(NAME).pc
80
	$(Q)mkdir -p "$(LIBDIR)/pkgconfig"
81
	$$(INSTALL) -m 644 $$^ "$(LIBDIR)/pkgconfig"
82

    
83
uninstall-libs::
84
	-$(RM) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
85
	       "$(SHLIBDIR)/$(SLIBNAME)"            \
86
	       "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
87
	-$(SLIB_UNINSTALL_EXTRA_CMD)
88
	-$(RM) "$(LIBDIR)/$(LIBNAME)"
89

    
90
uninstall-headers::
91
	$(RM) $(addprefix "$(INCINSTDIR)/",$(HEADERS))
92
	$(RM) "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
93
	-rmdir "$(INCDIR)"
94
endef
95

    
96
$(eval $(RULES))
97

    
98
$(EXAMPLES) $(TESTPROGS): $(THIS_LIB) $(DEP_LIBS)
99

    
100
examples: $(EXAMPLES)
101
testprogs: $(TESTPROGS)