Statistics
| Branch: | Revision:

ffmpeg / common.mak @ 604b2f52

History | View | Annotate | Download (2.45 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

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

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

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

    
35
%$(EXESUF): %.c
36

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

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

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

    
48
install: install-libs install-headers
49

    
50
uninstall: uninstall-libs uninstall-headers
51

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

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

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

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

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

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

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

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

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

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

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

    
90
-include $(wildcard $(DEPS))