Statistics
| Branch: | Revision:

ffmpeg / common.mak @ c07c6f81

History | View | Annotate | Download (2.98 KB)

1 8b2121e3 Måns Rullgård
#
2
# common bits used by all libraries
3
#
4
5 451db983 Måns Rullgård
# first so "all" becomes default target
6
all: all-yes
7 0e32c8c6 Måns Rullgård
8 8e255b8b Måns Rullgård
ifndef SUBDIR
9 6ccf540f Diego Biurrun
vpath %.c   $(SRC_DIR)
10
vpath %.h   $(SRC_DIR)
11
vpath %.S   $(SRC_DIR)
12 304d586d Loren Merritt
vpath %.asm $(SRC_DIR)
13 a482e61b Måns Rullgård
vpath %.v   $(SRC_DIR)
14 8b2121e3 Måns Rullgård
15 9e6165b5 Måns Rullgård
ifeq ($(SRC_DIR),$(SRC_PATH_BARE))
16
BUILD_ROOT_REL = .
17
else
18
BUILD_ROOT_REL = ..
19
endif
20
21 63611f31 Måns Rullgård
ifndef V
22
Q      = @
23
ECHO   = printf "$(1)\t%s\n" $(2)
24
BRIEF  = CC AS YASM AR LD HOSTCC RANLIB STRIP CP
25 a0ac9501 Måns Rullgård
SILENT = DEPCC YASMDEP RM
26 63611f31 Måns Rullgård
MSG    = $@
27 7732f641 Måns Rullgård
M      = @$(call ECHO,$(TAG),$@);
28 63611f31 Måns Rullgård
$(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 5671fc14 Måns Rullgård
ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
35
36 72c2bdeb Måns Rullgård
CPPFLAGS := -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(CPPFLAGS)
37 8be0a5c3 Måns Rullgård
CFLAGS   += $(ECFLAGS)
38 8b2121e3 Måns Rullgård
39
%.o: %.c
40 07dec06e Måns Rullgård
	$(CCDEP)
41 bce7b696 Måns Rullgård
	$(CC) $(CPPFLAGS) $(CFLAGS) $(CC_DEPFLAGS) -c $(CC_O) $<
42 8b2121e3 Måns Rullgård
43
%.o: %.S
44 07dec06e Måns Rullgård
	$(ASDEP)
45 bce7b696 Måns Rullgård
	$(AS) $(CPPFLAGS) $(ASFLAGS) $(AS_DEPFLAGS) -c -o $@ $<
46 8b2121e3 Måns Rullgård
47 e4d86a57 Måns Rullgård
%.ho: %.h
48 bce7b696 Måns Rullgård
	$(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
49 e4d86a57 Måns Rullgård
50 bf237413 Måns Rullgård
%$(EXESUF): %.c
51
52 a482e61b Måns Rullgård
%.ver: %.v
53 63611f31 Måns Rullgård
	$(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
54 a482e61b Måns Rullgård
55 7732f641 Måns Rullgård
%.c %.h: TAG = GEN
56 93bff1de Måns Rullgård
57 71c61f62 Måns Rullgård
install: install-libs install-headers
58 451db983 Måns Rullgård
install-libs: install-libs-yes
59 7716f7ff Diego Biurrun
60 d3cb93b3 Ramiro Polla
uninstall: uninstall-libs uninstall-headers
61
62
.PHONY: all depend dep *clean install* uninstall* examples testprogs
63 f3a572ca Måns Rullgård
64
# Disable suffix rules.  Most of the builtin rules are suffix rules,
65
# so this saves some time on slow systems.
66
.SUFFIXES:
67 1d536203 Måns Rullgård
68
# Do not delete intermediate files from chains of implicit rules
69 0680c40a Måns Rullgård
$(OBJS):
70 71c61f62 Måns Rullgård
endif
71 8b2121e3 Måns Rullgård
72 c5662879 Diego Biurrun
OBJS-$(HAVE_MMX) +=  $(MMX-OBJS-yes)
73
74 8be0a5c3 Måns Rullgård
CFLAGS    += $(CFLAGS-yes)
75 6ccf540f Diego Biurrun
OBJS      += $(OBJS-yes)
76
FFLIBS    := $(FFLIBS-yes) $(FFLIBS)
77
TESTPROGS += $(TESTPROGS-yes)
78 8b2121e3 Måns Rullgård
79 71c61f62 Måns Rullgård
FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
80 bdc2cc16 Måns Rullgård
FFLDFLAGS   := $(addprefix -L$(BUILD_ROOT)/lib,$(ALLFFLIBS)) $(LDFLAGS)
81 8b2121e3 Måns Rullgård
82 43a0cb7c Diego Biurrun
EXAMPLES  := $(addprefix $(SUBDIR),$(addsuffix -example$(EXESUF),$(EXAMPLES)))
83 7acc0104 Måns Rullgård
OBJS      := $(addprefix $(SUBDIR),$(sort $(OBJS)))
84 2a5500b1 Måns Rullgård
TESTOBJS  := $(addprefix $(SUBDIR),$(TESTOBJS))
85 7304c2c4 Diego Biurrun
TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS)))
86 de4070b5 Måns Rullgård
HOSTOBJS  := $(addprefix $(SUBDIR),$(addsuffix .o,$(HOSTPROGS)))
87
HOSTPROGS := $(addprefix $(SUBDIR),$(addsuffix $(HOSTEXESUF),$(HOSTPROGS)))
88 8b2121e3 Måns Rullgård
89 bea81a52 Måns Rullgård
DEP_LIBS := $(foreach NAME,$(FFLIBS),$(BUILD_ROOT_REL)/lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
90 76ca42a8 Måns Rullgård
91 7b5e8a27 Diego Biurrun
ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
92 f89c1402 Måns Rullgård
SKIPHEADERS += $(addprefix $(ARCH)/,$(ARCH_HEADERS))
93 9b55e2e7 Måns Rullgård
SKIPHEADERS := $(addprefix $(SUBDIR),$(SKIPHEADERS-) $(SKIPHEADERS))
94 95f2c769 Måns Rullgård
checkheaders: $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho))
95 8b2121e3 Måns Rullgård
96 de4070b5 Måns Rullgård
$(HOSTOBJS): %.o: %.c
97
	$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
98
99
$(HOSTPROGS): %$(HOSTEXESUF): %.o
100
	$(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
101
102 caec74dd Måns Rullgård
DEPS := $(OBJS:.o=.d)
103
depend dep: $(DEPS)
104 8b2121e3 Måns Rullgård
105 a482e61b Måns Rullgård
CLEANSUFFIXES     = *.d *.o *~ *.ho *.map *.ver
106 79de9c83 Måns Rullgård
DISTCLEANSUFFIXES = *.pc
107 8e8a67fa Dave Yeo
LIBSUFFIXES       = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
108 76a448ed Måns Rullgård
109 c1c3933a Måns Rullgård
-include $(wildcard $(DEPS))