Statistics
| Branch: | Revision:

ffmpeg / common.mak @ 86be2bc3

History | View | Annotate | Download (3.24 KB)

1
#
2
# common bits used by all libraries
3
#
4

    
5
# first so "all" becomes default target
6
all: all-yes
7

    
8
ifndef SUBDIR
9
vpath %.c   $(SRC_DIR)
10
vpath %.h   $(SRC_DIR)
11
vpath %.S   $(SRC_DIR)
12
vpath %.asm $(SRC_DIR)
13
vpath %.v   $(SRC_DIR)
14

    
15
ifeq ($(SRC_DIR),$(SRC_PATH_BARE))
16
BUILD_ROOT_REL = .
17
else
18
BUILD_ROOT_REL = ..
19
endif
20

    
21
ifndef V
22
Q      = @
23
ECHO   = printf "$(1)\t%s\n" $(2)
24
BRIEF  = CC AS YASM AR LD HOSTCC RANLIB STRIP CP
25
SILENT = DEPCC YASMDEP RM
26
MSG    = $@
27
G      = @$(call ECHO,GEN,$@);
28
M      = @$(call ECHO,$(MSG),$@);
29
$(foreach VAR,$(BRIEF), \
30
    $(eval $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))
31
$(foreach VAR,$(SILENT),$(eval $(VAR) = @$($(VAR))))
32
$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL))
33
endif
34

    
35
ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
36

    
37
CPPFLAGS := -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(CPPFLAGS)
38
CFLAGS   += $(ECFLAGS)
39

    
40
%.o: %.c
41
	$(CCDEP)
42
	$(CC) $(CPPFLAGS) $(CFLAGS) $(CC_DEPFLAGS) -c $(CC_O) $<
43

    
44
%.o: %.S
45
	$(ASDEP)
46
	$(AS) $(CPPFLAGS) $(ASFLAGS) $(AS_DEPFLAGS) -c -o $@ $<
47

    
48
%.ho: %.h
49
	$(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
50

    
51
%$(EXESUF): %.c
52

    
53
%.ver: %.v
54
	$(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
55

    
56
SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
57
ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
58
$(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
59
endif
60

    
61
$(BUILD_ROOT_REL)/version.h: $(SRC_PATH_BARE)/version.sh config.mak
62
	$(G)$< $(SRC_PATH) $@ $(EXTRA_VERSION)
63

    
64
install: install-libs install-headers
65
install-libs: install-libs-yes
66

    
67
uninstall: uninstall-libs uninstall-headers
68

    
69
.PHONY: all depend dep *clean install* uninstall* examples testprogs
70

    
71
# Disable suffix rules.  Most of the builtin rules are suffix rules,
72
# so this saves some time on slow systems.
73
.SUFFIXES:
74

    
75
# Do not delete intermediate files from chains of implicit rules
76
.SECONDARY:
77
endif
78

    
79
OBJS-$(HAVE_MMX) +=  $(MMX-OBJS-yes)
80

    
81
CFLAGS    += $(CFLAGS-yes)
82
OBJS      += $(OBJS-yes)
83
FFLIBS    := $(FFLIBS-yes) $(FFLIBS)
84
TESTPROGS += $(TESTPROGS-yes)
85

    
86
FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
87
FFLDFLAGS   := $(addprefix -L$(BUILD_ROOT)/lib,$(ALLFFLIBS)) $(LDFLAGS)
88

    
89
EXAMPLES  := $(addprefix $(SUBDIR),$(addsuffix -example$(EXESUF),$(EXAMPLES)))
90
OBJS      := $(addprefix $(SUBDIR),$(sort $(OBJS)))
91
TESTOBJS  := $(addprefix $(SUBDIR),$(TESTOBJS))
92
TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS)))
93
HOSTOBJS  := $(addprefix $(SUBDIR),$(addsuffix .o,$(HOSTPROGS)))
94
HOSTPROGS := $(addprefix $(SUBDIR),$(addsuffix $(HOSTEXESUF),$(HOSTPROGS)))
95

    
96
DEP_LIBS := $(foreach NAME,$(FFLIBS),$(BUILD_ROOT_REL)/lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
97

    
98
ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
99
SKIPHEADERS += $(addprefix $(ARCH)/,$(ARCH_HEADERS))
100
SKIPHEADERS := $(addprefix $(SUBDIR),$(SKIPHEADERS-) $(SKIPHEADERS))
101
checkheaders: $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho))
102

    
103
$(HOSTOBJS): %.o: %.c
104
	$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
105

    
106
$(HOSTPROGS): %$(HOSTEXESUF): %.o
107
	$(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
108

    
109
DEPS := $(OBJS:.o=.d)
110
depend dep: $(DEPS)
111

    
112
CLEANSUFFIXES     = *.d *.o *~ *.ho *.map *.ver
113
DISTCLEANSUFFIXES = *.pc
114
LIBSUFFIXES       = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
115

    
116
-include $(wildcard $(DEPS))