Merge branch 'master' of git://repo.or.cz/mplayer into mob
[mplayer/glamo.git] / common.mak
blob35f7a0adef92384de24b835b4410ad14d2693936
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) -I$(SRC_PATH)/ffmpeg $(OPTFLAGS)
23 %.o: %.c
24 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ -MD -MP -MF $*.d $<
26 %.o: %.S
27 $(AS) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ -MD -MP -MF $*.d $<
29 %.ho: %.h
30 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
32 %$(EXESUF): %.c
34 SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
35 ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
36 $(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
37 endif
39 $(BUILD_ROOT_REL)/version.h: $(SRC_PATH_BARE)/version.sh config.mak
40 $< $(SRC_PATH) $@ $(EXTRA_VERSION)
42 install: install-libs install-headers
44 uninstall: uninstall-libs uninstall-headers
46 .PHONY: all depend dep *clean install* uninstall* examples testprogs
47 endif
49 OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes)
51 CFLAGS += $(CFLAGS-yes)
52 OBJS += $(OBJS-yes)
53 FFLIBS := $(FFLIBS-yes) $(FFLIBS)
54 TESTPROGS += $(TESTPROGS-yes)
56 FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
57 FFLDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(ALLFFLIBS)) $(LDFLAGS)
59 EXAMPLES := $(addprefix $(SUBDIR),$(addsuffix -example$(EXESUF),$(EXAMPLES)))
60 OBJS := $(addprefix $(SUBDIR),$(OBJS))
61 TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS)))
63 DEP_LIBS := $(foreach NAME,$(FFLIBS),lib$(NAME)/$($(BUILD_SHARED:yes=S)LIBNAME))
65 ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
66 checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
68 DEPS := $(OBJS:.o=.d)
69 depend dep: $(DEPS)
71 CLEANSUFFIXES = *.o *~ *.ho
72 DISTCLEANSUFFIXES = *.d *.pc
73 LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp *.map
75 -include $(DEPS)