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