[FFmpeg-cvslog] r12760 - in trunk: Makefile common.mak configure libavcodec/Makefile libavdevice/Makefile libavfilter/Makefile libavformat/Makefile libavutil/Makefile libpostproc/Makefile subdir.mak

mru subversion
Mon Apr 7 23:16:32 CEST 2008


Author: mru
Date: Mon Apr  7 23:16:31 2008
New Revision: 12760

Log:
non-recursive makefiles


Added:
   trunk/subdir.mak
      - copied, changed from r12759, /trunk/common.mak
Modified:
   trunk/Makefile
   trunk/common.mak
   trunk/configure
   trunk/libavcodec/Makefile
   trunk/libavdevice/Makefile
   trunk/libavfilter/Makefile
   trunk/libavformat/Makefile
   trunk/libavutil/Makefile
   trunk/libpostproc/Makefile

Modified: trunk/Makefile
==============================================================================
--- trunk/Makefile	(original)
+++ trunk/Makefile	Mon Apr  7 23:16:31 2008
@@ -6,8 +6,6 @@ include config.mak
 
 SRC_DIR = $(SRC_PATH_BARE)
 
-vpath %.c    $(SRC_PATH_BARE)
-vpath %.h    $(SRC_PATH_BARE)
 vpath %.texi $(SRC_PATH_BARE)
 
 PROGS-$(CONFIG_FFMPEG)   += ffmpeg
@@ -30,6 +28,14 @@ FFLIBS-$(CONFIG_SWSCALE)  += swscale
 
 FFLIBS := avdevice avformat avcodec avutil
 
+include common.mak
+
+FF_LDFLAGS   := $(FFLDFLAGS)
+FF_EXTRALIBS := $(FFEXTRALIBS)
+
+S := $(BUILD_SHARED:yes=S)
+DEP_LIBS := $(foreach L,$(FFLIBS),lib$(L)/$($(S)LIBPREF)$(L)$($(S)LIBSUF))
+
 ALL_TARGETS-$(CONFIG_VHOOK) += videohook
 ALL_TARGETS-$(BUILD_DOC)    += documentation
 
@@ -40,7 +46,7 @@ INSTALL_TARGETS-$(BUILD_DOC)    += insta
 endif
 INSTALL_PROGS_TARGETS-$(BUILD_SHARED) = install-libs
 
