Add a missing check for a NULL return value.
[mplayer/glamo.git] / common.mak
blob23907af9f26b60b3360a2ea64400354c067e0b25
2 # common bits used by all libraries
5 all: # make "all" default target
7 ifndef SUBDIR
8 vpath %.c $(SRC_DIR)
9 vpath %.h $(SRC_DIR)
10 vpath %.S $(SRC_DIR)
11 vpath %.asm $(SRC_DIR)
13 ifeq ($(SRC_DIR),$(SRC_PATH_BARE))
14 BUILD_ROOT_REL = .
15 else
16 BUILD_ROOT_REL = ..
17 endif
19 ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
21 CFLAGS := -DHAVE_AV_CONFIG_H -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(OPTFLAGS)
23 %.o: %.c
24 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
26 %.o: %.S
27 $(AS) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
29 %.ho: %.h
30 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
32 %.d: %.c
33 $(DEPEND_CMD) > $@
35 %.d: %.S
36 $(DEPEND_CMD) > $@
38 %.d: %.cpp
39 $(DEPEND_CMD) > $@
41 %.o: %.d
43 %$(EXESUF): %.c
45 SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
46 ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
47 $(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
48 endif
50 $(BUILD_ROOT_REL)/version.h: $(SRC_PATH_BARE)/version.sh config.mak
51 $< $(SRC_PATH) $@ $(EXTRA_VERSION)
53 install: install-libs install-headers
55 uninstall: uninstall-libs uninstall-headers
57 .PHONY: all depend dep *clean install* uninstall* examples testprogs
58 endif
60 OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes)
62 CFLAGS += $(CFLAGS-yes)
63 OBJS += $(OBJS-yes)
64 FFLIBS := $(FFLIBS-yes) $(FFLIBS)
65 TESTPROGS += $(TESTPROGS-yes)
67 FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
68 FFLDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(ALLFFLIBS)) $(LDFLAGS)
70 EXAMPLES := $(addprefix $(SUBDIR),$(addsuffix -example$(EXESUF),$(EXAMPLES)))
71 OBJS := $(addprefix $(SUBDIR),$(OBJS))
72 TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS)))
74 DEP_LIBS := $(foreach NAME,$(FFLIBS),lib$(NAME)/$($(BUILD_SHARED:yes=S)LIBNAME))
76 ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
77 checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
79 DEPS := $(OBJS:.o=.d)
80 depend dep: $(DEPS)
82 CLEANSUFFIXES = *.o *~ *.ho
83 DISTCLEANSUFFIXES = *.d *.pc
84 LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp *.map
86 -include $(DEPS)