Statistics
| Branch: | Revision:

ffmpeg / common.mak @ 6fa5a91b

History | View | Annotate | Download (3.09 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 STRIP CP
25
SILENT = DEPCC YASMDEP RM RANLIB
26
MSG    = $@
27
M      = @$(call ECHO,$(TAG),$@);
28
$(foreach VAR,$(BRIEF), \
29
    $(eval override $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))
30
$(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR))))
31
$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL))
32
endif
33

    
34
ALLFFLIBS = avcodec avcore avdevice avfilter avformat avutil postproc swscale
35

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

    
40
HOSTCFLAGS += $(IFLAGS)
41

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

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

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

    
53
%$(EXESUF): %.c
54

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

    
58
%.c %.h: TAG = GEN
59

    
60
# Dummy rule to stop make trying to rebuild removed or renamed headers
61
%.h:
62
	@:
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
$(OBJS):
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
CLEANSUFFIXES     = *.d *.o *~ *.ho *.map *.ver
110
DISTCLEANSUFFIXES = *.pc
111
LIBSUFFIXES       = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
112

    
113
-include $(wildcard $(OBJS:.o=.d))