2006-02-14 21:42:49 +00:00
|
|
|
#
|
|
|
|
# common bits used by all libraries
|
|
|
|
#
|
|
|
|
|
2008-04-07 22:25:13 +00:00
|
|
|
all: # make "all" default target
|
2008-03-10 19:43:07 +00:00
|
|
|
|
2008-04-07 22:25:13 +00:00
|
|
|
ifeq ($(SUBDIR),)
|
2008-03-26 09:58:37 +00:00
|
|
|
vpath %.c $(SRC_DIR)
|
|
|
|
vpath %.h $(SRC_DIR)
|
|
|
|
vpath %.S $(SRC_DIR)
|
2008-03-07 00:22:09 +00:00
|
|
|
|
|
|
|
ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
|
2006-02-14 21:42:49 +00:00
|
|
|
|
2008-04-07 22:25:13 +00:00
|
|
|
CFLAGS = -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
|
|
|
|
-D_ISOC9X_SOURCE -I$(BUILD_ROOT) -I$(SRC_PATH) \
|
|
|
|
$(addprefix -I$(SRC_PATH)/lib,$(ALLFFLIBS)) $(OPTFLAGS)
|
2006-02-14 21:42:49 +00:00
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
%.o: %.S
|
|
|
|
$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
|
|
|
|
|
2007-10-18 10:09:24 +00:00
|
|
|
%.ho: %.h
|
|
|
|
$(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
|
|
|
|
|
2008-04-07 22:25:13 +00:00
|
|
|
install: install-libs install-headers
|
2008-03-26 09:58:37 +00:00
|
|
|
|
2008-04-07 22:25:13 +00:00
|
|
|
uninstall: uninstall-libs uninstall-headers
|
2006-02-14 21:42:49 +00:00
|
|
|
|
2008-04-07 22:25:13 +00:00
|
|
|
.PHONY: all depend dep clean distclean install* uninstall* tests
|
|
|
|
endif
|
2006-02-14 21:42:49 +00:00
|
|
|
|
2008-04-07 22:25:13 +00:00
|
|
|
CFLAGS += $(CFLAGS-yes)
|
|
|
|
OBJS += $(OBJS-yes)
|
|
|
|
ASM_OBJS += $(ASM_OBJS-yes)
|
|
|
|
CPP_OBJS += $(CPP_OBJS-yes)
|
|
|
|
FFLIBS := $(FFLIBS-yes) $(FFLIBS)
|
2006-02-14 21:42:49 +00:00
|
|
|
|
2008-04-07 22:25:13 +00:00
|
|
|
FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
|
|
|
|
FFLDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(FFLIBS)) $(LDFLAGS)
|
2006-02-14 21:42:49 +00:00
|
|
|
|
2008-04-07 22:25:13 +00:00
|
|
|
SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPP_OBJS:.o=.cpp)
|
|
|
|
OBJS := $(OBJS) $(ASM_OBJS) $(CPP_OBJS)
|
2006-02-14 21:42:49 +00:00
|
|
|
|
2008-04-07 22:25:13 +00:00
|
|
|
SRCS := $(addprefix $(SUBDIR),$(SRCS))
|
|
|
|
OBJS := $(addprefix $(SUBDIR),$(OBJS))
|
|
|
|
TESTS := $(addprefix $(SUBDIR),$(TESTS))
|
2006-02-14 21:42:49 +00:00
|
|
|
|
2008-04-07 22:25:13 +00:00
|
|
|
ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h))
|
|
|
|
checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
|
2006-02-14 21:42:49 +00:00
|
|
|
|
2008-04-07 22:25:13 +00:00
|
|
|
depend dep: $(SUBDIR).depend
|
2006-02-14 21:42:49 +00:00
|
|
|
|
2008-04-07 22:25:13 +00:00
|
|
|
CLEANFILES += *.o *~ *.a *.lib *.so *.so.* *.dylib *.dll \
|
|
|
|
*.def *.dll.a *.exp *.ho *.map
|
2008-03-07 00:22:09 +00:00
|
|
|
|
2008-04-07 22:25:13 +00:00
|
|
|
define RULES
|
|
|
|
$(SUBDIR)%: $(SUBDIR)%.o $(LIBNAME)
|
|
|
|
$(CC) $(FFLDFLAGS) -o $$@ $$^ $(FFEXTRALIBS)
|
2006-02-14 21:42:49 +00:00
|
|
|
|
2008-04-07 22:25:13 +00:00
|
|
|
$(SUBDIR)%-test$(EXESUF): $(SUBDIR)%.c $(LIBNAME)
|
|
|
|
$(CC) $(CFLAGS) $(FFLDFLAGS) -DTEST -o $$@ $$^ $(FFEXTRALIBS)
|
2006-07-11 22:44:05 +00:00
|
|
|
|
2008-04-07 22:25:13 +00:00
|
|
|
$(SUBDIR).depend: $(SRCS)
|
|
|
|
$(DEPEND_CMD) > $$@
|
2006-07-11 22:44:05 +00:00
|
|
|
|
2008-04-07 22:25:13 +00:00
|
|
|
clean::
|
|
|
|
rm -f $(TESTS) $(addprefix $(SUBDIR),$(CLEANFILES))
|
2006-07-11 22:44:05 +00:00
|
|
|
|
2008-04-07 22:25:13 +00:00
|
|
|
distclean:: clean
|
|
|
|
rm -f $(SUBDIR).depend
|
|
|
|
endef
|
2008-03-07 00:22:09 +00:00
|
|
|
|
2008-04-07 22:25:13 +00:00
|
|
|
$(eval $(RULES))
|
2008-03-07 00:22:09 +00:00
|
|
|
|
2008-04-07 22:25:13 +00:00
|
|
|
tests: $(TESTS)
|
2006-10-03 18:28:37 +00:00
|
|
|
|
2008-04-07 22:25:13 +00:00
|
|
|
-include $(SUBDIR).depend
|