Statistics
| Branch: | Revision:

ffmpeg / common.mak @ 74afdc55

History | View | Annotate | Download (2.73 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 9e6165b5 Måns Rullgård
CFLAGS := -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
22 ad1d8710 Michael Niedermayer
          -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(OPTFLAGS)
23 8b2121e3 Måns Rullgård
24
%.o: %.c
25
	$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
26
27
%.o: %.S
28
	$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
29
30 e4d86a57 Måns Rullgård
%.ho: %.h
31
	$(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
32
33 caec74dd Måns Rullgård
%.d: %.c
34
	$(DEPEND_CMD) > $@
35
36
%.d: %.S
37
	$(DEPEND_CMD) > $@
38
39
%.d: %.cpp
40
	$(DEPEND_CMD) > $@
41
42 18c64005 Måns Rullgård
%.o: %.d
43
44 bf237413 Måns Rullgård
%$(EXESUF): %.c
45
46 9e6165b5 Måns Rullgård
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 f2f35d33 Måns Rullgård
$(BUILD_ROOT_REL)/version.h: $(SRC_PATH_BARE)/version.sh
52 1db2c5c9 Diego Biurrun
	$< $(SRC_PATH) $@ $(EXTRA_VERSION)
53 9e6165b5 Måns Rullgård
54 71c61f62 Måns Rullgård
install: install-libs install-headers
55 7716f7ff Diego Biurrun
56 71c61f62 Måns Rullgård
uninstall: uninstall-libs uninstall-headers
57 8b2121e3 Måns Rullgård
58 71c61f62 Måns Rullgård
.PHONY: all depend dep clean distclean install* uninstall* tests
59
endif
60 8b2121e3 Måns Rullgård
61 71c61f62 Måns Rullgård
CFLAGS   += $(CFLAGS-yes)
62
OBJS     += $(OBJS-yes)
63
FFLIBS   := $(FFLIBS-yes) $(FFLIBS)
64 dbe6c6ff Måns Rullgård
TESTS    += $(TESTS-yes)
65 8b2121e3 Måns Rullgård
66 71c61f62 Måns Rullgård
FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
67
FFLDFLAGS   := $(addprefix -L$(BUILD_ROOT)/lib,$(FFLIBS)) $(LDFLAGS)
68 8b2121e3 Måns Rullgård
69 71c61f62 Måns Rullgård
OBJS  := $(addprefix $(SUBDIR),$(OBJS))
70
TESTS := $(addprefix $(SUBDIR),$(TESTS))
71 8b2121e3 Måns Rullgård
72 76ca42a8 Måns Rullgård
DEP_LIBS:=$(foreach NAME,$(FFLIBS),lib$(NAME)/$($(BUILD_SHARED:yes=S)LIBNAME))
73
74 7b5e8a27 Diego Biurrun
ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
75 71c61f62 Måns Rullgård
checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
76 8b2121e3 Måns Rullgård
77 caec74dd Måns Rullgård
DEPS := $(OBJS:.o=.d)
78
depend dep: $(DEPS)
79 8b2121e3 Måns Rullgård
80 0147b92e Måns Rullgård
CLEANSUFFIXES = *.o *~ *.ho
81 d4210e2a Diego Biurrun
LIBSUFFIXES   = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp *.map
82 25cd5cb3 Diego Biurrun
DISTCLEANSUFFIXES = *.d *.pc
83 76a448ed Måns Rullgård
84 71c61f62 Måns Rullgård
define RULES
85 b153c68b Måns Rullgård
$(SUBDIR)%$(EXESUF): $(SUBDIR)%.o
86
	$(CC) $(FFLDFLAGS) -o $$@ $$^ $(SUBDIR)$(LIBNAME) $(FFEXTRALIBS)
87 8b2121e3 Måns Rullgård
88 b153c68b Måns Rullgård
$(SUBDIR)%-test.o: $(SUBDIR)%.c
89
	$(CC) $(CFLAGS) -DTEST -c -o $$@ $$^
90
91
$(SUBDIR)%-test.o: $(SUBDIR)%-test.c
92
	$(CC) $(CFLAGS) -DTEST -c -o $$@ $$^
93 f9edb717 Diego Biurrun
94 a6493a8f Diego Biurrun
$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
95 304d586d Loren Merritt
	$(YASM) $(YASMFLAGS) -I $$(<D)/ -o $$@ $$<
96
97 a6493a8f Diego Biurrun
$(SUBDIR)x86/%.d: $(SUBDIR)x86/%.asm
98 304d586d Loren Merritt
	$(YASM) $(YASMFLAGS) -I $$(<D)/ -M -o $$(@:%.d=%.o) $$< > $$@
99
100 71c61f62 Måns Rullgård
clean::
101 adc39350 Diego Biurrun
	rm -f $(TESTS) $(addprefix $(SUBDIR),$(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
102
	    $(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
103 f9edb717 Diego Biurrun
104 71c61f62 Måns Rullgård
distclean:: clean
105 95d2afec Diego Biurrun
	rm -f  $(addprefix $(SUBDIR),$(DISTCLEANSUFFIXES)) \
106
            $(addprefix $(SUBDIR), $(foreach suffix,$(DISTCLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
107 71c61f62 Måns Rullgård
endef
108 bca9e0bc Diego Biurrun
109 71c61f62 Måns Rullgård
$(eval $(RULES))
110 bca9e0bc Diego Biurrun
111 71c61f62 Måns Rullgård
tests: $(TESTS)
112 3263626f Diego Biurrun
113 488b1ca4 Michael Niedermayer
-include $(DEPS)