Statistics
| Branch: | Revision:

ffmpeg / common.mak @ 487fef2d

History | View | Annotate | Download (3.12 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 de5aba8c Måns Rullgård
BRIEF  = CC AS YASM AR LD HOSTCC STRIP CP
25
SILENT = DEPCC YASMDEP RM RANLIB
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 bf9aa44b Måns Rullgård
    $(eval override $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))
30
$(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR))))
31 63611f31 Måns Rullgård
$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL))
32
endif
33
34 737eb597 Reinhard Tartler
ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
35 5671fc14 Måns Rullgård
36 7f02d357 Måns Rullgård
IFLAGS   := -I$(BUILD_ROOT_REL) -I$(SRC_PATH)
37
CPPFLAGS := $(IFLAGS) $(CPPFLAGS)
38 8be0a5c3 Måns Rullgård
CFLAGS   += $(ECFLAGS)
39 55127e7b Måns Rullgård
YASMFLAGS += $(IFLAGS) -Pconfig.asm
40 8b2121e3 Måns Rullgård
41 7f02d357 Måns Rullgård
HOSTCFLAGS += $(IFLAGS)
42
43 8b2121e3 Måns Rullgård
%.o: %.c
44 07dec06e Måns Rullgård
	$(CCDEP)
45 bce7b696 Måns Rullgård
	$(CC) $(CPPFLAGS) $(CFLAGS) $(CC_DEPFLAGS) -c $(CC_O) $<
46 8b2121e3 Måns Rullgård
47
%.o: %.S
48 07dec06e Måns Rullgård
	$(ASDEP)
49 bce7b696 Måns Rullgård
	$(AS) $(CPPFLAGS) $(ASFLAGS) $(AS_DEPFLAGS) -c -o $@ $<
50 8b2121e3 Måns Rullgård
51 e4d86a57 Måns Rullgård
%.ho: %.h
52 bce7b696 Måns Rullgård
	$(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
53 e4d86a57 Måns Rullgård
54 bf237413 Måns Rullgård
%$(EXESUF): %.c
55
56 a482e61b Måns Rullgård
%.ver: %.v
57 63611f31 Måns Rullgård
	$(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
58 a482e61b Måns Rullgård
59 7732f641 Måns Rullgård
%.c %.h: TAG = GEN
60 93bff1de Måns Rullgård
61 11d788ca Måns Rullgård
# Dummy rule to stop make trying to rebuild removed or renamed headers
62
%.h:
63
	@:
64
65 71c61f62 Måns Rullgård
install: install-libs install-headers
66 451db983 Måns Rullgård
install-libs: install-libs-yes
67 7716f7ff Diego Biurrun
68 d3cb93b3 Ramiro Polla
uninstall: uninstall-libs uninstall-headers
69
70
.PHONY: all depend dep *clean install* uninstall* examples testprogs
71 f3a572ca Måns Rullgård
72
# Disable suffix rules.  Most of the builtin rules are suffix rules,
73
# so this saves some time on slow systems.
74
.SUFFIXES:
75 1d536203 Måns Rullgård
76
# Do not delete intermediate files from chains of implicit rules
77 0680c40a Måns Rullgård
$(OBJS):
78 71c61f62 Måns Rullgård
endif
79 8b2121e3 Måns Rullgård
80 c5662879 Diego Biurrun
OBJS-$(HAVE_MMX) +=  $(MMX-OBJS-yes)
81
82 8be0a5c3 Måns Rullgård
CFLAGS    += $(CFLAGS-yes)
83 6ccf540f Diego Biurrun
OBJS      += $(OBJS-yes)
84
FFLIBS    := $(FFLIBS-yes) $(FFLIBS)
85
TESTPROGS += $(TESTPROGS-yes)
86 8b2121e3 Måns Rullgård
87 71c61f62 Måns Rullgård
FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
88 bdc2cc16 Måns Rullgård
FFLDFLAGS   := $(addprefix -L$(BUILD_ROOT)/lib,$(ALLFFLIBS)) $(LDFLAGS)
89 8b2121e3 Måns Rullgård
90 43a0cb7c Diego Biurrun
EXAMPLES  := $(addprefix $(SUBDIR),$(addsuffix -example$(EXESUF),$(EXAMPLES)))
91 7acc0104 Måns Rullgård
OBJS      := $(addprefix $(SUBDIR),$(sort $(OBJS)))
92 2a5500b1 Måns Rullgård
TESTOBJS  := $(addprefix $(SUBDIR),$(TESTOBJS))
93 7304c2c4 Diego Biurrun
TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS)))
94 de4070b5 Måns Rullgård
HOSTOBJS  := $(addprefix $(SUBDIR),$(addsuffix .o,$(HOSTPROGS)))
95
HOSTPROGS := $(addprefix $(SUBDIR),$(addsuffix $(HOSTEXESUF),$(HOSTPROGS)))
96 8b2121e3 Måns Rullgård
97 bea81a52 Måns Rullgård
DEP_LIBS := $(foreach NAME,$(FFLIBS),$(BUILD_ROOT_REL)/lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
98 76ca42a8 Måns Rullgård
99 7b5e8a27 Diego Biurrun
ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
100 f89c1402 Måns Rullgård
SKIPHEADERS += $(addprefix $(ARCH)/,$(ARCH_HEADERS))
101 9b55e2e7 Måns Rullgård
SKIPHEADERS := $(addprefix $(SUBDIR),$(SKIPHEADERS-) $(SKIPHEADERS))
102 95f2c769 Måns Rullgård
checkheaders: $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho))
103 8b2121e3 Måns Rullgård
104 de4070b5 Måns Rullgård
$(HOSTOBJS): %.o: %.c
105
	$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
106
107
$(HOSTPROGS): %$(HOSTEXESUF): %.o
108
	$(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
109
110 a482e61b Måns Rullgård
CLEANSUFFIXES     = *.d *.o *~ *.ho *.map *.ver
111 79de9c83 Måns Rullgård
DISTCLEANSUFFIXES = *.pc
112 8e8a67fa Dave Yeo
LIBSUFFIXES       = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
113 76a448ed Måns Rullgård
114 6fa5a91b Diego Biurrun
-include $(wildcard $(OBJS:.o=.d))