Statistics
| Branch: | Revision:

ffmpeg / subdir.mak @ b2755007

History | View | Annotate | Download (2.84 KB)

1 71c61f62 Måns Rullgård
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
ifeq ($(BUILD_STATIC),yes)
9
all: $(SUBDIR)$(LIBNAME)
10
11
install-libs: install-lib$(NAME)-static
12
13
$(SUBDIR)$(LIBNAME): $(OBJS)
14
	rm -f $@
15
	$(AR) rc $@ $^ $(EXTRAOBJS)
16
	$(RANLIB) $@
17
endif
18
19
INCINSTDIR := $(INCDIR)/lib$(NAME)
20
21 bbba084b Måns Rullgård
THIS_LIB := $(SUBDIR)$($(BUILD_SHARED:yes=S)LIBNAME)
22
23 71c61f62 Måns Rullgård
define RULES
24 3fd422ff Måns Rullgård
$(SUBDIR)%$(EXESUF): $(SUBDIR)%.o
25 33afad54 Måns Rullgård
	$(CC) $(FFLDFLAGS) -o $$@ $$^ -l$(FULLNAME) $(FFEXTRALIBS) $$(ELIBS)
26 3fd422ff Måns Rullgård
27
$(SUBDIR)%-test.o: $(SUBDIR)%.c
28
	$(CC) $(CFLAGS) -DTEST -c -o $$@ $$^
29
30
$(SUBDIR)%-test.o: $(SUBDIR)%-test.c
31
	$(CC) $(CFLAGS) -DTEST -c -o $$@ $$^
32
33
$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
34
	$(YASM) $(YASMFLAGS) -I $$(<D)/ -o $$@ $$<
35
36
$(SUBDIR)x86/%.d: $(SUBDIR)x86/%.asm
37
	$(YASM) $(YASMFLAGS) -I $$(<D)/ -M -o $$(@:%.d=%.o) $$< > $$@
38
39
clean::
40
	rm -f $(EXAMPLES) $(addprefix $(SUBDIR),*-test$(EXESUF) $(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
41
	    $(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
42
43
distclean:: clean
44
	rm -f  $(addprefix $(SUBDIR),$(DISTCLEANSUFFIXES)) \
45
            $(addprefix $(SUBDIR), $(foreach suffix,$(DISTCLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
46
47 8e255b8b Måns Rullgård
ifdef BUILD_SHARED
48 71c61f62 Måns Rullgård
all: $(SUBDIR)$(SLIBNAME)
49
50
install-libs: install-lib$(NAME)-shared
51
52
$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
53
	cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
54
55 0147b92e Måns Rullgård
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS)
56 71c61f62 Måns Rullgård
	$(SLIB_CREATE_DEF_CMD)
57 93c021a2 Måns Rullgård
	$(CC) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$(filter-out $(DEP_LIBS),$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
58 71c61f62 Måns Rullgård
	$(SLIB_EXTRA_CMD)
59
60 8e255b8b Måns Rullgård
ifdef SUBDIR
61 76ca42a8 Måns Rullgård
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(DEP_LIBS)
62 71c61f62 Måns Rullgård
endif
63
endif
64
65
install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
66
	install -d "$(SHLIBDIR)"
67 3c3e0680 Diego Biurrun
	install -m 755 $$< "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
68 71c61f62 Måns Rullgård
	$(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
69
	cd "$(SHLIBDIR)" && \
70
		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
71
	cd "$(SHLIBDIR)" && \
72
		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
73
	$(SLIB_INSTALL_EXTRA_CMD)
74
75
install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)
76
	install -d "$(LIBDIR)"
77 3c3e0680 Diego Biurrun
	install -m 644 $$< "$(LIBDIR)"
78 71c61f62 Måns Rullgård
	$(LIB_INSTALL_EXTRA_CMD)
79
80
install-headers::
81
	install -d "$(INCINSTDIR)"
82
	install -d "$(LIBDIR)/pkgconfig"
83
	install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(INCINSTDIR)"
84 25cd5cb3 Diego Biurrun
	install -m 644 $(BUILD_ROOT)/lib$(NAME)/lib$(NAME).pc "$(LIBDIR)/pkgconfig"
85 71c61f62 Måns Rullgård
86
uninstall-libs::
87
	-rm -f "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
88
	       "$(SHLIBDIR)/$(SLIBNAME)"            \
89
	       "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
90
	-$(SLIB_UNINSTALL_EXTRA_CMD)
91
	-rm -f "$(LIBDIR)/$(LIBNAME)"
92
93
uninstall-headers::
94
	rm -f $(addprefix "$(INCINSTDIR)/",$(HEADERS))
95
	rm -f "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
96
	-rmdir "$(INCDIR)"
97
endef
98
99
$(eval $(RULES))
100 3fd422ff Måns Rullgård
101 bbba084b Måns Rullgård
$(EXAMPLES) $(TESTPROGS): $(THIS_LIB) $(DEP_LIBS)
102
103 3fd422ff Måns Rullgård
examples: $(EXAMPLES)
104
testprogs: $(TESTPROGS)