Commit 71c61f62 authored by Måns Rullgård's avatar Måns Rullgård

non-recursive makefiles

Originally committed as revision 12760 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent c09ed33e
...@@ -6,8 +6,6 @@ include config.mak ...@@ -6,8 +6,6 @@ include config.mak
SRC_DIR = $(SRC_PATH_BARE) SRC_DIR = $(SRC_PATH_BARE)
vpath %.c $(SRC_PATH_BARE)
vpath %.h $(SRC_PATH_BARE)
vpath %.texi $(SRC_PATH_BARE) vpath %.texi $(SRC_PATH_BARE)
PROGS-$(CONFIG_FFMPEG) += ffmpeg PROGS-$(CONFIG_FFMPEG) += ffmpeg
...@@ -30,6 +28,14 @@ FFLIBS-$(CONFIG_SWSCALE) += swscale ...@@ -30,6 +28,14 @@ FFLIBS-$(CONFIG_SWSCALE) += swscale
FFLIBS := avdevice avformat avcodec avutil 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-$(CONFIG_VHOOK) += videohook
ALL_TARGETS-$(BUILD_DOC) += documentation ALL_TARGETS-$(BUILD_DOC) += documentation
...@@ -40,7 +46,7 @@ INSTALL_TARGETS-$(BUILD_DOC) += install-man ...@@ -40,7 +46,7 @@ INSTALL_TARGETS-$(BUILD_DOC) += install-man
endif endif
INSTALL_PROGS_TARGETS-$(BUILD_SHARED) = install-libs INSTALL_PROGS_TARGETS-$(BUILD_SHARED) = install-libs
main: lib $(PROGS) $(ALL_TARGETS-yes) all: $(DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
$(PROGS): %$(EXESUF): %_g$(EXESUF) $(PROGS): %$(EXESUF): %_g$(EXESUF)
cp -p $< $@ cp -p $< $@
...@@ -48,13 +54,20 @@ $(PROGS): %$(EXESUF): %_g$(EXESUF) ...@@ -48,13 +54,20 @@ $(PROGS): %$(EXESUF): %_g$(EXESUF)
.depend: version.h $(PROGS_SRCS) .depend: version.h $(PROGS_SRCS)
# bandaid to disable triggering shared library installation routines SUBDIR_VARS := OBJS ASM_OBJS CPP_OBJS FFLIBS CLEANFILES
DISABLE=yes
include common.mak define RESET
$(1) :=
$(1)-yes :=
endef
S := $(BUILD_SHARED:yes=S) define DOSUBDIR
DEP_LIBS := $(foreach L,$(FFLIBS),lib$(L)/$($(S)LIBPREF)$(L)$($(S)LIBSUF)) $(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)) VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
...@@ -78,23 +91,11 @@ VHOOKCFLAGS += $(VHOOKCFLAGS-yes) ...@@ -78,23 +91,11 @@ VHOOKCFLAGS += $(VHOOKCFLAGS-yes)
vhook/%.o: CFLAGS:=$(VHOOKCFLAGS) vhook/%.o: CFLAGS:=$(VHOOKCFLAGS)
MAKE-yes = $(MAKE) ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
MAKE- = : $(MAKE) ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
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)
%_g$(EXESUF): %.o cmdutils.o .libs %_g$(EXESUF): %.o cmdutils.o $(DEP_LIBS)
$(CC) $(LDFLAGS) -o $@ $< cmdutils.o $(EXTRALIBS) $(CC) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES)) ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
...@@ -104,18 +105,18 @@ endif ...@@ -104,18 +105,18 @@ endif
version.h: version.h:
$(SRC_PATH)/version.sh $(SRC_PATH) $(SRC_PATH)/version.sh $(SRC_PATH)
output_example$(EXESUF): output_example.o .libs output_example$(EXESUF): output_example.o $(DEP_LIBS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(EXTRALIBS) $(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
tools/%$(EXESUF): tools/%.c tools/%$(EXESUF): tools/%.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(EXTRALIBS) $(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
ffplay.o .depend: CFLAGS += $(SDL_CFLAGS) ffplay.o .depend: CFLAGS += $(SDL_CFLAGS)
ffmpeg.o ffplay.o ffserver.o: version.h ffmpeg.o ffplay.o ffserver.o: version.h
# vhooks compile fine without libav*, but need them nonetheless. # vhooks compile fine without libav*, but need them nonetheless.
videohook: .libs $(HOOKS) videohook: $(DEP_LIBS) $(HOOKS)
vhook/%$(SLIBSUF): vhook/%.o vhook/%$(SLIBSUF): vhook/%.o
$(CC) $(LDFLAGS) -o $@ $(VHOOKSHFLAGS) $< $(VHOOKLIBS) $(LIBS_$(@F)) $(CC) $(LDFLAGS) -o $@ $(VHOOKSHFLAGS) $< $(VHOOKLIBS) $(LIBS_$(@F))
...@@ -148,24 +149,6 @@ install-vhook: videohook ...@@ -148,24 +149,6 @@ install-vhook: videohook
install -d "$(SHLIBDIR)/vhook" install -d "$(SHLIBDIR)/vhook"
install -m 755 $(HOOKS) "$(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: uninstall-progs uninstall-man uninstall-vhook
uninstall-progs: uninstall-progs:
...@@ -178,51 +161,13 @@ uninstall-vhook: ...@@ -178,51 +161,13 @@ uninstall-vhook:
rm -f $(addprefix "$(SHLIBDIR)/",$(ALLHOOKS_SRCS:.c=$(SLIBSUF))) rm -f $(addprefix "$(SHLIBDIR)/",$(ALLHOOKS_SRCS:.c=$(SLIBSUF)))
-rmdir "$(SHLIBDIR)/vhook/" -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 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 .vhookdep: $(ALLHOOKS_SRCS) version.h
$(VHOOK_DEPEND_CMD) > $@ $(VHOOK_DEPEND_CMD) > $@
$(DEP_LIBS): lib
.libs: $(DEP_LIBS)
touch $@
clean:: clean::
$(MAKE) -C libavutil clean rm -f gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
$(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) \
output_example$(EXESUF) output_example$(EXESUF)
rm -f doc/*.html doc/*.pod doc/*.1 rm -f doc/*.html doc/*.pod doc/*.1
rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~ rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
...@@ -231,13 +176,6 @@ clean:: ...@@ -231,13 +176,6 @@ clean::
rm -f vhook/*.o vhook/*~ vhook/*.so vhook/*.dylib vhook/*.dll rm -f vhook/*.o vhook/*~ vhook/*.so vhook/*.dylib vhook/*.dll
distclean:: 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 rm -f .vhookdep version.h config.* *.pc
# regression tests # regression tests
...@@ -404,10 +342,10 @@ tests/asynth1.sw: tests/audiogen$(EXESUF) ...@@ -404,10 +342,10 @@ tests/asynth1.sw: tests/audiogen$(EXESUF)
$(BUILD_ROOT)/$< $@ $(BUILD_ROOT)/$< $@
%$(EXESUF): %.c %$(EXESUF): %.c
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $< $(CC) $(FF_LDFLAGS) $(CFLAGS) -o $@ $<
tests/seek_test$(EXESUF): tests/seek_test.c .libs tests/seek_test$(EXESUF): tests/seek_test.c $(DEP_LIBS)
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $< $(EXTRALIBS) $(CC) $(FF_LDFLAGS) $(CFLAGS) -o $@ $< $(FF_EXTRALIBS)
.PHONY: lib videohook documentation TAGS .PHONY: lib videohook documentation TAGS
......
...@@ -2,47 +2,18 @@ ...@@ -2,47 +2,18 @@
# common bits used by all libraries # common bits used by all libraries
# #
SRC_DIR = $(SRC_PATH_BARE)/lib$(NAME) all: # make "all" default target
LIBVERSION = $(lib$(NAME)_VERSION)
LIBMAJOR = $(lib$(NAME)_VERSION_MAJOR)
ifeq ($(SUBDIR),)
vpath %.c $(SRC_DIR) vpath %.c $(SRC_DIR)
vpath %.h $(SRC_DIR) vpath %.h $(SRC_DIR)
vpath %.S $(SRC_DIR) vpath %.S $(SRC_DIR)
ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
CFLAGS += $(CFLAGS-yes) CFLAGS = -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
OBJS += $(OBJS-yes) -D_ISOC9X_SOURCE -I$(BUILD_ROOT) -I$(SRC_PATH) \
ASM_OBJS += $(ASM_OBJS-yes) $(addprefix -I$(SRC_PATH)/lib,$(ALLFFLIBS)) $(OPTFLAGS)
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)
%.o: %.c %.o: %.c
$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $< $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
...@@ -50,75 +21,59 @@ $(SLIBNAME_WITH_MAJOR): $(OBJS) ...@@ -50,75 +21,59 @@ $(SLIBNAME_WITH_MAJOR): $(OBJS)
%.o: %.S %.o: %.S
$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $< $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
%: %.o $(LIBNAME)
$(CC) $(LDFLAGS) -o $@ $^ $(EXTRALIBS)
%.ho: %.h %.ho: %.h
$(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $< $(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
ALLHEADERS = $(subst $(SRC_DIR)/,,$(wildcard $(SRC_DIR)/*.h)) install: install-libs install-headers
checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
depend dep: .depend
.depend: $(SRCS) uninstall: uninstall-libs uninstall-headers
$(DEPEND_CMD) > .depend
clean:: .PHONY: all depend dep clean distclean install* uninstall* tests
rm -f *.o *~ *.a *.lib *.so *.so.* *.dylib *.dll \ endif
*.def *.dll.a *.exp *.ho *.map $(TESTS)
distclean:: clean CFLAGS += $(CFLAGS-yes)
rm -f .depend 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 FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
INSTALL_LIB_TARGETS-$(BUILD_STATIC) += install-lib-static 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) ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h))
install -d "$(SHLIBDIR)" checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
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)
install-lib-static: $(LIBNAME) depend dep: $(SUBDIR).depend
install -d "$(LIBDIR)"
install -m 644 $(LIBNAME) "$(LIBDIR)"
$(LIB_INSTALL_EXTRA_CMD)
INCINSTDIR = $(INCDIR)/lib$(NAME) CLEANFILES += *.o *~ *.a *.lib *.so *.so.* *.dylib *.dll \
*.def *.dll.a *.exp *.ho *.map
install-headers$(DISABLE):: define RULES
install -d "$(INCINSTDIR)" $(SUBDIR)%: $(SUBDIR)%.o $(LIBNAME)
install -d "$(LIBDIR)/pkgconfig" $(CC) $(FFLDFLAGS) -o $$@ $$^ $(FFEXTRALIBS)
install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(INCINSTDIR)"
install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(LIBDIR)/pkgconfig"
uninstall: uninstall-libs uninstall-headers $(SUBDIR)%-test$(EXESUF): $(SUBDIR)%.c $(LIBNAME)
$(CC) $(CFLAGS) $(FFLDFLAGS) -DTEST -o $$@ $$^ $(FFEXTRALIBS)
uninstall-libs:: $(SUBDIR).depend: $(SRCS)
-rm -f "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \ $(DEPEND_CMD) > $$@
"$(SHLIBDIR)/$(SLIBNAME)" \
"$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
-$(SLIB_UNINSTALL_EXTRA_CMD)
-rm -f "$(LIBDIR)/$(LIBNAME)"
uninstall-headers:: clean::
rm -f $(addprefix "$(INCINSTDIR)/",$(HEADERS)) rm -f $(TESTS) $(addprefix $(SUBDIR),$(CLEANFILES))
rm -f "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
tests: $(TESTS) distclean:: clean
rm -f $(SUBDIR).depend
endef
%-test$(EXESUF): %.c $(LIBNAME) $(eval $(RULES))
$(CC) $(CFLAGS) $(LDFLAGS) -DTEST -o $@ $^ $(EXTRALIBS)
.PHONY: all depend dep clean distclean install* uninstall* tests tests: $(TESTS)
-include .depend -include $(SUBDIR).depend
...@@ -940,7 +940,7 @@ SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)' ...@@ -940,7 +940,7 @@ SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"' LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
# gcc stupidly only outputs the basename of targets with -MM # 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,"' VHOOK_DEPEND_CMD='$(CC) -MM $(VHOOKCFLAGS) $(filter-out %.h,$^) | sed "s,^\([a-z]\),vhook/\\1,"'
# find source path # find source path
...@@ -1105,7 +1105,7 @@ case $target_os in ...@@ -1105,7 +1105,7 @@ case $target_os in
darwin) darwin)
disable need_memalign disable need_memalign
SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress' 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" strip="strip -x"
FFLDFLAGS="-Wl,-dynamic,-search_paths_first" FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
SLIBSUF=".dylib" SLIBSUF=".dylib"
...@@ -1128,10 +1128,10 @@ case $target_os in ...@@ -1128,10 +1128,10 @@ case $target_os in
EXESUF=".exe" EXESUF=".exe"
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)' SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)' SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
SLIB_EXTRA_CMD='-lib /machine:i386 /def:$(@:$(SLIBSUF)=.def)' 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_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)"' 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*) cygwin*)
target_os=cygwin target_os=cygwin
...@@ -1168,22 +1168,22 @@ case $target_os in ...@@ -1168,22 +1168,22 @@ case $target_os in
ln_s="cp -f" ln_s="cp -f"
EXESUF=".exe" EXESUF=".exe"
FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap" FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
SHFLAGS='$(NAME).def -Zdll -Zomf' SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
FFSERVERLDFLAGS="" FFSERVERLDFLAGS=""
LIBSUF="_s.a" LIBSUF="_s.a"
SLIBPREF="" SLIBPREF=""
SLIBSUF=".dll" SLIBSUF=".dll"
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)' SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(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; \ SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
echo PROTMODE >> $(NAME).def; \ echo PROTMODE >> $(SUBDIR)$(NAME).def; \
echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(NAME).def; \ echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(NAME).def; \ echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
echo EXPORTS >> $(NAME).def; \ echo EXPORTS >> $(SUBDIR)$(NAME).def; \
emxexp -o $(OBJS) >> $(NAME).def' emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
SLIB_EXTRA_CMD='emximp -o $(LIBPREF)$(NAME)_dll.a $(NAME).def; \ SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
emximp -o $(LIBPREF)$(NAME)_dll.lib $(NAME).def;' emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
SLIB_INSTALL_EXTRA_CMD='install -m 644 $(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"' 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' SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
disable vhook disable vhook
;; ;;
...@@ -2096,6 +2096,7 @@ if enabled source_path_used; then ...@@ -2096,6 +2096,7 @@ if enabled source_path_used; then
FILES="\ FILES="\
Makefile \ Makefile \
common.mak \ common.mak \
subdir.mak \
doc/texi2pod.pl \ doc/texi2pod.pl \
libavcodec/Makefile \ libavcodec/Makefile \
libavdevice/Makefile \ libavdevice/Makefile \
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# libavcodec Makefile # libavcodec Makefile
# (c) 2000-2005 Fabrice Bellard # (c) 2000-2005 Fabrice Bellard
# #
include ../config.mak include $(SUBDIR)../config.mak
NAME = avcodec NAME = avcodec
FFLIBS = avutil FFLIBS = avutil
...@@ -449,7 +449,7 @@ ALTIVEC-OBJS-$(CONFIG_VC1_DECODER) += ppc/vc1dsp_altivec.o ...@@ -449,7 +449,7 @@ ALTIVEC-OBJS-$(CONFIG_VC1_DECODER) += ppc/vc1dsp_altivec.o
ALTIVEC-OBJS-$(CONFIG_WMV3_DECODER) += ppc/vc1dsp_altivec.o ALTIVEC-OBJS-$(CONFIG_WMV3_DECODER) += ppc/vc1dsp_altivec.o
# -maltivec is needed in order to build AltiVec code. # -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 # check_altivec must be built without -maltivec
OBJS-$(HAVE_ALTIVEC) += $(ALTIVEC-OBJS-yes) \ OBJS-$(HAVE_ALTIVEC) += $(ALTIVEC-OBJS-yes) \
...@@ -469,23 +469,22 @@ ifeq ($(ARCH_X86),yes) ...@@ -469,23 +469,22 @@ ifeq ($(ARCH_X86),yes)
TESTS += cpuid-test$(EXESUF) motion-test$(EXESUF) TESTS += cpuid-test$(EXESUF) motion-test$(EXESUF)
endif endif
include ../common.mak CLEANFILES = \
alpha/*.o alpha/*~ \
clean:: armv4l/*.o armv4l/*~ \
rm -f \ bfin/*.o bfin/*~ \
alpha/*.o alpha/*~ \ i386/*.o i386/*~ \
armv4l/*.o armv4l/*~ \ mlib/*.o mlib/*~ \
bfin/*.o bfin/*~ \ ppc/*.o ppc/*~ \
i386/*.o i386/*~ \ ps2/*.o ps2/*~ \
mlib/*.o mlib/*~ \ sh4/*.o sh4/*~ \
ppc/*.o ppc/*~ \ sparc/*.o sparc/*~ \
ps2/*.o ps2/*~ \ apiexample$(EXESUF)
sh4/*.o sh4/*~ \
sparc/*.o sparc/*~ \ include $(SUBDIR)../subdir.mak
apiexample$(EXESUF)
$(SUBDIR)cpuid-test$(EXESUF): $(SUBDIR)i386/cputest.c
cpuid-test$(EXESUF): i386/cputest.c $(SUBDIR)apiexample$(EXESUF): $(SUBDIR)apiexample.o $(SUBDIR)$(LIBNAME)
apiexample$(EXESUF): apiexample.o $(LIBNAME) $(SUBDIR)dct-test$(EXESUF): $(SUBDIR)dct-test.o fdctref.o $(SUBDIR)$(LIBNAME)
dct-test$(EXESUF): dct-test.o fdctref.o $(LIBNAME) $(SUBDIR)fft-test$(EXESUF): $(SUBDIR)fft-test.o $(SUBDIR)$(LIBNAME)
fft-test$(EXESUF): fft-test.o $(LIBNAME) $(SUBDIR)motion-test$(EXESUF): $(SUBDIR)motion-test.o $(SUBDIR)$(LIBNAME)
motion-test$(EXESUF): motion-test.o $(LIBNAME)
include ../config.mak include $(SUBDIR)../config.mak
NAME = avdevice NAME = avdevice
FFLIBS = avformat avcodec avutil FFLIBS = avformat avcodec avutil
...@@ -23,4 +23,4 @@ OBJS-$(CONFIG_LIBDC1394_DEMUXER) += libdc1394.o ...@@ -23,4 +23,4 @@ OBJS-$(CONFIG_LIBDC1394_DEMUXER) += libdc1394.o
CPP_OBJS-$(CONFIG_AUDIO_BEOS_DEMUXER) += beosaudio.o CPP_OBJS-$(CONFIG_AUDIO_BEOS_DEMUXER) += beosaudio.o
CPP_OBJS-$(CONFIG_AUDIO_BEOS_MUXER) += beosaudio.o CPP_OBJS-$(CONFIG_AUDIO_BEOS_MUXER) += beosaudio.o
include ../common.mak include $(SUBDIR)../subdir.mak
include ../config.mak include $(SUBDIR)../config.mak
NAME = avfilter NAME = avfilter
FFLIBS = avcodec avutil FFLIBS = avcodec avutil
...@@ -14,4 +14,4 @@ OBJS = allfilters.o \ ...@@ -14,4 +14,4 @@ OBJS = allfilters.o \
HEADERS = avfilter.h HEADERS = avfilter.h
include ../common.mak include $(SUBDIR)../subdir.mak
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# libavformat Makefile # libavformat Makefile
# (c) 2000-2003 Fabrice Bellard # (c) 2000-2003 Fabrice Bellard
# #
include ../config.mak include $(SUBDIR)../config.mak
NAME = avformat NAME = avformat
FFLIBS = avcodec avutil FFLIBS = avcodec avutil
...@@ -198,4 +198,4 @@ OBJS-$(CONFIG_RTP_PROTOCOL) += rtpproto.o ...@@ -198,4 +198,4 @@ OBJS-$(CONFIG_RTP_PROTOCOL) += rtpproto.o
OBJS-$(CONFIG_TCP_PROTOCOL) += tcp.o OBJS-$(CONFIG_TCP_PROTOCOL) += tcp.o
OBJS-$(CONFIG_UDP_PROTOCOL) += udp.o OBJS-$(CONFIG_UDP_PROTOCOL) += udp.o
include ../common.mak include $(SUBDIR)../subdir.mak
include ../config.mak include $(SUBDIR)../config.mak
NAME = avutil NAME = avutil
...@@ -41,9 +41,8 @@ HEADERS = adler32.h \ ...@@ -41,9 +41,8 @@ HEADERS = adler32.h \
TESTS = $(addsuffix -test$(EXESUF), adler32 aes crc des lls md5 sha1 softfloat tree) 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:: CLEANFILES = lzo-test$(EXESUF)
rm -f lzo-test$(EXESUF)
include ../config.mak include $(SUBDIR)../config.mak
NAME = postproc NAME = postproc
FFLIBS = avutil FFLIBS = avutil
...@@ -7,4 +7,4 @@ HEADERS = postprocess.h ...@@ -7,4 +7,4 @@ HEADERS = postprocess.h
OBJS = postprocess.o OBJS = postprocess.o
include ../common.mak include $(SUBDIR)../subdir.mak
SRC_DIR := $(SRC_PATH_BARE)/lib$(NAME)
include $(SUBDIR)../common.mak
LIBVERSION := $(lib$(NAME)_VERSION)
LIBMAJOR := $(lib$(NAME)_VERSION_MAJOR)
ifeq ($(BUILD_STATIC),yes)
all: $(SUBDIR)$(LIBNAME)
install-libs: install-lib$(NAME)-static
$(SUBDIR)$(LIBNAME): $(OBJS)
rm -f $@
$(AR) rc $@ $^ $(EXTRAOBJS)
$(RANLIB) $@
endif
INCINSTDIR := $(INCDIR)/lib$(NAME)
define RULES
ifeq ($(BUILD_SHARED),yes)
all: $(SUBDIR)$(SLIBNAME)
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)
$(SLIB_CREATE_DEF_CMD)
$(CC) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$^ $(FFEXTRALIBS) $(EXTRAOBJS)
$(SLIB_EXTRA_CMD)
ifneq ($(SUBDIR),)
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): \
$(foreach L,$(FFLIBS),lib$(L)/$(SLIBPREF)$(L)$(SLIBSUF))
endif
endif
install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
install -d "$(SHLIBDIR)"
install -m 755 $(SUBDIR)$(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)
install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)
install -d "$(LIBDIR)"
install -m 644 $(SUBDIR)$(LIBNAME) "$(LIBDIR)"
$(LIB_INSTALL_EXTRA_CMD)
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-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))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment