replace printf by av_log
[libav.git] / common.mak
CommitLineData
8b2121e3
MR
1#
2# common bits used by all libraries
3#
4
71c61f62 5all: # make "all" default target
0e32c8c6 6
8e255b8b 7ifndef SUBDIR
c415857d
MR
8vpath %.c $(SRC_DIR)
9vpath %.h $(SRC_DIR)
10vpath %.S $(SRC_DIR)
8b2121e3 11
5671fc14
MR
12ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
13
71c61f62 14CFLAGS = -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
9b3cdc2e 15 -D_ISOC9X_SOURCE -I$(BUILD_ROOT) -I$(SRC_PATH) $(OPTFLAGS)
8b2121e3
MR
16
17%.o: %.c
18 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
19
20%.o: %.S
21 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
22
e4d86a57
MR
23%.ho: %.h
24 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
25
caec74dd
MR
26%.d: %.c
27 $(DEPEND_CMD) > $@
28
29%.d: %.S
30 $(DEPEND_CMD) > $@
31
32%.d: %.cpp
33 $(DEPEND_CMD) > $@
34
3f28da61
JK
35%.rco: %.rc
36 windres -I$(BUILD_ROOT) $< $@
37
bf237413
MR
38%$(EXESUF): %.c
39
71c61f62 40install: install-libs install-headers
7716f7ff 41
71c61f62 42uninstall: uninstall-libs uninstall-headers
8b2121e3 43
71c61f62
MR
44.PHONY: all depend dep clean distclean install* uninstall* tests
45endif
8b2121e3 46
71c61f62
MR
47CFLAGS += $(CFLAGS-yes)
48OBJS += $(OBJS-yes)
49ASM_OBJS += $(ASM_OBJS-yes)
50CPP_OBJS += $(CPP_OBJS-yes)
51FFLIBS := $(FFLIBS-yes) $(FFLIBS)
dbe6c6ff 52TESTS += $(TESTS-yes)
8b2121e3 53
71c61f62
MR
54FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
55FFLDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(FFLIBS)) $(LDFLAGS)
8b2121e3 56
71c61f62
MR
57SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPP_OBJS:.o=.cpp)
58OBJS := $(OBJS) $(ASM_OBJS) $(CPP_OBJS)
8b2121e3 59
71c61f62
MR
60SRCS := $(addprefix $(SUBDIR),$(SRCS))
61OBJS := $(addprefix $(SUBDIR),$(OBJS))
62TESTS := $(addprefix $(SUBDIR),$(TESTS))
8b2121e3 63
76ca42a8
MR
64DEP_LIBS:=$(foreach NAME,$(FFLIBS),lib$(NAME)/$($(BUILD_SHARED:yes=S)LIBNAME))
65
71c61f62
MR
66ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h))
67checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
8b2121e3 68
caec74dd
MR
69DEPS := $(OBJS:.o=.d)
70depend dep: $(DEPS)
8b2121e3 71
3f28da61 72CLEANSUFFIXES = *.o *~ *.ho *.rco
d4210e2a 73LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp *.map
3f28da61 74DISTCLEANSUFFIXES = *.d *.rc
76a448ed 75
71c61f62 76define RULES
b153c68b
MR
77$(SUBDIR)%$(EXESUF): $(SUBDIR)%.o
78 $(CC) $(FFLDFLAGS) -o $$@ $$^ $(SUBDIR)$(LIBNAME) $(FFEXTRALIBS)
8b2121e3 79
b153c68b
MR
80$(SUBDIR)%-test.o: $(SUBDIR)%.c
81 $(CC) $(CFLAGS) -DTEST -c -o $$@ $$^
82
83$(SUBDIR)%-test.o: $(SUBDIR)%-test.c
84 $(CC) $(CFLAGS) -DTEST -c -o $$@ $$^
f9edb717 85
71c61f62 86clean::
adc39350
DB
87 rm -f $(TESTS) $(addprefix $(SUBDIR),$(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
88 $(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
f9edb717 89
71c61f62 90distclean:: clean
95d2afec
DB
91 rm -f $(addprefix $(SUBDIR),$(DISTCLEANSUFFIXES)) \
92 $(addprefix $(SUBDIR), $(foreach suffix,$(DISTCLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
71c61f62 93endef
bca9e0bc 94
71c61f62 95$(eval $(RULES))
bca9e0bc 96
71c61f62 97tests: $(TESTS)
3263626f 98
caec74dd 99-include $(DEPS)