-main: lib $(PROGS) $(ALL_TARGETS-yes)
+all: $(DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
 
 $(PROGS): %$(EXESUF): %_g$(EXESUF)
 	cp -p $< $@
@@ -48,13 +54,20 @@ $(PROGS): %$(EXESUF): %_g$(EXESUF)
 
 .depend: version.h $(PROGS_SRCS)
 
-# bandaid to disable triggering shared library installation routines
-DISABLE=yes
+SUBDIR_VARS := OBJS ASM_OBJS CPP_OBJS FFLIBS CLEANFILES
 
-include common.mak
+define RESET
+$(1) :=
+$(1)-yes :=
+endef
 
-S := $(BUILD_SHARED:yes=S)
-DEP_LIBS := $(foreach L,$(FFLIBS),lib$(L)/$($(S)LIBPREF)$(L)$($(S)LIBSUF))
+define DOSUBDIR
+$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
+SUBDIR := $(1)/
+include $(1)/Makefile
+endef
+
+$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
 
 VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
 
@@ -78,23 +91,11 @@ VHOOKCFLAGS += $(VHOOKCFLAGS-yes)
 
 vhook/%.o: CFLAGS:=$(VHOOKCFLAGS)
 
-MAKE-yes = $(MAKE)
-MAKE-    = : $(MAKE)
-
-lib:
-	$(MAKE)                    -C libavutil   all
-	$(MAKE)                    -C libavcodec  all
-	$(MAKE)                    -C libavformat all
-	$(MAKE)                    -C libavdevice all
-	$(MAKE-$(CONFIG_POSTPROC)) -C libpostproc all
-	$(MAKE-$(CONFIG_SWSCALE))  -C libswscale  all
-	$(MAKE-$(CONFIG_AVFILTER)) -C libavfilter all
-
-ffplay_g$(EXESUF): EXTRALIBS += $(SDL_LIBS)
-ffserver_g$(EXESUF): LDFLAGS += $(FFSERVERLDFLAGS)
+ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
+ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
 
-%_g$(EXESUF): %.o cmdutils.o .libs
-	$(CC) $(LDFLAGS) -o $@ $< cmdutils.o $(EXTRALIBS)
+%_g$(EXESUF): %.o cmdutils.o $(DEP_LIBS)
+	$(CC) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
 
 SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
 ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
@@ -104,18 +105,18 @@ endif
 version.h:
 	$(SRC_PATH)/version.sh $(SRC_PATH)
 
-output_example$(EXESUF): output_example.o .libs
-	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(EXTRALIBS)
+output_example$(EXESUF): output_example.o $(DEP_LIBS)
+	$(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
 
 tools/%$(EXESUF): tools/%.c
-	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(EXTRALIBS)
+	$(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
 
 ffplay.o .depend: CFLAGS += $(SDL_CFLAGS)
 
 ffmpeg.o ffplay.o ffserver.o: version.h
 
 # vhooks compile fine without libav*, but need them nonetheless.
-videohook: .libs $(HOOKS)
+videohook: $(DEP_LIBS) $(HOOKS)
 
 vhook/%$(SLIBSUF): vhook/%.o
 	$(CC) $(LDFLAGS) -o $@ $(VHOOKSHFLAGS) $< $(VHOOKLIBS) $(LIBS_$(@F))
@@ -148,24 +149,6 @@ install-vhook: videohook
 	install -d "$(SHLIBDIR)/vhook"
 	install -m 755 $(HOOKS) "$(SHLIBDIR)/vhook"
 
-install-libs:
-	$(MAKE)                    -C libavutil   install-libs
-	$(MAKE)                    -C libavcodec  install-libs
-	$(MAKE)                    -C libavformat install-libs
-	$(MAKE)                    -C libavdevice install-libs
-	$(MAKE-$(CONFIG_POSTPROC)) -C libpostproc install-libs
-	$(MAKE-$(CONFIG_SWSCALE))  -C libswscale  install-libs
-	$(MAKE-$(CONFIG_AVFILTER)) -C libavfilter install-libs
-
-install-headers::
-	$(MAKE)                    -C libavutil   install-headers
-	$(MAKE)                    -C libavcodec  install-headers
-	$(MAKE)                    -C libavformat install-headers
-	$(MAKE)                    -C libavdevice install-headers
-	$(MAKE-$(CONFIG_POSTPROC)) -C libpostproc install-headers
-	$(MAKE)                    -C libswscale  install-headers
-	$(MAKE-$(CONFIG_AVFILTER)) -C libavfilter install-headers
-
 uninstall: uninstall-progs uninstall-man uninstall-vhook
 
 uninstall-progs:
@@ -178,51 +161,13 @@ uninstall-vhook:
 	rm -f $(addprefix "$(SHLIBDIR)/",$(ALLHOOKS_SRCS:.c=$(SLIBSUF)))
 	-rmdir "$(SHLIBDIR)/vhook/"
 
-uninstall-libs::
-	$(MAKE) -C libavutil   uninstall-libs
-	$(MAKE) -C libavcodec  uninstall-libs
-	$(MAKE) -C libavformat uninstall-libs
-	$(MAKE) -C libavdevice uninstall-libs
-	$(MAKE) -C libpostproc uninstall-libs
-	$(MAKE) -C libswscale  uninstall-libs
-	$(MAKE) -C libavfilter uninstall-libs
-
-uninstall-headers::
-	$(MAKE) -C libavutil   uninstall-headers
-	$(MAKE) -C libavcodec  uninstall-headers
-	$(MAKE) -C libavformat uninstall-headers
-	$(MAKE) -C libavdevice uninstall-headers
-	$(MAKE) -C libpostproc uninstall-headers
-	$(MAKE) -C libswscale  uninstall-headers
-	$(MAKE) -C libavfilter uninstall-headers
-	-rmdir "$(INCDIR)"
-
 depend dep: .vhookdep
-	$(MAKE)                    -C libavutil   depend
-	$(MAKE)                    -C libavcodec  depend
-	$(MAKE)                    -C libavformat depend
-	$(MAKE)                    -C libavdevice depend
-	$(MAKE-$(CONFIG_POSTPROC)) -C libpostproc depend
-	$(MAKE-$(CONFIG_SWSCALE))  -C libswscale  depend
-	$(MAKE-$(CONFIG_AVFILTER)) -C libavfilter depend
 
 .vhookdep: $(ALLHOOKS_SRCS) version.h
 	$(VHOOK_DEPEND_CMD) > $@
 
-$(DEP_LIBS): lib
-
-.libs: $(DEP_LIBS)
-	touch $@
-
 clean::
-	$(MAKE) -C libavutil   clean
-	$(MAKE) -C libavcodec  clean
-	$(MAKE) -C libavformat clean
-	$(MAKE) -C libavdevice clean
-	$(MAKE) -C libpostproc clean
-	$(MAKE) -C libswscale  clean
-	$(MAKE) -C libavfilter clean
-	rm -f .libs gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
+	rm -f gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
 	   output_example$(EXESUF)
 	rm -f doc/*.html doc/*.pod doc/*.1
 	rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
@@ -231,13 +176,6 @@ clean::
 	rm -f vhook/*.o vhook/*~ vhook/*.so vhook/*.dylib vhook/*.dll
 
 distclean::
-	$(MAKE) -C libavutil   distclean
-	$(MAKE) -C libavcodec  distclean
-	$(MAKE) -C libavformat distclean
-	$(MAKE) -C libavdevice distclean
-	$(MAKE) -C libpostproc distclean
-	$(MAKE) -C libswscale  distclean
-	$(MAKE) -C libavfilter distclean
 	rm -f .vhookdep version.h config.* *.pc
 
 # regression tests
@@ -404,10 +342,10 @@ tests/asynth1.sw: tests/audiogen$(EXESUF
 	$(BUILD_ROOT)/$< $@
 
 %$(EXESUF): %.c
-	$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $<
+	$(CC) $(FF_LDFLAGS) $(CFLAGS) -o $@ $<
 
-tests/seek_test$(EXESUF): tests/seek_test.c .libs
-	$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $< $(EXTRALIBS)
+tests/seek_test$(EXESUF): tests/seek_test.c $(DEP_LIBS)
+	$(CC) $(FF_LDFLAGS) $(CFLAGS) -o $@ $< $(FF_EXTRALIBS)
 
 
 .PHONY: lib videohook documentation TAGS

Modified: trunk/common.mak
==============================================================================
--- trunk/common.mak	(original)
+++ trunk/common.mak	Mon Apr  7 23:16:31 2008
@@ -2,47 +2,18 @@
 # common bits used by all libraries
 #
 
-SRC_DIR = $(SRC_PATH_BARE)/lib$(NAME)
-
-LIBVERSION = $(lib$(NAME)_VERSION)
-LIBMAJOR   = $(lib$(NAME)_VERSION_MAJOR)
+all: # make "all" default target
 
+ifeq ($(SUBDIR),)
 vpath %.c $(SRC_DIR)
 vpath %.h $(SRC_DIR)
 vpath %.S $(SRC_DIR)
 
 ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
 
-CFLAGS   += $(CFLAGS-yes)
-OBJS     += $(OBJS-yes)
-ASM_OBJS += $(ASM_OBJS-yes)
-CPP_OBJS += $(CPP_OBJS-yes)
-FFLIBS   += $(FFLIBS-yes)
-
-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)
-
-EXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
-LDFLAGS   := $(addprefix -L$(BUILD_ROOT)/lib,$(FFLIBS)) $(LDFLAGS)
-
-SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPP_OBJS:.o=.cpp)
-OBJS := $(OBJS) $(ASM_OBJS) $(CPP_OBJS)
-
-all: $(LIBNAME) $(SLIBNAME)
-
-$(LIBNAME)$(DISABLE): $(OBJS)
-	rm -f $@
-	$(AR) rc $@ $^ $(EXTRAOBJS)
-	$(RANLIB) $@
-
-$(SLIBNAME)$(DISABLE): $(SLIBNAME_WITH_MAJOR)
-	$(LN_S) $^ $@
-
-$(SLIBNAME_WITH_MAJOR): $(OBJS)
-	$(SLIB_CREATE_DEF_CMD)
-	$(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS)
-	$(SLIB_EXTRA_CMD)
+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)
 
 %.o: %.c
 	$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
@@ -50,75 +21,59 @@ $(SLIBNAME_WITH_MAJOR): $(OBJS)
 %.o: %.S
 	$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
 
-%: %.o $(LIBNAME)
-	$(CC) $(LDFLAGS) -o $@ $^ $(EXTRALIBS)
-
 %.ho: %.h
 	$(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
 
-ALLHEADERS = $(subst $(SRC_DIR)/,,$(wildcard $(SRC_DIR)/*.h))
-checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
-
-depend dep: .depend
+install: install-libs install-headers
 
-.depend: $(SRCS)
-	$(DEPEND_CMD) > .depend
+uninstall: uninstall-libs uninstall-headers
 
-clean::
-	rm -f *.o *~ *.a *.lib *.so *.so.* *.dylib *.dll \
-	      *.def *.dll.a *.exp *.ho *.map $(TESTS)
+.PHONY: all depend dep clean distclean install* uninstall* tests
+endif
 
-distclean:: clean
-	rm -f .depend
+CFLAGS   += $(CFLAGS-yes)
+OBJS     += $(OBJS-yes)
+ASM_OBJS += $(ASM_OBJS-yes)
+CPP_OBJS += $(CPP_OBJS-yes)
+FFLIBS   := $(FFLIBS-yes) $(FFLIBS)
 
-INSTALL_LIB_TARGETS-$(BUILD_SHARED) += install-lib-shared
-INSTALL_LIB_TARGETS-$(BUILD_STATIC) += install-lib-static
+FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
+FFLDFLAGS   := $(addprefix -L$(BUILD_ROOT)/lib,$(FFLIBS)) $(LDFLAGS)
 
-install: install-libs install-headers
+SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPP_OBJS:.o=.cpp)
+OBJS := $(OBJS) $(ASM_OBJS) $(CPP_OBJS)
 
-install-libs$(DISABLE): $(INSTALL_LIB_TARGETS-yes)
+SRCS  := $(addprefix $(SUBDIR),$(SRCS))
+OBJS  := $(addprefix $(SUBDIR),$(OBJS))
+TESTS := $(addprefix $(SUBDIR),$(TESTS))
 
-install-lib-shared: $(SLIBNAME)
-	install -d "$(SHLIBDIR)"
-	install -m 755 $(SLIBNAME) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
-	$(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
-	cd "$(SHLIBDIR)" && \
-		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
-	cd "$(SHLIBDIR)" && \
-		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
-	$(SLIB_INSTALL_EXTRA_CMD)
+ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h))
+checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
 
-install-lib-static: $(LIBNAME)
-	install -d "$(LIBDIR)"
-	install -m 644 $(LIBNAME) "$(LIBDIR)"
-	$(LIB_INSTALL_EXTRA_CMD)
+depend dep: $(SUBDIR).depend
 
-INCINSTDIR = $(INCDIR)/lib$(NAME)
+CLEANFILES += *.o *~ *.a *.lib *.so *.so.* *.dylib *.dll \
+              *.def *.dll.a *.exp *.ho *.map
 
-install-headers$(DISABLE)::
-	install -d "$(INCINSTDIR)"
-	install -d "$(LIBDIR)/pkgconfig"
-	install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(INCINSTDIR)"
-	install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(LIBDIR)/pkgconfig"
+define RULES
+$(SUBDIR)%: $(SUBDIR)%.o $(LIBNAME)
+	$(CC) $(FFLDFLAGS) -o $$@ $$^ $(FFEXTRALIBS)
 
-uninstall: uninstall-libs uninstall-headers
+$(SUBDIR)%-test$(EXESUF): $(SUBDIR)%.c $(LIBNAME)
+	$(CC) $(CFLAGS) $(FFLDFLAGS) -DTEST -o $$@ $$^ $(FFEXTRALIBS)
 
-uninstall-libs::
-	-rm -f "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
-	       "$(SHLIBDIR)/$(SLIBNAME)"            \
-	       "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
-	-$(SLIB_UNINSTALL_EXTRA_CMD)
-	-rm -f "$(LIBDIR)/$(LIBNAME)"
+$(SUBDIR).depend: $(SRCS)
+	$(DEPEND_CMD) > $$@
 
-uninstall-headers::
-	rm -f $(addprefix "$(INCINSTDIR)/",$(HEADERS))
-	rm -f "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
+clean::
+	rm -f $(TESTS) $(addprefix $(SUBDIR),$(CLEANFILES))
 
-tests: $(TESTS)
+distclean:: clean
+	rm -f $(SUBDIR).depend
+endef
 
-%-test$(EXESUF): %.c $(LIBNAME)
-	$(CC) $(CFLAGS) $(LDFLAGS) -DTEST -o $@ $^ $(EXTRALIBS)
+$(eval $(RULES))
 
-.PHONY: all depend dep clean distclean install* uninstall* tests
+tests: $(TESTS)
 
--include .depend
+-include $(SUBDIR).depend

Modified: trunk/configure
==============================================================================
--- trunk/configure	(original)
+++ trunk/configure	Mon Apr  7 23:16:31 2008
@@ -940,7 +940,7 @@ SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMA
 LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
 
 # gcc stupidly only outputs the basename of targets with -MM
-DEPEND_CMD='$(CC) -MM $(CFLAGS) $(filter-out %.h,$^) | sed "s,[0-9a-z._-]*: \($(SRC_DIR)/\)*\([a-z0-9]*/\)[^/]* ,\\2&,"'
+DEPEND_CMD='$(CC) -MM $(CFLAGS) $(filter-out %.h,$$^) | sed "s,[0-9a-z._-]*: \($(SRC_DIR)/\)*\([a-z0-9]*/\)[^/]* ,\\2&,;s,^.*:,\$$$$(SUBDIR)&,"'
 VHOOK_DEPEND_CMD='$(CC) -MM $(VHOOKCFLAGS) $(filter-out %.h,$^) | sed "s,^\([a-z]\),vhook/\\1,"'
 
 # find source path
@@ -1105,7 +1105,7 @@ case $target_os in
     darwin)
         disable need_memalign
         SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
-        VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(SHLIBDIR)/vhook/$@'
+        VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(SHLIBDIR)/vhook/$$@'
         strip="strip -x"
         FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
         SLIBSUF=".dylib"
@@ -1128,10 +1128,10 @@ case $target_os in
         EXESUF=".exe"
         SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
-        SLIB_EXTRA_CMD='-lib /machine:i386 /def:$(@:$(SLIBSUF)=.def)'
-        SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
+        SLIB_EXTRA_CMD='-lib /machine:i386 /def:$$(@:$(SLIBSUF)=.def)'
+        SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
         SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
-        SHFLAGS='-shared -Wl,--output-def,$(@:$(SLIBSUF)=.def) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
+        SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
         ;;
     cygwin*)
         target_os=cygwin
