1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

move common parts of makefiles into common.mak

Originally committed as revision 5015 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Måns Rullgård 2006-02-13 12:53:25 +00:00
parent f41b1d3541
commit 8b2121e3de
7 changed files with 132 additions and 280 deletions

View File

@ -139,23 +139,15 @@ install-vhook:
install-libs:
install -d $(libdir)
$(MAKE) -C libavutil install-libs
$(MAKE) -C libavcodec install-libs
$(MAKE) -C libavformat install-libs
ifeq ($(CONFIG_PP),yes)
$(MAKE) -C libavcodec/libpostproc install-libs
endif
ifeq ($(BUILD_SHARED),yes)
$(MAKE) -C libavutil install-lib-shared
$(MAKE) -C libavcodec install-lib-shared
$(MAKE) -C libavformat install-lib-shared
ifeq ($(CONFIG_PP),yes)
$(MAKE) -C libavcodec/libpostproc install-lib-shared
endif
$(LDCONFIG) || true
endif
ifeq ($(BUILD_STATIC),yes)
$(MAKE) -C libavutil install-lib-static
$(MAKE) -C libavcodec install-lib-static
$(MAKE) -C libavformat install-lib-static
ifeq ($(CONFIG_PP),yes)
$(MAKE) -C libavcodec/libpostproc install-lib-static
endif
endif
install-headers:
install -d "$(incdir)"

97
common.mak Normal file
View File

@ -0,0 +1,97 @@
#
# common bits used by all libraries
#
SRC_DIR = $(SRC_PATH)/$(SUBDIR)
VPATH = $(SRC_DIR)
#FIXME: This should be in configure/config.mak
ifeq ($(CONFIG_WIN32),yes)
LDFLAGS = -Wl,--output-def,$(@:.dll=.def),--out-implib,lib$(SLIBNAME:$(SLIBSUF)=.dll.a)
endif
ifeq ($(TARGET_GPROF),yes)
CFLAGS+=-p
LDFLAGS+=-p
endif
ifeq ($(TARGET_ARCH_SPARC64),yes)
CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
endif
SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPPOBJS:.o=.cpp)
OBJS := $(OBJS) $(ASM_OBJS) $(CPPOBJS)
STATIC_OBJS := $(OBJS) $(STATIC_OBJS)
SHARED_OBJS := $(OBJS) $(SHARED_OBJS)
all: $(LIB) $(SLIBNAME)
$(LIB): $(STATIC_OBJS)
rm -f $@
$(AR) rc $@ $^ $(EXTRAOBJS)
$(RANLIB) $@
$(SLIBNAME): $(SHARED_OBJS)
$(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS)
ifeq ($(CONFIG_WIN32),yes)
-lib /machine:i386 /def:$(@:.dll=.def)
endif
%.o: %.c
$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
%.o: %.S
$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
# BeOS: remove -Wall to get rid of all the "multibyte constant" warnings
%.o: %.cpp
g++ $(subst -Wall,,$(CFLAGS)) -c -o $@ $<
depend: $(SRCS)
$(CC) -MM $(CFLAGS) $^ 1>.depend
dep: depend
clean::
rm -f *.o *.d *~ *.a *.lib *.so *.dylib *.dll \
*.lib *.def *.dll.a *.exp
distclean: clean
rm -f .depend
ifeq ($(BUILD_SHARED),yes)
INSTLIBTARGETS += install-lib-shared
endif
ifeq ($(BUILD_STATIC),yes)
INSTLIBTARGETS += install-lib-static
endif
install: install-libs install-headers
install-libs: $(INSTLIBTARGETS)
install-lib-shared: $(SLIBNAME)
ifeq ($(CONFIG_WIN32),yes)
install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
else
install $(INSTALLSTRIP) -m 755 $(SLIBNAME) \
$(libdir)/$(SLIBNAME_WITH_VERSION)
ln -sf $(SLIBNAME_WITH_VERSION) \
$(libdir)/$(SLIBNAME_WITH_MAJOR)
ln -sf $(SLIBNAME_WITH_VERSION) \
$(libdir)/$(SLIBNAME)
endif
install-lib-static: $(LIB)
install -m 644 $(LIB) "$(libdir)"
install-headers:
install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(incdir)"
install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(libdir)/pkgconfig"
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif

1
configure vendored
View File

@ -1892,6 +1892,7 @@ if test "$source_path_used" = "yes" ; then
done
fi
echo "SRC_PATH=$source_path" >> config.mak
echo "BUILD_ROOT=$PWD" >> config.mak
if test "$amr_wb" = "yes" ; then
echo "#define AMR_WB 1" >> $TMPH

View File

