日期:2014-05-16  浏览次数:20760 次

关于Makefile,急求帮助?
include   config.mak

VPATH=$(SRC_PATH_BARE)

CFLAGS=$(OPTFLAGS)   -I$(BUILD_ROOT)   -I$(SRC_PATH)   -I$(SRC_PATH)/libavutil   \
              -I$(SRC_PATH)/libavcodec   -I$(SRC_PATH)/libavformat   -I$(SRC_PATH)/libswscale   \
              -D_FILE_OFFSET_BITS=64   -D_LARGEFILE_SOURCE   -D_ISOC9X_SOURCE
LDFLAGS+=   -g

ifeq   ($(CONFIG_FFMPEG),yes)
MANPAGES=doc/ffmpeg.1
PROGS_G+=ffmpeg_g$(EXESUF)
PROGS+=ffmpeg$(EXESUF)
endif

ifeq   ($(CONFIG_FFSERVER),yes)
MANPAGES+=doc/ffserver.1
PROGS+=ffserver$(EXESUF)
endif

ifeq   ($(CONFIG_FFPLAY),yes)
MANPAGES+=doc/ffplay.1
PROGS_G+=ffplay_g$(EXESUF)
PROGS+=ffplay$(EXESUF)
endif

BASENAMES=ffmpeg   ffplay   ffserver
ALLPROGS=$(addsuffix   $(EXESUF),   $(BASENAMES))
ALLPROGS_G=$(addsuffix   _g$(EXESUF),   $(BASENAMES))
ALLMANPAGES=$(addsuffix   .1,   $(BASENAMES))

ifeq   ($(BUILD_SHARED),yes)
DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF)   libavformat/$(SLIBPREF)avformat$(SLIBSUF)
else
DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF)   libavformat/$(LIBPREF)avformat$(LIBSUF)
endif

ifeq   ($(CONFIG_VHOOK),yes)
VHOOK=videohook
INSTALLVHOOK=install-vhook
endif

ifeq   ($(BUILD_DOC),yes)
DOC=documentation
INSTALLMAN=install-man
endif

OBJS   =   ffmpeg.o   ffserver.o   cmdutils.o   ffplay.o
SRCS   =   $(OBJS:.o=.c)   $(ASM_OBJS:.o=.s)
LDFLAGS   :=   -L$(BUILD_ROOT)/libavformat   -L$(BUILD_ROOT)/libavcodec   -L$(BUILD_ROOT)/libavutil   $(LDFLAGS)
EXTRALIBS   :=   -lavformat$(BUILDSUF)   -lavcodec$(BUILDSUF)   -lavutil$(BUILDSUF)   $(EXTRALIBS)

ifeq   ($(CONFIG_SWSCALER),yes)
LDFLAGS+=-L./libswscale
EXTRALIBS+=-lswscale$(BUILDSUF)
endif

all:   lib   $(PROGS)   $(VHOOK)   $(DOC)

lib:
                $(MAKE)   -C   libavutil       all
                $(MAKE)   -C   libavcodec     all
                $(MAKE)   -C   libavformat   all
ifeq   ($(CONFIG_PP),yes)
                $(MAKE)   -C   libpostproc   all
endif
ifeq   ($(CONFIG_SWSCALER),yes)
                $(MAKE)   -C   libswscale     all
endif

ffmpeg_g$(EXESUF):   ffmpeg.o   cmdutils.o   .libs
                $(CC)   $(LDFLAGS)   -o   $@   ffmpeg.o   cmdutils.o   $(EXTRALIBS)

ffserver$(EXESUF):   ffserver.o   .libs
                $(CC)   $(LDFLAGS)   $(FFSERVERLDFLAGS)   -o   $@   ffserver.o   $(EXTRALIBS)

ffplay_g$(EXESUF):   ffplay.o   cmdutils.o   .libs
                $(CC)   $(LDFLAGS)   -o   $@   ffplay.o   cmdutils.o   $(EXTRALIBS)   $(SDL_LIBS)

%$(EXESUF):   %_g$(EXESUF)