@@ -1168,22 +1168,22 @@ case $target_os in
         ln_s="cp -f"
         EXESUF=".exe"
         FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
-        SHFLAGS='$(NAME).def -Zdll -Zomf'
+        SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
         FFSERVERLDFLAGS=""
         LIBSUF="_s.a"
         SLIBPREF=""
         SLIBSUF=".dll"
         SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
-        SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(NAME).def; \
-          echo PROTMODE >> $(NAME).def; \
-          echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(NAME).def; \
-          echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(NAME).def; \
-          echo EXPORTS >> $(NAME).def; \
-          emxexp -o $(OBJS) >> $(NAME).def'
-        SLIB_EXTRA_CMD='emximp -o $(LIBPREF)$(NAME)_dll.a $(NAME).def; \
-          emximp -o $(LIBPREF)$(NAME)_dll.lib $(NAME).def;'
-        SLIB_INSTALL_EXTRA_CMD='install -m 644 $(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
+        SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
+          echo PROTMODE >> $(SUBDIR)$(NAME).def; \
+          echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
+          echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
+          echo EXPORTS >> $(SUBDIR)$(NAME).def; \
+          emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
+        SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
+          emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
+        SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
         SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
         disable vhook
         ;;
@@ -2096,6 +2096,7 @@ if enabled source_path_used; then
     FILES="\
         Makefile             \
         common.mak           \
+        subdir.mak           \
         doc/texi2pod.pl      \
         libavcodec/Makefile  \
         libavdevice/Makefile \