@ -4,16 +4,9 @@
#
include ../config.mak
VPATH=$(SRC_PATH)/libavcodec
# NOTE: -I.. is needed to include config.h
CFLAGS=$(OPTFLAGS) -DHAVE_AV_CONFIG_H -I.. -I$(SRC_PATH)/libavutil -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE $(AMR_CFLAGS)
#FIXME: This should be in configure/config.mak
ifeq ($(CONFIG_WIN32),yes)
LDFLAGS=-Wl,--output-def,$(@:.dll=.def),--out-implib,lib$(SLIBNAME:$(SLIBSUF)=.dll.a)
endif
OBJS= bitstream.o utils.o mem.o allcodecs.o \
mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o\
mpegaudio.o ac3enc.o mjpeg.o resample.o resample2.o dsputil.o \
@ -25,6 +18,8 @@ OBJS= bitstream.o utils.o mem.o allcodecs.o \
vp3dsp.o h264idct.o rangecoder.o pnm.o h263.o msmpeg4.o h263dec.o \
opt.o
HEADERS = avcodec.h dsputil.h
ifeq ($(CONFIG_AASC_DECODER),yes)
OBJS+= aasc.o
endif
@ -326,11 +321,6 @@ ifeq ($(CONFIG_LIBGSM),yes)
OBJS += libgsm.o
endif
ifeq ($(TARGET_GPROF),yes)
CFLAGS+=-p
LDFLAGS+=-p
endif
# i386 mmx specific stuff
ifeq ($(TARGET_MMX),yes)
OBJS += i386/fdct_mmx.o i386/cputest.o \
@ -400,14 +390,9 @@ OBJS+=sparc/dsputil_vis.o
sparc/%.o: sparc/%.c
$(CC) -mcpu=ultrasparc -mtune=ultrasparc $(CFLAGS) -c -o $@ $<
endif
ifeq ($(TARGET_ARCH_SPARC64),yes)
CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
endif
SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
OBJS := $(OBJS) $(ASM_OBJS)
NAME=avcodec
SUBDIR=libavcodec
LIBAVUTIL= $(SRC_PATH)/libavutil/$(LIBPREF)avutil$(LIBSUF)
ifeq ($(BUILD_SHARED),yes)
LIBVERSION=$(LAVCVERSION)
@ -415,40 +400,21 @@ LIBMAJOR=$(LAVCMAJOR)
endif
TESTS= imgresample-test dct-test motion-test fft-test
all: $(LIB) $(SLIBNAME)
EXTRAOBJS = $(AMREXTRALIBS)
include $(SRC_PATH)/common.mak
$(LIB): $(AMRLIBS)
amrlibs:
$(MAKE) -C amr spclib fipoplib
tests: apiexample cpuid_test $(TESTS)
$(LIB): $(OBJS) $(AMRLIBS)
rm -f $@
$(AR) rc $@ $(OBJS) $(AMREXTRALIBS)
$(RANLIB) $@
$(SLIBNAME): $(OBJS)
$(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
ifeq ($(CONFIG_WIN32),yes)
-lib /machine:i386 /def:$(@:.dll=.def)
endif
dsputil.o: dsputil.c dsputil.h
%.o: %.c
$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
%.o: %.S
$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
depend: $(SRCS)
$(CC) -MM $(CFLAGS) $^ 1>.depend
dep: depend
clean: $(CLEANAMR)
rm -f *.o *.d *~ *.a *.lib *.so *.dylib *.dll \
*.dll.a *.def *.exp \
clean:: $(CLEANAMR)
rm -f \
i386/*.o i386/*~ \
armv4l/*.o armv4l/*~ \
mlib/*.o mlib/*~ \
@ -460,9 +426,6 @@ clean: $(CLEANAMR)
liba52/*.o liba52/*~ \
apiexample $(TESTS)
distclean: clean
rm -f .depend
cleanamr:
$(MAKE) -C amr clean
@ -493,30 +456,3 @@ motion-test: motion_test.o $(LIB)
fft-test: fft-test.o $(LIB)
$(CC) -o $@ $^ $(LIBAVUTIL) -lm
install-lib-shared: $(SLIBNAME)
ifeq ($(CONFIG_WIN32),yes)
install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
else
install $(INSTALLSTRIP) -m 755 $(SLIBNAME) \
$(libdir)/$(SLIBNAME_WITH_VERSION)
ln -sf $(SLIBNAME_WITH_VERSION) \
$(libdir)/$(SLIBNAME_WITH_MAJOR)
ln -sf $(SLIBNAME_WITH_VERSION) \
$(libdir)/$(SLIBNAME)
endif
install-lib-static: $(LIB)
install -m 644 $(LIB) "$(libdir)"
install-headers:
install -m 644 avcodec.h dsputil.h "$(incdir)"
install -m 644 $(SRC_PATH)/libavcodec.pc "$(libdir)/pkgconfig"
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif

View File

@ -1,81 +1,28 @@
include ../../config.mak
VPATH=$(SRC_PATH)/libavcodec/libpostproc
# Overload incdir, postproc include files go in a different directory.
incdir=$(prefix)/include/postproc
NAME=postproc
SUBDIR=libavcodec/libpostproc
ifeq ($(BUILD_SHARED),yes)
LIBVERSION=$(SPPVERSION)
LIBMAJOR=$(SPPMAJOR)
endif
OBJS=postprocess.o
SOBJS=postprocess_pic.o
STATIC_OBJS=postprocess.o
SHARED_OBJS=postprocess_pic.o
CFLAGS = $(OPTFLAGS) $(MLIB_INC) -I. -I.. $(EXTRA_INC)
HEADERS = postprocess.h
CFLAGS = $(OPTFLAGS) $(MLIB_INC) -I. -I.. -I$(SRC_PATH)/libavcodec -I../.. $(EXTRA_INC)
# -I/usr/X11R6/include/
.SUFFIXES: .c .o
# .PHONY: all clean
.c.o:
$(CC) -c $(CFLAGS) $(LIBOBJFLAGS) -I$(SRC_PATH)/libavcodec -I../.. -o $@ $<
all: $(SWSLIB) $(LIB) $(SLIBNAME)
clean:
rm -f *.o *.d *~ *.a *.lib *.so *.dylib *.dll
distclean: clean
rm -f .depend
dep: depend
depend:
$(CC) -MM $(CFLAGS) postprocess.c 1>.depend
include $(SRC_PATH)/common.mak
ifeq ($(BUILD_SHARED),yes)
postprocess_pic.o: postprocess.c
$(CC) -c $(CFLAGS) -fomit-frame-pointer -fPIC -DPIC -I.. -I../.. -o $@ $<
$(SLIBNAME): $(SOBJS)
$(CC) $(SHFLAGS) -o $(SLIBNAME) $(SOBJS)
endif
$(LIB): $(OBJS)
rm -f $@
$(AR) rc $@ $(OBJS)
$(RANLIB) $@
install-lib-shared: $(SLIBNAME)
ifeq ($(CONFIG_WIN32),yes)
install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
else
install $(INSTALLSTRIP) -m 755 $(SLIBNAME) \
$(libdir)/$(SLIBNAME_WITH_VERSION)
ln -sf $(SLIBNAME_WITH_VERSION) \
$(libdir)/$(SLIBNAME_WITH_MAJOR)
ln -sf $(SLIBNAME_WITH_VERSION) \
$(libdir)/$(SLIBNAME)
endif
install-lib-static: $(LIB)
install -m 644 $(LIB) "$(libdir)"
install-headers:
install -d "$(incdir)"
install -m 644 postprocess.h "$(incdir)/postprocess.h"
install -m 644 $(SRC_PATH)/libpostproc.pc "$(libdir)/pkgconfig"
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif

View File

@ -4,17 +4,12 @@
#
include ../config.mak
VPATH=$(SRC_PATH)/libavformat
CFLAGS=$(OPTFLAGS) -I.. -I$(SRC_PATH) -I$(SRC_PATH)/libavutil -I$(SRC_PATH)/libavcodec -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
#FIXME: This should be in configure/config.mak
ifeq ($(CONFIG_WIN32),yes)
LDFLAGS=-Wl,--output-def,$(@:.dll=.def),--out-implib,lib$(SLIBNAME:$(SLIBSUF)=.dll.a)
endif
OBJS= utils.o cutils.o os_support.o allformats.o
PPOBJS=
CPPOBJS=
HEADERS = avformat.h avio.h rtp.h rtsp.h rtspcodes.h
# demuxers
OBJS+=mpeg.o mpegts.o mpegtsenc.o ffm.o crc.o img.o img2.o raw.o rm.o \
@ -71,10 +66,10 @@ ifeq ($(CONFIG_AUDIO_OSS),yes)
OBJS+= audio.o
endif
EXTRALIBS += -L../libavutil -lavutil$(BUILDSUF)
EXTRALIBS += -L../libavutil -lavutil$(BUILDSUF) -lavcodec$(BUILDSUF) -L../libavcodec
ifeq ($(CONFIG_AUDIO_BEOS),yes)
PPOBJS+= beosaudio.o
CPPOBJS+= beosaudio.o
endif
# protocols I/O
@ -95,72 +90,11 @@ ifeq ($(CONFIG_LIBOGG),yes)
OBJS+= ogg.o
endif
ifeq ($(TARGET_ARCH_SPARC64),yes)
CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
endif
NAME=avformat
SUBDIR=libavformat
ifeq ($(BUILD_SHARED),yes)
LIBVERSION=$(LAVFVERSION)
LIBMAJOR=$(LAVFMAJOR)
AVCLIBS+=-lavcodec$(BUILDSUF) -L../libavcodec -lavutil$(BUILDSUF) -L../libavutil
endif
SRCS := $(OBJS:.o=.c) $(PPOBJS:.o=.cpp)
all: $(LIB) $(SLIBNAME)
$(LIB): $(OBJS) $(PPOBJS)
rm -f $@
$(AR) rc $@ $(OBJS) $(PPOBJS)
$(RANLIB) $@
$(SLIBNAME): $(OBJS)
$(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(PPOBJS) $(AVCLIBS) $(EXTRALIBS)
ifeq ($(CONFIG_WIN32),yes)
-lib /machine:i386 /def:$(@:.dll=.def)
endif
depend: $(SRCS)
$(CC) -MM $(CFLAGS) $^ 1>.depend
install-lib-shared: $(SLIBNAME)
ifeq ($(CONFIG_WIN32),yes)
install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
else
install $(INSTALLSTRIP) -m 755 $(SLIBNAME) \
$(libdir)/$(SLIBNAME_WITH_VERSION)
ln -sf $(SLIBNAME_WITH_VERSION) \
$(libdir)/$(SLIBNAME_WITH_MAJOR)
ln -sf $(SLIBNAME_WITH_VERSION) \
$(libdir)/$(SLIBNAME)
endif
install-lib-static: $(LIB)
install -m 644 $(LIB) "$(libdir)"
install-headers:
install -m 644 avformat.h avio.h rtp.h rtsp.h rtspcodes.h "$(incdir)"
install -m 644 $(SRC_PATH)/libavformat.pc "$(libdir)/pkgconfig"
%.o: %.c
$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
# BeOS: remove -Wall to get rid of all the "multibyte constant" warnings
%.o: %.cpp
g++ $(subst -Wall,,$(CFLAGS)) -c -o $@ $<
clean:
rm -f *.o *.d *~ *.a *.lib *.so *.dylib *.dll \
*.lib *.def *.dll.a *.exp
distclean: clean
rm -f .depend
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif
include $(SRC_PATH)/common.mak

View File

@ -3,8 +3,6 @@
#
include ../config.mak
VPATH=$(SRC_PATH)/libavutil
# NOTE: -I.. is needed to include config.h
CFLAGS=$(OPTFLAGS) -DHAVE_AV_CONFIG_H -DBUILD_AVUTIL -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
@ -18,71 +16,18 @@ OBJS= mathematics.o \
rational.o \
intfloat_readwrite.o \
HEADERS = avutil.h common.h mathematics.h integer.h rational.h \
intfloat_readwrite.h
ifeq ($(TARGET_ARCH_SPARC64),yes)
CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
endif
SRCS := $(OBJS:.o=.c)
NAME=avutil
SUBDIR = libavutil
ifeq ($(BUILD_SHARED),yes)
LIBVERSION=$(LAVUVERSION)
LIBMAJOR=$(LAVUMAJOR)
endif
all: $(LIB) $(SLIBNAME)
$(LIB): $(OBJS)
rm -f $@
$(AR) rc $@ $(OBJS)
$(RANLIB) $@
$(SLIBNAME): $(OBJS)
$(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
ifeq ($(CONFIG_WIN32),yes)
-lib /machine:i386 /def:$(@:.dll=.def)
endif
%.o: %.c
$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
depend: $(SRCS)
$(CC) -MM $(CFLAGS) $^ 1>.depend
dep: depend
clean:
rm -f *.o *.d *~ *.a *.lib *.so *.dylib *.dll \
*.lib *.def *.dll.a *.exp
distclean: clean
rm -f .depend
install-lib-shared: $(SLIBNAME)
ifeq ($(CONFIG_WIN32),yes)
install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
else
install $(INSTALLSTRIP) -m 755 $(SLIBNAME) \
$(libdir)/$(SLIBNAME_WITH_VERSION)
ln -sf $(SLIBNAME_WITH_VERSION) \
$(libdir)/$(SLIBNAME_WITH_MAJOR)
ln -sf $(SLIBNAME_WITH_VERSION) \
$(libdir)/$(SLIBNAME)
endif
install-lib-static: $(LIB)
install -m 644 $(LIB) "$(libdir)"
install-headers:
install -m 644 avutil.h common.h mathematics.h integer.h \
rational.h intfloat_readwrite.h "$(incdir)"
install -m 644 $(SRC_PATH)/libavutil.pc "$(libdir)/pkgconfig"
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif
include $(SRC_PATH)/common.mak