Statistics
| Branch: | Revision:

ffmpeg / common.mak @ 50a334e4

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

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

    
19
ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
20

    
21
CPPFLAGS += -DHAVE_AV_CONFIG_H -I$(BUILD_ROOT_REL) -I$(SRC_PATH)
22
CFLAGS := $(OPTFLAGS)
23

    
24
%.o: %.c
25
	$(CC) $(CPPFLAGS) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
26

    
27
%.o: %.S
28
	$(AS) $(CPPFLAGS) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
29

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

    
33
%.d: %.c
34
	$(DEPEND_CMD) > $@
35

    
36
%.d: %.S
37
	$(DEPEND_CMD) > $@
38

    
39
%.d: %.cpp
40
	$(DEPEND_CMD) > $@
41

    
42
%.o: %.d
43

    
44
%$(EXESUF): %.c
45

    
46
SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
47
ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
48
$(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
49
endif
50

    
51
$(BUILD_ROOT_REL)/version.h: $(SRC_PATH_BARE)/version.sh config.mak
52
	$< $(SRC_PATH) $@ $(EXTRA_VERSION)
53

    
54
install: install-libs install-headers
55

    
56
uninstall: uninstall-libs uninstall-headers
57

    
58
.PHONY: all depend dep *clean install* uninstall* examples testprogs
59
endif
60

    
61
OBJS-$(HAVE_MMX) +=  $(MMX-OBJS-yes)
62

    
63
CFLAGS    += $(CFLAGS-yes)
64
OBJS      += $(OBJS-yes)
65
FFLIBS    := $(FFLIBS-yes) $(FFLIBS)
66
TESTPROGS += $(TESTPROGS-yes)
67

    
68
FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
69
FFLDFLAGS   := $(addprefix -L$(BUILD_ROOT)/lib,$(ALLFFLIBS)) $(LDFLAGS)
70

    
71
EXAMPLES  := $(addprefix $(SUBDIR),$(addsuffix -example$(EXESUF),$(EXAMPLES)))
72
OBJS      := $(addprefix $(SUBDIR),$(OBJS))
73
TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS)))
74

    
75
DEP_LIBS := $(foreach NAME,$(FFLIBS),$(BUILD_ROOT_REL)/lib$(NAME)/$($(BUILD_SHARED:yes=S)LIBNAME))
76

    
77
ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
78
checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
79

    
80
DEPS := $(OBJS:.o=.d)
81
depend dep: $(DEPS)
82

    
83
CLEANSUFFIXES     = *.o *~ *.ho *.map
84
DISTCLEANSUFFIXES = *.d *.pc
85
LIBSUFFIXES       = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
86

    
87
-include $(DEPS)