Modified: trunk/libavcodec/Makefile
==============================================================================
--- trunk/libavcodec/Makefile	(original)
+++ trunk/libavcodec/Makefile	Mon Apr  7 23:16:31 2008
@@ -2,7 +2,7 @@
 # libavcodec Makefile
 # (c) 2000-2005 Fabrice Bellard
 #
-include ../config.mak
+include $(SUBDIR)../config.mak
 
 NAME = avcodec
 FFLIBS = avutil
@@ -449,7 +449,7 @@ ALTIVEC-OBJS-$(CONFIG_VC1_DECODER)     +
 ALTIVEC-OBJS-$(CONFIG_WMV3_DECODER)    += ppc/vc1dsp_altivec.o
 
 # -maltivec is needed in order to build AltiVec code.
-$(ALTIVEC-OBJS-yes): CFLAGS += -maltivec -mabi=altivec
+$(addprefix $(SUBDIR),$(ALTIVEC-OBJS-yes)): CFLAGS += -maltivec -mabi=altivec
 
 # check_altivec must be built without -maltivec
 OBJS-$(HAVE_ALTIVEC)                   += $(ALTIVEC-OBJS-yes)       \
@@ -469,23 +469,22 @@ ifeq ($(ARCH_X86),yes)
 TESTS += cpuid-test$(EXESUF) motion-test$(EXESUF)
 endif
 
