本人开发时的makefile,仅供参考(略去些许细节)
# use pkg-config for getting CFLAGS and LDLIBS
FFMPEG_LIBS= libavdevice \
libavformat \
libavfilter \
libavcodec \
libswresample \
libswscale \
libavutil \
sdl \
CFLAGS += -Wall -g
INCLUDES:=$(shell pkg-config --cflags libavformat libavcodec libswscale libavutil sdl)
CFLAGS := $(shell pkg-config --cflags $(FFMPEG_LIBS)) $(CFLAGS)
LDFLAGS:=$(shell pkg-config --libs libavformat libavcodec libswscale libavutil libswresample sdl) -lm
LDLIBS := $(shell pkg-config --libs $(FFMPEG_LIBS)) $(LDLIBS)
EXE:= muxing.out demo.out
#OBJS=$(addsuffix .o,$(EXAMPLES))
# the following examples make explicit use of the math library
# decoding_encoding: LDLIBS += -lm
muxing: LDLIBS += -lm
#.phony: all clean-test clean
#all: $(OBJS) $(EXAMPLES)
all: dirs $(addprefix bin/, $(EXE)) tags
dirs:
mkdir -p obj
mkdir -p bin
tags: *.c
ctags *.c
bin/%.out: obj/%.o
$(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
obj/%.o : %.c
$(CC) $(CFLAGS) $< $(INCLUDES) -c -o $@
#clean-test:
#$(RM) test*.pgm test.h264 test.mp2 test.sw test.mpg
#clean: clean-test
#$(RM) $(EXAMPLES) $(OBJS)
clean:
rm -f obj/*
rm -f bin/*
rm -f tags