Statistics
| Branch: | Revision:

ffmpeg / subdir.mak @ b578357e

History | View | Annotate | Download (2.97 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
ifdef CONFIG_STATIC
9
all: $(SUBDIR)$(LIBNAME)
10

    
11
install-libs: install-lib$(NAME)-static
12

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

    
19
INCINSTDIR := $(INCDIR)/lib$(NAME)
20

    
21
THIS_LIB := $(SUBDIR)$($(CONFIG_SHARED:yes=S)LIBNAME)
22

    
23
define RULES
24
$(SUBDIR)%$(EXESUF): $(SUBDIR)%.o
25
	$(LD) $(FFLDFLAGS) -o $$@ $$^ -l$(FULLNAME) $(FFEXTRALIBS) $$(ELIBS)
26

    
27
$(SUBDIR)%-test.o: $(SUBDIR)%.c
28
	$(CC) $(CPPFLAGS) $(CFLAGS) -DTEST -c $$(CC_O) $$^
29

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

    
33
$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
34
	$(YASMDEP) $(YASMFLAGS) -I $$(<D)/ -M -o $$@ $$< > $$(@:.o=.d)
35
	$(YASM) $(YASMFLAGS) -I $$(<D)/ -o $$@ $$<
36

    
37
clean::
38
	$(RM) $(addprefix $(SUBDIR),*-example$(EXESUF) *-test$(EXESUF) $(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
39
	    $(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS)))) \
40
	    $(HOSTOBJS) $(HOSTPROGS)
41

    
42
distclean:: clean
43
	$(RM)  $(addprefix $(SUBDIR),$(DISTCLEANSUFFIXES)) \
44
            $(addprefix $(SUBDIR), $(foreach suffix,$(DISTCLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
45

    
46
ifdef CONFIG_SHARED
47
all: $(SUBDIR)$(SLIBNAME)
48

    
49
install-libs: install-lib$(NAME)-shared
50

    
51
$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
52
	cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
53

    
54
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SUBDIR)lib$(NAME).ver
55
	$(SLIB_CREATE_DEF_CMD)
56
	$(LD) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$(filter %.o,$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
57
	$(SLIB_EXTRA_CMD)
58

    
59
ifdef SUBDIR
60
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(DEP_LIBS)
61
endif
62
endif
63

    
64
install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
65
	mkdir -p "$(SHLIBDIR)"
66
	install -m 755 $$< "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
67
	$(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
68
	cd "$(SHLIBDIR)" && \
69
		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
70
	cd "$(SHLIBDIR)" && \
71
		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
72
	$(SLIB_INSTALL_EXTRA_CMD)
73

    
74
install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)
75
	mkdir -p "$(LIBDIR)"
76
	install -m 644 $$< "$(LIBDIR)"
77
	$(LIB_INSTALL_EXTRA_CMD)
78

    
79
install-headers::
80
	mkdir -p "$(INCINSTDIR)"
81
	mkdir -p "$(LIBDIR)/pkgconfig"
82
	install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(INCINSTDIR)"
83
ifdef BUILT_HEADERS
84
	install -m 644 $(addprefix $(SUBDIR),$(BUILT_HEADERS)) "$(INCINSTDIR)"
85
endif
86
	install -m 644 $(BUILD_ROOT)/lib$(NAME)/lib$(NAME).pc "$(LIBDIR)/pkgconfig"
87

    
88
uninstall-libs::
89
	-$(RM) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
90
	       "$(SHLIBDIR)/$(SLIBNAME)"            \
91
	       "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
92
	-$(SLIB_UNINSTALL_EXTRA_CMD)
93
	-$(RM) "$(LIBDIR)/$(LIBNAME)"
94

    
95
uninstall-headers::
96
	$(RM) $(addprefix "$(INCINSTDIR)/",$(HEADERS))
97
	$(RM) "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
98
	-rmdir "$(INCDIR)"
99
endef
100

    
101
$(eval $(RULES))
102

    
103
$(EXAMPLES) $(TESTPROGS): $(THIS_LIB) $(DEP_LIBS)
104

    
105
examples: $(EXAMPLES)
106
testprogs: $(TESTPROGS)