Simplify code in sws_getContext() which logs if the destination format
[ffmpeg.git] / subdir.mak
index 997f552..e0ac681 100644 (file)
@@ -5,7 +5,7 @@ include $(SUBDIR)../common.mak
 LIBVERSION := $(lib$(NAME)_VERSION)
 LIBMAJOR   := $(lib$(NAME)_VERSION_MAJOR)
 
-ifeq ($(BUILD_STATIC),yes)
+ifdef CONFIG_STATIC
 all: $(SUBDIR)$(LIBNAME)
 
 install-libs: install-lib$(NAME)-static
@@ -18,8 +18,32 @@ endif
 
 INCINSTDIR := $(INCDIR)/lib$(NAME)
 
+THIS_LIB := $(SUBDIR)$($(CONFIG_SHARED:yes=S)LIBNAME)
+
 define RULES
-ifdef BUILD_SHARED
+$(SUBDIR)%$(EXESUF): $(SUBDIR)%.o
+       $(LD) $(FFLDFLAGS) -o $$@ $$^ -l$(FULLNAME) $(FFEXTRALIBS) $$(ELIBS)
+
+$(SUBDIR)%-test.o: $(SUBDIR)%.c
+       $(CC) $(CPPFLAGS) $(CFLAGS) -DTEST -c -o $$@ $$^
+
+$(SUBDIR)%-test.o: $(SUBDIR)%-test.c
+       $(CC) $(CPPFLAGS) $(CFLAGS) -DTEST -c -o $$@ $$^
+
+$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
+       $(YASM) $(YASMFLAGS) -I $$(<D)/ -M -o $$@ $$< > $$(@:.o=.d)
+       $(YASM) $(YASMFLAGS) -I $$(<D)/ -o $$@ $$<
+
+clean::
+       rm -f $(addprefix $(SUBDIR),*-example$(EXESUF) *-test$(EXESUF) $(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
+           $(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS)))) \
+           $(HOSTOBJS) $(HOSTPROGS)
+
+distclean:: clean
+       rm -f  $(addprefix $(SUBDIR),$(DISTCLEANSUFFIXES)) \
+            $(addprefix $(SUBDIR), $(foreach suffix,$(DISTCLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
+
+ifdef CONFIG_SHARED
 all: $(SUBDIR)$(SLIBNAME)
 
 install-libs: install-lib$(NAME)-shared
@@ -27,9 +51,9 @@ install-libs: install-lib$(NAME)-shared
 $(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
        cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
 
-$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS)
+$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SUBDIR)lib$(NAME).ver
        $(SLIB_CREATE_DEF_CMD)
-       $(CC) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$(filter-out $(DEP_LIBS),$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
+       $(LD) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$(filter %.o,$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
        $(SLIB_EXTRA_CMD)
 
 ifdef SUBDIR
@@ -57,18 +81,11 @@ install-headers::
        install -d "$(LIBDIR)/pkgconfig"
        install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(INCINSTDIR)"
        install -m 644 $(BUILD_ROOT)/lib$(NAME)/lib$(NAME).pc "$(LIBDIR)/pkgconfig"
-
-uninstall-libs::
-       -rm -f "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
-              "$(SHLIBDIR)/$(SLIBNAME)"            \
-              "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
-       -$(SLIB_UNINSTALL_EXTRA_CMD)
-       -rm -f "$(LIBDIR)/$(LIBNAME)"
-
-uninstall-headers::
-       rm -f $(addprefix "$(INCINSTDIR)/",$(HEADERS))
-       rm -f "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
-       -rmdir "$(INCDIR)"
 endef
 
 $(eval $(RULES))
+
+$(EXAMPLES) $(TESTPROGS): $(THIS_LIB) $(DEP_LIBS)
+
+examples: $(EXAMPLES)
+testprogs: $(TESTPROGS)