[FFmpeg-devel] [PATCH] examples: move API examples to a dedicated dir in docs

Stefano Sabatini stefano.sabatini-lala at poste.it
Sun May 29 12:49:19 CEST 2011


---
 doc/api-examples/Makefile                          |   21 ++++++++++++++++++++
 {libavcodec => doc/api-examples}/api-example.c     |    0
 {libavformat => doc/api-examples}/output-example.c |    0
 libavcodec/Makefile                                |    2 -
 libavformat/Makefile                               |    1 -
 5 files changed, 21 insertions(+), 3 deletions(-)
 create mode 100644 doc/api-examples/Makefile
 rename {libavcodec => doc/api-examples}/api-example.c (100%)
 rename {libavformat => doc/api-examples}/output-example.c (100%)

diff --git a/doc/api-examples/Makefile b/doc/api-examples/Makefile
new file mode 100644
index 0000000..facbd7e
--- /dev/null
+++ b/doc/api-examples/Makefile
@@ -0,0 +1,21 @@
+# use pkg-config for getting CFLAGS abd LDFLAGS
+FFMPEG_LIBS=libavdevice libavformat libavfilter libavcodec libswscale libavutil
+CFLAGS+=$(shell pkg-config  --cflags $(FFMPEG_LIBS))
+LDFLAGS+=$(shell pkg-config --libs $(FFMPEG_LIBS))
+
+EXAMPLES=api-example output-example
+
+OBJS=$(addsuffix .o,$(EXAMPLES))
+
+%: %.o
+	$(CC) $< $(LDFLAGS) -o $@
+
+%.o: %.c
+	$(CC) $< $(CFLAGS) -c -o $@
+
+.phony: all clean
+
+all: $(OBJS) $(EXAMPLES)
+
+clean:
+	rm -rf $(EXAMPLES) $(OBJS)
diff --git a/libavcodec/api-example.c b/doc/api-examples/api-example.c
similarity index 100%
rename from libavcodec/api-example.c
rename to doc/api-examples/api-example.c
diff --git a/libavformat/output-example.c b/doc/api-examples/output-example.c
similarity index 100%
rename from libavformat/output-example.c
rename to doc/api-examples/output-example.c
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 95d08ea..76cb8cd 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -674,8 +674,6 @@ SKIPHEADERS-$(CONFIG_VAAPI)            += vaapi_internal.h
 SKIPHEADERS-$(CONFIG_VDPAU)            += vdpau.h
 SKIPHEADERS-$(CONFIG_XVMC)             += xvmc.h
 
-EXAMPLES = api
-
 TESTPROGS = cabac dct eval fft fft-fixed h264 iirfilter rangecoder snow
 TESTPROGS-$(HAVE_MMX) += motion
 TESTOBJS = dctref.o
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 55f6152..6d3a027 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -340,7 +340,6 @@ OBJS-$(CONFIG_UDP_PROTOCOL)              += udp.o
 # libavdevice dependencies
 OBJS-$(CONFIG_JACK_INDEV)                += timefilter.o
 
-EXAMPLES  = output
 TESTPROGS = timefilter
 
 include $(SUBDIR)../subdir.mak
-- 
1.7.2.3



More information about the ffmpeg-devel mailing list