Statistics
| Branch: | Revision:

ffmpeg / subdir.mak @ 2a5500b1

History | View | Annotate | Download (3.23 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

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

    
10
ifdef CONFIG_STATIC
11
all: $(SUBDIR)$(LIBNAME)
12

    
13
install-libs: install-lib$(NAME)-static
14

    
15
$(SUBDIR)$(LIBNAME): $(OBJS)
16
	$(RM) $@
17
	$(AR) rc $@ $^ $(EXTRAOBJS)
18
	$(RANLIB) $@
19
endif
20

    
21
install-headers: install-lib$(NAME)-headers install-lib$(NAME)-pkgconfig
22

    
23
INCINSTDIR := $(INCDIR)/lib$(NAME)
24

    
25
THIS_LIB := $(SUBDIR)$($(CONFIG_SHARED:yes=S)LIBNAME)
26

    
27
define RULES
28
$(SUBDIR)%$(EXESUF): $(SUBDIR)%.o
29
	$$(LD) $(FFLDFLAGS) -o $$@ $$^ -l$(FULLNAME) $(FFEXTRALIBS) $$(ELIBS)
30

    
31
$(SUBDIR)%-test.o: $(SUBDIR)%.c
32
	$$(CC) $$(CPPFLAGS) $(CFLAGS) -DTEST -c $$(CC_O) $$^
33

    
34
$(SUBDIR)%-test.o: $(SUBDIR)%-test.c
35
	$$(CC) $$(CPPFLAGS) $(CFLAGS) -DTEST -c $$(CC_O) $$^
36

    
37
$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
38
	$$(YASMDEP) $(YASMFLAGS) -I $$(<D)/ -M -o $$@ $$< > $$(@:.o=.d)
39
	$$(YASM) $(YASMFLAGS) -I $$(<D)/ -o $$@ $$<
40

    
41
clean::
42
	$(RM) $(addprefix $(SUBDIR),*-example$(EXESUF) *-test$(EXESUF) $(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
43
	    $(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS)))) \
44
	    $(HOSTOBJS) $(HOSTPROGS)
45

    
46
distclean:: clean
47
	$(RM)  $(addprefix $(SUBDIR),$(DISTCLEANSUFFIXES)) \
48
            $(addprefix $(SUBDIR), $(foreach suffix,$(DISTCLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
49

    
50
ifdef CONFIG_SHARED
51
all: $(SUBDIR)$(SLIBNAME)
52

    
53
install-libs: install-lib$(NAME)-shared
54

    
55
$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
56
	$(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
57

    
58
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SUBDIR)lib$(NAME).ver
59
	$(SLIB_CREATE_DEF_CMD)
60
	$$(LD) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$(filter %.o,$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
61
	$(SLIB_EXTRA_CMD)
62

    
63
ifdef SUBDIR
64
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(DEP_LIBS)
65
endif
66
endif
67

    
68
install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
69
	$(Q)mkdir -p "$(SHLIBDIR)"
70
	$$(INSTALL) -m 755 $$< "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
71
	$$(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
72
	$(Q)cd "$(SHLIBDIR)" && \
73
		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
74
	$(Q)cd "$(SHLIBDIR)" && \
75
		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
76
	$(SLIB_INSTALL_EXTRA_CMD)
77

    
78
install-lib$(NAME)-static: MSG = $(LIBDIR)/$(LIBNAME)
79
install-lib$(NAME)-shared: MSG = $(LIBDIR)/$(SLIBNAME)
80

    
81
install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)
82
	$(Q)mkdir -p "$(LIBDIR)"
83
	$$(INSTALL) -m 644 $$< "$(LIBDIR)"
84
	$(LIB_INSTALL_EXTRA_CMD)
85

    
86
install-lib$(NAME)-headers: $(addprefix $(SUBDIR),$(HEADERS) $(BUILT_HEADERS))
87
	$(Q)mkdir -p "$(INCINSTDIR)"
88
	$$(INSTALL) -m 644 $$^ "$(INCINSTDIR)"
89

    
90
install-lib$(NAME)-pkgconfig: $(SUBDIR)lib$(NAME).pc
91
	$(Q)mkdir -p "$(LIBDIR)/pkgconfig"
92
	$$(INSTALL) -m 644 $$^ "$(LIBDIR)/pkgconfig"
93

    
94
uninstall-libs::
95
	-$(RM) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
96
	       "$(SHLIBDIR)/$(SLIBNAME)"            \
97
	       "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
98
	-$(SLIB_UNINSTALL_EXTRA_CMD)
99
	-$(RM) "$(LIBDIR)/$(LIBNAME)"
100

    
101
uninstall-headers::
102
	$(RM) $(addprefix "$(INCINSTDIR)/",$(HEADERS))
103
	$(RM) "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
104
	-rmdir "$(INCDIR)"
105
endef
106

    
107
$(eval $(RULES))
108

    
109
$(EXAMPLES) $(TESTPROGS): $(THIS_LIB) $(DEP_LIBS)
110

    
111
examples: $(EXAMPLES)
112
testprogs: $(TESTPROGS)