Statistics
| Branch: | Revision:

ffmpeg / common.mak @ 6a53fffd

History | View | Annotate | Download (2.98 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
M      = @$(call ECHO,$(MSG),$@);
28
$(foreach VAR,$(BRIEF), \
29
    $(eval $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))
30
$(foreach VAR,$(SILENT),$(eval $(VAR) = @$($(VAR))))
31
$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL))
32
endif
33

    
34
ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
35

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

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

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

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

    
50
%$(EXESUF): %.c
51

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

    
55
%.c %.h: MSG = GEN
56

    
57
install: install-libs install-headers
58
install-libs: install-libs-yes
59

    
60
uninstall: uninstall-libs uninstall-headers
61

    
62
.PHONY: all depend dep *clean install* uninstall* examples testprogs
63

    
64
# Disable suffix rules.  Most of the builtin rules are suffix rules,
65
# so this saves some time on slow systems.
66
.SUFFIXES:
67

    
68
# Do not delete intermediate files from chains of implicit rules
69
.SECONDARY:
70
endif
71

    
72
OBJS-$(HAVE_MMX) +=  $(MMX-OBJS-yes)
73

    
74
CFLAGS    += $(CFLAGS-yes)
75
OBJS      += $(OBJS-yes)
76
FFLIBS    := $(FFLIBS-yes) $(FFLIBS)
77
TESTPROGS += $(TESTPROGS-yes)
78

    
79
FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
80
FFLDFLAGS   := $(addprefix -L$(BUILD_ROOT)/lib,$(ALLFFLIBS)) $(LDFLAGS)
81

    
82
EXAMPLES  := $(addprefix $(SUBDIR),$(addsuffix -example$(EXESUF),$(EXAMPLES)))
83
OBJS      := $(addprefix $(SUBDIR),$(sort $(OBJS)))
84
TESTOBJS  := $(addprefix $(SUBDIR),$(TESTOBJS))
85
TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS)))
86
HOSTOBJS  := $(addprefix $(SUBDIR),$(addsuffix .o,$(HOSTPROGS)))
87
HOSTPROGS := $(addprefix $(SUBDIR),$(addsuffix $(HOSTEXESUF),$(HOSTPROGS)))
88

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

    
91
ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
92
SKIPHEADERS += $(addprefix $(ARCH)/,$(ARCH_HEADERS))
93
SKIPHEADERS := $(addprefix $(SUBDIR),$(SKIPHEADERS-) $(SKIPHEADERS))
94
checkheaders: $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho))
95

    
96
$(HOSTOBJS): %.o: %.c
97
	$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
98

    
99
$(HOSTPROGS): %$(HOSTEXESUF): %.o
100
	$(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
101

    
102
DEPS := $(OBJS:.o=.d)
103
depend dep: $(DEPS)
104

    
105
CLEANSUFFIXES     = *.d *.o *~ *.ho *.map *.ver
106
DISTCLEANSUFFIXES = *.pc
107
LIBSUFFIXES       = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
108

    
109
-include $(wildcard $(DEPS))