Statistics
| Branch: | Revision:

ffmpeg / common.mak @ c5efef7b

History | View | Annotate | Download (2.68 KB)

1 8b2121e3 Måns Rullgård
#
2
# common bits used by all libraries
3
#
4
5 71c61f62 Måns Rullgård
all: # make "all" default target
6 0e32c8c6 Måns Rullgård
7 8e255b8b Måns Rullgård
ifndef SUBDIR
8 c415857d Måns Rullgård
vpath %.c $(SRC_DIR)
9
vpath %.h $(SRC_DIR)
10
vpath %.S $(SRC_DIR)
11 304d586d Loren Merritt
vpath %.asm $(SRC_DIR)
12 8b2121e3 Måns Rullgård
13 9e6165b5 Måns Rullgård
ifeq ($(SRC_DIR),$(SRC_PATH_BARE))
14
BUILD_ROOT_REL = .
15
else
16
BUILD_ROOT_REL = ..
17
endif
18
19 5671fc14 Måns Rullgård
ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
20
21 9d821fc2 Diego Biurrun
CFLAGS := -DHAVE_AV_CONFIG_H -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(OPTFLAGS)
22 8b2121e3 Måns Rullgård
23
%.o: %.c
24
	$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
25
26
%.o: %.S
27 313c46a6 Måns Rullgård
	$(AS) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
28 8b2121e3 Måns Rullgård
29 e4d86a57 Måns Rullgård
%.ho: %.h
30
	$(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
31
32 caec74dd Måns Rullgård
%.d: %.c
33
	$(DEPEND_CMD) > $@
34
35
%.d: %.S
36
	$(DEPEND_CMD) > $@
37
38
%.d: %.cpp
39
	$(DEPEND_CMD) > $@
40
41 18c64005 Måns Rullgård
%.o: %.d
42
43 bf237413 Måns Rullgård
%$(EXESUF): %.c
44
45 9e6165b5 Måns Rullgård
SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
46
ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
47
$(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
48
endif
49
50 873b0923 Diego Biurrun
$(BUILD_ROOT_REL)/version.h: $(SRC_PATH_BARE)/version.sh config.mak
51 1db2c5c9 Diego Biurrun
	$< $(SRC_PATH) $@ $(EXTRA_VERSION)
52 9e6165b5 Måns Rullgård
53 71c61f62 Måns Rullgård
install: install-libs install-headers
54 7716f7ff Diego Biurrun
55 71c61f62 Måns Rullgård
uninstall: uninstall-libs uninstall-headers
56 8b2121e3 Måns Rullgård
57 0cc647cb Diego Biurrun
.PHONY: all depend dep *clean install* uninstall* tests
58 71c61f62 Måns Rullgård
endif
59 8b2121e3 Måns Rullgård
60 71c61f62 Måns Rullgård
CFLAGS   += $(CFLAGS-yes)
61
OBJS     += $(OBJS-yes)
62
FFLIBS   := $(FFLIBS-yes) $(FFLIBS)
63 dbe6c6ff Måns Rullgård
TESTS    += $(TESTS-yes)
64 8b2121e3 Måns Rullgård
65 71c61f62 Måns Rullgård
FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
66
FFLDFLAGS   := $(addprefix -L$(BUILD_ROOT)/lib,$(FFLIBS)) $(LDFLAGS)
67 8b2121e3 Måns Rullgård
68 71c61f62 Måns Rullgård
OBJS  := $(addprefix $(SUBDIR),$(OBJS))
69
TESTS := $(addprefix $(SUBDIR),$(TESTS))
70 8b2121e3 Måns Rullgård
71 76ca42a8 Måns Rullgård
DEP_LIBS:=$(foreach NAME,$(FFLIBS),lib$(NAME)/$($(BUILD_SHARED:yes=S)LIBNAME))
72
73 7b5e8a27 Diego Biurrun
ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
74 71c61f62 Måns Rullgård
checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
75 8b2121e3 Måns Rullgård
76 caec74dd Måns Rullgård
DEPS := $(OBJS:.o=.d)
77
depend dep: $(DEPS)
78 8b2121e3 Måns Rullgård
79 0147b92e Måns Rullgård
CLEANSUFFIXES = *.o *~ *.ho
80 d4210e2a Diego Biurrun
LIBSUFFIXES   = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp *.map
81 25cd5cb3 Diego Biurrun
DISTCLEANSUFFIXES = *.d *.pc
82 76a448ed Måns Rullgård
83 71c61f62 Måns Rullgård
define RULES
84 b153c68b Måns Rullgård
$(SUBDIR)%$(EXESUF): $(SUBDIR)%.o
85
	$(CC) $(FFLDFLAGS) -o $$@ $$^ $(SUBDIR)$(LIBNAME) $(FFEXTRALIBS)
86 8b2121e3 Måns Rullgård
87 b153c68b Måns Rullgård
$(SUBDIR)%-test.o: $(SUBDIR)%.c
88
	$(CC) $(CFLAGS) -DTEST -c -o $$@ $$^
89
90
$(SUBDIR)%-test.o: $(SUBDIR)%-test.c
91
	$(CC) $(CFLAGS) -DTEST -c -o $$@ $$^
92 f9edb717 Diego Biurrun
93 a6493a8f Diego Biurrun
$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
94 304d586d Loren Merritt
	$(YASM) $(YASMFLAGS) -I $$(<D)/ -o $$@ $$<
95
96 a6493a8f Diego Biurrun
$(SUBDIR)x86/%.d: $(SUBDIR)x86/%.asm
97 304d586d Loren Merritt
	$(YASM) $(YASMFLAGS) -I $$(<D)/ -M -o $$(@:%.d=%.o) $$< > $$@
98
99 71c61f62 Måns Rullgård
clean::
100 adc39350 Diego Biurrun
	rm -f $(TESTS) $(addprefix $(SUBDIR),$(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
101
	    $(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
102 f9edb717 Diego Biurrun
103 71c61f62 Måns Rullgård
distclean:: clean
104 95d2afec Diego Biurrun
	rm -f  $(addprefix $(SUBDIR),$(DISTCLEANSUFFIXES)) \
105
            $(addprefix $(SUBDIR), $(foreach suffix,$(DISTCLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
106 71c61f62 Måns Rullgård
endef
107 bca9e0bc Diego Biurrun
108 71c61f62 Måns Rullgård
$(eval $(RULES))
109 bca9e0bc Diego Biurrun
110 71c61f62 Måns Rullgård
tests: $(TESTS)
111 3263626f Diego Biurrun
112 488b1ca4 Michael Niedermayer
-include $(DEPS)