Statistics
| Branch: | Revision:

ffmpeg / common.mak @ 8be0a5c3

History | View | Annotate | Download (2.46 KB)

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

    
5
all: # make "all" default target
6

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

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

    
20
ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
21

    
22
CPPFLAGS := -DHAVE_AV_CONFIG_H -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(CPPFLAGS)
23
CFLAGS   += $(ECFLAGS)
24

    
25
%.o: %.c
26
	$(CCDEP)
27
	$(CC) $(CPPFLAGS) $(CFLAGS) $(CC_DEPFLAGS) -c $(CC_O) $<
28

    
29
%.o: %.S
30
	$(ASDEP)
31
	$(AS) $(CPPFLAGS) $(ASFLAGS) $(AS_DEPFLAGS) -c -o $@ $<
32

    
33
%.ho: %.h
34
	$(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
35

    
36
%$(EXESUF): %.c
37

    
38
%.ver: %.v
39
	sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
40

    
41
SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
42
ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
43
$(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
44
endif
45

    
46
$(BUILD_ROOT_REL)/version.h: $(SRC_PATH_BARE)/version.sh config.mak
47
	$< $(SRC_PATH) $@ $(EXTRA_VERSION)
48

    
49
install: install-libs install-headers
50

    
51
uninstall: uninstall-libs uninstall-headers
52

    
53
.PHONY: all depend dep *clean install* uninstall* examples testprogs
54
endif
55

    
56
OBJS-$(HAVE_MMX) +=  $(MMX-OBJS-yes)
57

    
58
CFLAGS    += $(CFLAGS-yes)
59
OBJS      += $(OBJS-yes)
60
FFLIBS    := $(FFLIBS-yes) $(FFLIBS)
61
TESTPROGS += $(TESTPROGS-yes)
62

    
63
FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
64
FFLDFLAGS   := $(addprefix -L$(BUILD_ROOT)/lib,$(ALLFFLIBS)) $(LDFLAGS)
65

    
66
EXAMPLES  := $(addprefix $(SUBDIR),$(addsuffix -example$(EXESUF),$(EXAMPLES)))
67
OBJS      := $(addprefix $(SUBDIR),$(OBJS))
68
TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS)))
69
HOSTOBJS  := $(addprefix $(SUBDIR),$(addsuffix .o,$(HOSTPROGS)))
70
HOSTPROGS := $(addprefix $(SUBDIR),$(addsuffix $(HOSTEXESUF),$(HOSTPROGS)))
71

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

    
74
ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
75
SKIPHEADERS = $(addprefix $(SUBDIR),$(SKIPHEADERS-))
76
checkheaders: $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho))
77

    
78
$(HOSTOBJS): %.o: %.c
79
	$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
80

    
81
$(HOSTPROGS): %$(HOSTEXESUF): %.o
82
	$(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
83

    
84
DEPS := $(OBJS:.o=.d)
85
depend dep: $(DEPS)
86

    
87
CLEANSUFFIXES     = *.d *.o *~ *.ho *.map *.ver
88
DISTCLEANSUFFIXES = *.pc
89
LIBSUFFIXES       = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
90

    
91
-include $(wildcard $(DEPS))