2006-02-13 13:53:25 +01:00
|
|
|
#
|
|
|
|
# common bits used by all libraries
|
|
|
|
#
|
|
|
|
|
2008-04-07 23:16:31 +02:00
|
|
|
all: # make "all" default target
|
2008-03-07 20:27:17 +01:00
|
|
|
|
2008-04-08 00:17:47 +02:00
|
|
|
ifndef SUBDIR
|
2009-03-25 19:14:28 +01:00
|
|
|
vpath %.c $(SRC_DIR)
|
|
|
|
vpath %.h $(SRC_DIR)
|
|
|
|
vpath %.S $(SRC_DIR)
|
2008-08-12 01:53:31 +02:00
|
|
|
vpath %.asm $(SRC_DIR)
|
2006-02-13 13:53:25 +01:00
|
|
|
|
2008-06-19 18:57:38 +02:00
|
|
|
ifeq ($(SRC_DIR),$(SRC_PATH_BARE))
|
|
|
|
BUILD_ROOT_REL = .
|
|
|
|
else
|
|
|
|
BUILD_ROOT_REL = ..
|
|
|
|
endif
|
|
|
|
|
2008-03-06 21:44:44 +01:00
|
|
|
ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
|
|
|
|
|
2009-03-03 13:52:12 +01:00
|
|
|
CFLAGS := -DHAVE_AV_CONFIG_H -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(OPTFLAGS)
|
2006-02-13 13:53:25 +01:00
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
%.o: %.S
|
2009-03-05 22:20:01 +01:00
|
|
|
$(AS) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
|
2006-02-13 13:53:25 +01:00
|
|
|
|
2007-06-17 02:05:39 +02:00
|
|
|
%.ho: %.h
|
|
|
|
$(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
|
|
|
|
|
2008-04-09 22:48:17 +02:00
|
|
|
%.d: %.c
|
|
|
|
$(DEPEND_CMD) > $@
|
|
|
|
|
|
|
|
%.d: %.S
|
|
|
|
$(DEPEND_CMD) > $@
|
|
|
|
|
|
|
|
%.d: %.cpp
|
|
|
|
$(DEPEND_CMD) > $@
|
|
|
|
|
2008-07-09 21:09:50 +02:00
|
|
|
%.o: %.d
|
|
|
|
|
2008-04-18 21:28:40 +02:00
|
|
|
%$(EXESUF): %.c
|
|
|
|
|
2008-06-19 18:57:38 +02:00
|
|
|
SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
|
|
|
|
ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
|
|
|
|
$(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
|
|
|
|
endif
|
|
|
|
|
2009-03-02 10:33:57 +01:00
|
|
|
$(BUILD_ROOT_REL)/version.h: $(SRC_PATH_BARE)/version.sh config.mak
|
2009-01-26 10:10:04 +01:00
|
|
|
$< $(SRC_PATH) $@ $(EXTRA_VERSION)
|
2008-06-19 18:57:38 +02:00
|
|
|
|
2008-04-07 23:16:31 +02:00
|
|
|
install: install-libs install-headers
|
2008-03-26 10:39:12 +01:00
|
|
|
|
2008-04-07 23:16:31 +02:00
|
|
|
uninstall: uninstall-libs uninstall-headers
|
2006-02-13 13:53:25 +01:00
|
|
|
|
2009-03-23 00:13:21 +01:00
|
|
|
.PHONY: all depend dep *clean install* uninstall* examples testprogs
|
2008-04-07 23:16:31 +02:00
|
|
|
endif
|
2006-02-13 13:53:25 +01:00
|
|
|
|
2009-03-25 19:14:28 +01:00
|
|
|
CFLAGS += $(CFLAGS-yes)
|
|
|
|
OBJS += $(OBJS-yes)
|
|
|
|
FFLIBS := $(FFLIBS-yes) $(FFLIBS)
|
|
|
|
TESTPROGS += $(TESTPROGS-yes)
|
2006-02-13 13:53:25 +01:00
|
|
|
|
2008-04-07 23:16:31 +02:00
|
|
|
FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
|
|
|
|
FFLDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(FFLIBS)) $(LDFLAGS)
|
2006-02-13 13:53:25 +01:00
|
|
|
|
2009-03-25 19:14:28 +01:00
|
|
|
EXAMPLES := $(addprefix $(SUBDIR),$(EXAMPLES))
|
|
|
|
OBJS := $(addprefix $(SUBDIR),$(OBJS))
|
2009-03-25 19:19:20 +01:00
|
|
|
TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS)))
|
2006-02-13 13:53:25 +01:00
|
|
|
|
2009-03-25 19:14:28 +01:00
|
|
|
DEP_LIBS := $(foreach NAME,$(FFLIBS),lib$(NAME)/$($(BUILD_SHARED:yes=S)LIBNAME))
|
2008-04-09 23:11:39 +02:00
|
|
|
|
2009-01-11 23:48:07 +01:00
|
|
|
ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
|
2008-04-07 23:16:31 +02:00
|
|
|
checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
|
2006-02-13 13:53:25 +01:00
|
|
|
|
2008-04-09 22:48:17 +02:00
|
|
|
DEPS := $(OBJS:.o=.d)
|
|
|
|
depend dep: $(DEPS)
|
2006-02-13 13:53:25 +01:00
|
|
|
|
2009-03-25 19:14:28 +01:00
|
|
|
CLEANSUFFIXES = *.o *~ *.ho
|
2008-06-16 20:01:55 +02:00
|
|
|
DISTCLEANSUFFIXES = *.d *.pc
|
2009-03-25 19:14:28 +01:00
|
|
|
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp *.map
|
2008-02-25 10:22:11 +01:00
|
|
|
|
2008-04-07 23:16:31 +02:00
|
|
|
define RULES
|
2008-04-16 23:50:41 +02:00
|
|
|
$(SUBDIR)%$(EXESUF): $(SUBDIR)%.o
|
|
|
|
$(CC) $(FFLDFLAGS) -o $$@ $$^ $(SUBDIR)$(LIBNAME) $(FFEXTRALIBS)
|
2006-02-13 13:53:25 +01:00
|
|
|
|
2008-04-16 23:50:41 +02:00
|
|
|
$(SUBDIR)%-test.o: $(SUBDIR)%.c
|
|
|
|
$(CC) $(CFLAGS) -DTEST -c -o $$@ $$^
|
|
|
|
|
|
|
|
$(SUBDIR)%-test.o: $(SUBDIR)%-test.c
|
|
|
|
$(CC) $(CFLAGS) -DTEST -c -o $$@ $$^
|
2006-05-18 14:14:02 +02:00
|
|
|
|
2008-12-22 10:12:42 +01:00
|
|
|
$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
|
2008-08-12 01:53:31 +02:00
|
|
|
$(YASM) $(YASMFLAGS) -I $$(<D)/ -o $$@ $$<
|
|
|
|
|
2008-12-22 10:12:42 +01:00
|
|
|
$(SUBDIR)x86/%.d: $(SUBDIR)x86/%.asm
|
2008-08-12 01:53:31 +02:00
|
|
|
$(YASM) $(YASMFLAGS) -I $$(<D)/ -M -o $$(@:%.d=%.o) $$< > $$@
|
|
|
|
|
2008-04-07 23:16:31 +02:00
|
|
|
clean::
|
2009-03-26 11:12:21 +01:00
|
|
|
rm -f $(EXAMPLES) $(addprefix $(SUBDIR),*-test$(EXESUF) $(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
|
2008-04-13 12:09:47 +02:00
|
|
|
$(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
|
2006-05-18 14:14:02 +02:00
|
|
|
|
2008-04-07 23:16:31 +02:00
|
|
|
distclean:: clean
|
2008-04-13 12:23:38 +02:00
|
|
|
rm -f $(addprefix $(SUBDIR),$(DISTCLEANSUFFIXES)) \
|
|
|
|
$(addprefix $(SUBDIR), $(foreach suffix,$(DISTCLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
|
2008-04-07 23:16:31 +02:00
|
|
|
endef
|
2008-01-28 00:28:56 +01:00
|
|
|
|
2008-04-07 23:16:31 +02:00
|
|
|
$(eval $(RULES))
|
2008-01-28 00:28:56 +01:00
|
|
|
|
2009-03-22 23:33:41 +01:00
|
|
|
examples: $(EXAMPLES)
|
2009-03-23 00:13:21 +01:00
|
|
|
testprogs: $(TESTPROGS)
|
2006-10-03 19:42:17 +02:00
|
|
|
|
2008-08-13 20:20:54 +02:00
|
|
|
-include $(DEPS)
|