-include ../common.mak
+CLEANFILES = \
+    alpha/*.o alpha/*~ \
+    armv4l/*.o armv4l/*~ \
+    bfin/*.o bfin/*~ \
+    i386/*.o i386/*~ \
+    mlib/*.o mlib/*~ \
+    ppc/*.o ppc/*~ \
+    ps2/*.o ps2/*~ \
+    sh4/*.o sh4/*~ \
+    sparc/*.o sparc/*~ \
+    apiexample$(EXESUF)
 
-clean::
-	rm -f \
-	   alpha/*.o alpha/*~ \
-	   armv4l/*.o armv4l/*~ \
-	   bfin/*.o bfin/*~ \
-	   i386/*.o i386/*~ \
-	   mlib/*.o mlib/*~ \
-	   ppc/*.o ppc/*~ \
-	   ps2/*.o ps2/*~ \
-	   sh4/*.o sh4/*~ \
-	   sparc/*.o sparc/*~ \
-	   apiexample$(EXESUF)
+include $(SUBDIR)../subdir.mak
 
-cpuid-test$(EXESUF): i386/cputest.c
-apiexample$(EXESUF): apiexample.o $(LIBNAME)
-dct-test$(EXESUF): dct-test.o fdctref.o $(LIBNAME)
-fft-test$(EXESUF): fft-test.o $(LIBNAME)
-motion-test$(EXESUF): motion-test.o $(LIBNAME)
+$(SUBDIR)cpuid-test$(EXESUF): $(SUBDIR)i386/cputest.c
+$(SUBDIR)apiexample$(EXESUF): $(SUBDIR)apiexample.o $(SUBDIR)$(LIBNAME)
+$(SUBDIR)dct-test$(EXESUF): $(SUBDIR)dct-test.o fdctref.o $(SUBDIR)$(LIBNAME)
+$(SUBDIR)fft-test$(EXESUF): $(SUBDIR)fft-test.o $(SUBDIR)$(LIBNAME)
+$(SUBDIR)motion-test$(EXESUF): $(SUBDIR)motion-test.o $(SUBDIR)$(LIBNAME)

Modified: trunk/libavdevice/Makefile
==============================================================================
--- trunk/libavdevice/Makefile	(original)
+++ trunk/libavdevice/Makefile	Mon Apr  7 23:16:31 2008
@@ -1,4 +1,4 @@
-include ../config.mak
+include $(SUBDIR)../config.mak
 
 NAME = avdevice
 FFLIBS = avformat avcodec avutil
@@ -23,4 +23,4 @@ OBJS-$(CONFIG_LIBDC1394_DEMUXER)        
 CPP_OBJS-$(CONFIG_AUDIO_BEOS_DEMUXER)     += beosaudio.o
 CPP_OBJS-$(CONFIG_AUDIO_BEOS_MUXER)       += beosaudio.o
 
-include ../common.mak
+include $(SUBDIR)../subdir.mak

Modified: trunk/libavfilter/Makefile
==============================================================================
--- trunk/libavfilter/Makefile	(original)
+++ trunk/libavfilter/Makefile	Mon Apr  7 23:16:31 2008
@@ -1,4 +1,4 @@
-include ../config.mak
+include $(SUBDIR)../config.mak
 
 NAME = avfilter
 FFLIBS = avcodec avutil
@@ -14,4 +14,4 @@ OBJS = allfilters.o \
 
 HEADERS = avfilter.h
 
-include ../common.mak
+include $(SUBDIR)../subdir.mak

Modified: trunk/libavformat/Makefile
==============================================================================
--- trunk/libavformat/Makefile	(original)
+++ trunk/libavformat/Makefile	Mon Apr  7 23:16:31 2008
@@ -2,7 +2,7 @@
 # libavformat Makefile
 # (c) 2000-2003 Fabrice Bellard
 #
-include ../config.mak
+include $(SUBDIR)../config.mak
 
 NAME = avformat
 FFLIBS = avcodec avutil
@@ -198,4 +198,4 @@ OBJS-$(CONFIG_RTP_PROTOCOL)             
 OBJS-$(CONFIG_TCP_PROTOCOL)              += tcp.o
 OBJS-$(CONFIG_UDP_PROTOCOL)              += udp.o
 
-include ../common.mak
+include $(SUBDIR)../subdir.mak

Modified: trunk/libavutil/Makefile
==============================================================================
--- trunk/libavutil/Makefile	(original)
+++ trunk/libavutil/Makefile	Mon Apr  7 23:16:31 2008
@@ -1,4 +1,4 @@
-include ../config.mak
+include $(SUBDIR)../config.mak
 
 NAME = avutil
 
@@ -41,9 +41,8 @@ HEADERS = adler32.h \
 
 TESTS = $(addsuffix -test$(EXESUF), adler32 aes crc des lls md5 sha1 softfloat tree)
 
-include ../common.mak
+include $(SUBDIR)../subdir.mak
 
-lzo-test$(EXESUF): EXTRALIBS += -llzo2
+$(SUBDIR)lzo-test$(EXESUF): EXTRALIBS += -llzo2
 
-clean::
-	rm -f lzo-test$(EXESUF)
+CLEANFILES = lzo-test$(EXESUF)

Modified: trunk/libpostproc/Makefile
==============================================================================
--- trunk/libpostproc/Makefile	(original)
+++ trunk/libpostproc/Makefile	Mon Apr  7 23:16:31 2008
@@ -1,4 +1,4 @@
-include ../config.mak
+include $(SUBDIR)../config.mak
 
 NAME = postproc
 FFLIBS = avutil
@@ -7,4 +7,4 @@ HEADERS = postprocess.h
 
 OBJS = postprocess.o
 
-include ../common.mak
+include $(SUBDIR)../subdir.mak

Copied: trunk/subdir.mak (from r12759, /trunk/common.mak)
==============================================================================
--- /trunk/common.mak	(original)
+++ trunk/subdir.mak	Mon Apr  7 23:16:31 2008
@@ -1,86 +1,46 @@
-#
-# common bits used by all libraries
-#
-
-SRC_DIR = $(SRC_PATH_BARE)/lib$(NAME)
-
-LIBVERSION = $(lib$(NAME)_VERSION)
-LIBMAJOR   = $(lib$(NAME)_VERSION_MAJOR)
-
-vpath %.c $(SRC_DIR)
-vpath %.h $(SRC_DIR)
-vpath %.S $(SRC_DIR)
-
-ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
-
-CFLAGS   += $(CFLAGS-yes)
-OBJS     += $(OBJS-yes)
-ASM_OBJS += $(ASM_OBJS-yes)
-CPP_OBJS += $(CPP_OBJS-yes)
-FFLIBS   += $(FFLIBS-yes)
+SRC_DIR := $(SRC_PATH_BARE)/lib$(NAME)
 
-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)
+include $(SUBDIR)../common.mak
 
-EXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
-LDFLAGS   := $(addprefix -L$(BUILD_ROOT)/lib,$(FFLIBS)) $(LDFLAGS)
+LIBVERSION := $(lib$(NAME)_VERSION)
+LIBMAJOR   := $(lib$(NAME)_VERSION_MAJOR)
 
-SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPP_OBJS:.o=.cpp)
-OBJS := $(OBJS) $(ASM_OBJS) $(CPP_OBJS)
+ifeq ($(BUILD_STATIC),yes)
+all: $(SUBDIR)$(LIBNAME)
 
-all: $(LIBNAME) $(SLIBNAME)
+install-libs: install-lib$(NAME)-static
 
-$(LIBNAME)$(DISABLE): $(OBJS)
+$(SUBDIR)$(LIBNAME): $(OBJS)
 	rm -f $@
 	$(AR) rc $@ $^ $(EXTRAOBJS)
 	$(RANLIB) $@
+endif
 
-$(SLIBNAME)$(DISABLE): $(SLIBNAME_WITH_MAJOR)
-	$(LN_S) $^ $@
-
-$(SLIBNAME_WITH_MAJOR): $(OBJS)
-	$(SLIB_CREATE_DEF_CMD)
-	$(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS)
-	$(SLIB_EXTRA_CMD)
-
-%.o: %.c
-	$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
-
-%.o: %.S
-	$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
-
-%: %.o $(LIBNAME)
-	$(CC) $(LDFLAGS) -o $@ $^ $(EXTRALIBS)
-
-%.ho: %.h
-	$(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
-
-ALLHEADERS = $(subst $(SRC_DIR)/,,$(wildcard $(SRC_DIR)/*.h))
-checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
-
-depend dep: .depend
-
-.depend: $(SRCS)
-	$(DEPEND_CMD) > .depend
+INCINSTDIR := $(INCDIR)/lib$(NAME)
 
-clean::
-	rm -f *.o *~ *.a *.lib *.so *.so.* *.dylib *.dll \
-	      *.def *.dll.a *.exp *.ho *.map $(TESTS)
+define RULES
+ifeq ($(BUILD_SHARED),yes)
+all: $(SUBDIR)$(SLIBNAME)
 
-distclean:: clean
-	rm -f .depend
+install-libs: install-lib$(NAME)-shared
 
-INSTALL_LIB_TARGETS-$(BUILD_SHARED) += install-lib-shared
-INSTALL_LIB_TARGETS-$(BUILD_STATIC) += install-lib-static
+$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
+	cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
 
-install: install-libs install-headers
+$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS)
+	$(SLIB_CREATE_DEF_CMD)
+	$(CC) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$^ $(FFEXTRALIBS) $(EXTRAOBJS)
+	$(SLIB_EXTRA_CMD)
 
-install-libs$(DISABLE): $(INSTALL_LIB_TARGETS-yes)
+ifneq ($(SUBDIR),)
+$(SUBDIR)$(SLIBNAME_WITH_MAJOR): \
+    $(foreach L,$(FFLIBS),lib$(L)/$(SLIBPREF)$(L)$(SLIBSUF))
+endif
+endif
 
-install-lib-shared: $(SLIBNAME)
+install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
 	install -d "$(SHLIBDIR)"
-	install -m 755 $(SLIBNAME) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
+	install -m 755 $(SUBDIR)$(SLIBNAME) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
 	$(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
 	cd "$(SHLIBDIR)" && \
 		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
@@ -88,21 +48,17 @@ install-lib-shared: $(SLIBNAME)
 		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
 	$(SLIB_INSTALL_EXTRA_CMD)
 
-install-lib-static: $(LIBNAME)
+install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)
 	install -d "$(LIBDIR)"
-	install -m 644 $(LIBNAME) "$(LIBDIR)"
+	install -m 644 $(SUBDIR)$(LIBNAME) "$(LIBDIR)"
 	$(LIB_INSTALL_EXTRA_CMD)
 
-INCINSTDIR = $(INCDIR)/lib$(NAME)
-
-install-headers$(DISABLE)::
+install-headers::
 	install -d "$(INCINSTDIR)"
 	install -d "$(LIBDIR)/pkgconfig"
 	install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(INCINSTDIR)"
 	install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(LIBDIR)/pkgconfig"
 
-uninstall: uninstall-libs uninstall-headers
-
 uninstall-libs::
 	-rm -f "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
 	       "$(SHLIBDIR)/$(SLIBNAME)"            \
@@ -113,12 +69,7 @@ uninstall-libs::
 uninstall-headers::
 	rm -f $(addprefix "$(INCINSTDIR)/",$(HEADERS))
 	rm -f "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
+	-rmdir "$(INCDIR)"
+endef
 
-tests: $(TESTS)
-
-%-test$(EXESUF): %.c $(LIBNAME)
-	$(CC) $(CFLAGS) $(LDFLAGS) -DTEST -o $@ $^ $(EXTRALIBS)
-
-.PHONY: all depend dep clean distclean install* uninstall* tests
-
--include .depend
+$(eval $(RULES))




More information about the ffmpeg-cvslog mailing list