[FFmpeg-devel] [PATCH v2] Beautify build output making it easier to see compiler warnings
Georgi Chorbadzhiyski
gf
Fri Mar 5 09:59:41 CET 2010
Around 03/04/10 16:37, Luca Barbato scribbled:
> On 03/03/2010 05:57 PM, Georgi Chorbadzhiyski wrote:
>> With this patch the build output will look similar to Linux Kernel kbuild and git.
>> Something like this:
>>
>> CC libavdevice/alldevices.c
>> libavdevice/alldevices.c:32: warning: no previous prototype for 'avdevice_register_all'
>> CC libavdevice/avdevice.c
>> CC libavdevice/alsa-audio-common.c
>>
>> This makes it very easy to see compiler warnings for example. If you want
>> to see the whole command that make executes you may use
>>
>> make Q=
>
> Usually you call it with V=1, beside that I did something like that long
> ago, yours seems less invasive since doesn't cover the install target.
Of course it should be with V=1, my bad. Attached version 2 of the patch now
with added support for install and uninstall targets, also make V=1 should be
used to see the executed command or exported BUILD_OUPUT=1.
make clean and distclean are not covered in the moment. I can easily add them
but I don't think their output will improve.
diffstat pretty-build-output_v2.diff
Makefile | 67 ++++++++++++++++++++++++++++++++-------------------
common.mak | 37 +++++++++++++++++++++++-----
subdir.mak | 79 ++++++++++++++++++++++++++++++++++++-------------------------
3 files changed, 119 insertions(+), 64 deletions(-)
--
Georgi Chorbadzhiyski
http://georgi.unixsol.org/
-------------- next part --------------
The following patch makes the build output look similar to Linux Kernel
kbuild and git. Something like this:
BUILD version.h
CC libavdevice/alldevices.c
CC libavdevice/v4l.c
RANLIB libavdevice/libavdevice.a
CC ffmpeg
LD ffmpeg.o
STRIP ffmpeg
INSTALL /usr/local/lib/libavdevice.a
INSTALL /usr/local/lib/libavdevice.so
INSTALL /usr/local/lib/libavdevice.so.52
INSTALL /usr/local/lib/libavdevice.so.52.2.0
This makes it very easy to see compiler warnings for example. If you want
to see the whole command that make executes you may use
make V=1
or export BUILD_VERBOSE=1 in your $HOME/.profile
Signed-off-by: Georgi Chorbadzhiyski <gf at unixsol.org>
diff --git a/common.mak b/common.mak
index 5420c7d..422bde3 100644
--- a/common.mak
+++ b/common.mak
@@ -17,26 +17,46 @@ else
BUILD_ROOT_REL = ..
endif
+# Default to quiet build unless V=1 is set on the make command line
+# or BUILD_VERBOSE=1 is exported in the environment
+ifeq ("$(origin V)", "command line")
+ BUILD_VERBOSE = $(V)
+endif
+
+ifndef BUILD_VERBOSE
+ BUILD_VERBOSE = 0
+endif
+
+ifeq ($(BUILD_VERBOSE),1)
+ Q =
+else
+ Q = @
+endif
+
ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
CPPFLAGS := -DHAVE_AV_CONFIG_H -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(CPPFLAGS)
CFLAGS += $(ECFLAGS)
%.o: %.c
+ @echo " CC $<"
$(CCDEP)
- $(CC) $(CPPFLAGS) $(CFLAGS) $(CC_DEPFLAGS) -c $(CC_O) $<
+ $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) $(CC_DEPFLAGS) -c $(CC_O) $<
%.o: %.S
+ @echo " AS $<"
$(ASDEP)
- $(AS) $(CPPFLAGS) $(ASFLAGS) $(AS_DEPFLAGS) -c -o $@ $<
+ $(Q)$(AS) $(CPPFLAGS) $(ASFLAGS) $(AS_DEPFLAGS) -c -o $@ $<
%.ho: %.h
- $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
+ @echo " CC $<"
+ $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
%$(EXESUF): %.c
%.ver: %.v
- sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
+ @echo " BUILD $@"
+ $(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
@@ -44,7 +64,8 @@ $(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
endif
$(BUILD_ROOT_REL)/version.h: $(SRC_PATH_BARE)/version.sh config.mak
- $< $(SRC_PATH) $@ $(EXTRA_VERSION)
+ @echo " BUILD $@"
+ $(Q)$< $(SRC_PATH) $@ $(EXTRA_VERSION)
install: install-libs install-headers
@@ -83,10 +104,12 @@ SKIPHEADERS = $(addprefix $(SUBDIR),$(SKIPHEADERS-))
checkheaders: $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho))
$(HOSTOBJS): %.o: %.c
- $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
+ @echo " HOSTCC $<"
+ $(Q)$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
$(HOSTPROGS): %$(HOSTEXESUF): %.o
- $(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
+ @echo " HOSTCC $<"
+ $(Q)$(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
DEPS := $(OBJS:.o=.d)
depend dep: $(DEPS)
diff --git a/subdir.mak b/subdir.mak
index 2448950..2a83a41 100644
--- a/subdir.mak
+++ b/subdir.mak
@@ -11,9 +11,10 @@ all: $(SUBDIR)$(LIBNAME)
install-libs: install-lib$(NAME)-static
$(SUBDIR)$(LIBNAME): $(OBJS)
- rm -f $@
- $(AR) rc $@ $^ $(EXTRAOBJS)
- $(RANLIB) $@
+ @echo " RANLIB $@"
+ $(Q)rm -f $@
+ $(Q)$(AR) rc $@ $^ $(EXTRAOBJS)
+ $(Q)$(RANLIB) $@
endif
INCINSTDIR := $(INCDIR)/lib$(NAME)
@@ -22,17 +23,21 @@ THIS_LIB := $(SUBDIR)$($(CONFIG_SHARED:yes=S)LIBNAME)
define RULES
$(SUBDIR)%$(EXESUF): $(SUBDIR)%.o
- $(LD) $(FFLDFLAGS) -o $$@ $$^ -l$(FULLNAME) $(FFEXTRALIBS) $$(ELIBS)
+ @echo " LD $$@"
+ $(Q)$(LD) $(FFLDFLAGS) -o $$@ $$^ -l$(FULLNAME) $(FFEXTRALIBS) $$(ELIBS)
$(SUBDIR)%-test.o: $(SUBDIR)%.c
- $(CC) $(CPPFLAGS) $(CFLAGS) -DTEST -c $$(CC_O) $$^
+ @echo " CC $$^"
+ $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -DTEST -c $$(CC_O) $$^
$(SUBDIR)%-test.o: $(SUBDIR)%-test.c
- $(CC) $(CPPFLAGS) $(CFLAGS) -DTEST -c $$(CC_O) $$^
+ @echo " CC $$^"
+ $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -DTEST -c $$(CC_O) $$^
$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
- $(YASM) $(YASMFLAGS) -I $$(<D)/ -M -o $$@ $$< > $$(@:.o=.d)
- $(YASM) $(YASMFLAGS) -I $$(<D)/ -o $$@ $$<
+ @echo " YASM $$<"
+ $(Q)$(YASM) $(YASMFLAGS) -I $$(<D)/ -M -o $$@ $$< > $$(@:.o=.d)
+ $(Q)$(YASM) $(YASMFLAGS) -I $$(<D)/ -o $$@ $$<
clean::
rm -f $(addprefix $(SUBDIR),*-example$(EXESUF) *-test$(EXESUF) $(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
@@ -49,12 +54,13 @@ all: $(SUBDIR)$(SLIBNAME)
install-libs: install-lib$(NAME)-shared
$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
- cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
+ $(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SUBDIR)lib$(NAME).ver
- $(SLIB_CREATE_DEF_CMD)
- $(LD) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$(filter %.o,$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
- $(SLIB_EXTRA_CMD)
+ @echo " LD $$@"
+ $(Q)$(SLIB_CREATE_DEF_CMD)
+ $(Q)$(LD) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$(filter %.o,$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
+ $(Q)$(SLIB_EXTRA_CMD)
ifdef SUBDIR
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(DEP_LIBS)
@@ -62,40 +68,49 @@ endif
endif
install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
- install -d "$(SHLIBDIR)"
- install -m 755 $$< "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
- $(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
- cd "$(SHLIBDIR)" && \
+ @echo " INSTALL $(SHLIBDIR)/$(SLIBNAME)"
+ @echo " INSTALL $(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)"
+ @echo " INSTALL $(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
+ $(Q)install -d "$(SHLIBDIR)"
+ $(Q)install -m 755 $$< "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
+ $(Q)$(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
+ $(Q)cd "$(SHLIBDIR)" && \
$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
- cd "$(SHLIBDIR)" && \
+ $(Q)cd "$(SHLIBDIR)" && \
$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
- $(SLIB_INSTALL_EXTRA_CMD)
+ $(Q)$(SLIB_INSTALL_EXTRA_CMD)
install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)
- install -d "$(LIBDIR)"
- install -m 644 $$< "$(LIBDIR)"
- $(LIB_INSTALL_EXTRA_CMD)
+ @echo " INSTALL $(LIBDIR)/$(LIBNAME)"
+ $(Q)install -d "$(LIBDIR)"
+ $(Q)install -m 644 $$< "$(LIBDIR)"
+ $(Q)$(LIB_INSTALL_EXTRA_CMD)
install-headers::
- install -d "$(INCINSTDIR)"
- install -d "$(LIBDIR)/pkgconfig"
- install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(INCINSTDIR)"
+ @echo " INSTALL $(addprefix $(INCINSTDIR)/,$(HEADERS))"
+ $(Q)install -d "$(INCINSTDIR)"
+ $(Q)install -d "$(LIBDIR)/pkgconfig"
+ $(Q)install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(INCINSTDIR)"
ifdef BUILT_HEADERS
- install -m 644 $(addprefix $(SUBDIR),$(BUILT_HEADERS)) "$(INCINSTDIR)"
+ @echo " INSTALL $(addprefix $(INCINSTDIR)/,$(BUILT_HEADERS))"
+ $(Q)install -m 644 $(addprefix $(SUBDIR),$(BUILT_HEADERS)) "$(INCINSTDIR)"
endif
- install -m 644 $(BUILD_ROOT)/lib$(NAME)/lib$(NAME).pc "$(LIBDIR)/pkgconfig"
+ $(Q)install -m 644 $(BUILD_ROOT)/lib$(NAME)/lib$(NAME).pc "$(LIBDIR)/pkgconfig"
uninstall-libs::
- -rm -f "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
+ @echo " UNINSTALL $(LIBDIR)/$(LIBNAME) $(SHLIBDIR)/$(SLIBNAME) $(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR) $(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
+ -$(Q)rm -f "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
"$(SHLIBDIR)/$(SLIBNAME)" \
"$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
- -$(SLIB_UNINSTALL_EXTRA_CMD)
- -rm -f "$(LIBDIR)/$(LIBNAME)"
+ -$(Q)$(SLIB_UNINSTALL_EXTRA_CMD)
+ -$(Q)rm -f "$(LIBDIR)/$(LIBNAME)"
uninstall-headers::
- rm -f $(addprefix "$(INCINSTDIR)/",$(HEADERS))
- rm -f "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
- -rmdir "$(INCDIR)"
+ @echo " UNINSTALL $(addprefix "$(INCINSTDIR)/",$(HEADERS))"
+ @echo " UNINSTALL $(LIBDIR)/pkgconfig/lib$(NAME).pc"
+ $(Q)rm -f $(addprefix "$(INCINSTDIR)/",$(HEADERS))
+ $(Q)rm -f "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
+ -$(Q)rmdir "$(INCDIR)" 2>/dev/null ; exit 0
endef
$(eval $(RULES))
diff --git a/Makefile b/Makefile
index 5ba08fd..d8575a7 100644
--- a/Makefile
+++ b/Makefile
@@ -49,8 +49,9 @@ INSTALL_PROGS_TARGETS-$(CONFIG_SHARED) = install-libs
all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
$(PROGS): %$(EXESUF): %_g$(EXESUF)
- cp -p $< $@
- $(STRIP) $@
+ @echo " STRIP $@"
+ $(Q)cp -p $< $@
+ $(Q)$(STRIP) $@
SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
@@ -73,13 +74,16 @@ ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
%_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
- $(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
+ @echo " LD $<"
+ $(Q)$(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
tools/%$(EXESUF): tools/%.o
- $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
+ @echo " LD $<"
+ $(Q)$(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
tools/%.o: tools/%.c
- $(CC) $(CPPFLAGS) $(CFLAGS) $(CC_O) $<
+ @echo " CC $<"
+ $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) $(CC_O) $<
ffplay.o ffplay.d: CFLAGS += $(SDL_CFLAGS)
@@ -92,39 +96,48 @@ documentation: $(addprefix doc/, developer.html faq.html ffmpeg-doc.html \
general.html libavfilter.html $(ALLMANPAGES))
doc/%.html: doc/%.texi
- texi2html -monolithic -number $<
- mv $(@F) $@
+ @echo " TEXI2HTML $<"
+ $(Q)texi2html -monolithic -number $<
+ $(Q)mv $(@F) $@
doc/%.pod: doc/%-doc.texi
- doc/texi2pod.pl $< $@
+ @echo " TEXI2POD $<"
+ $(Q)doc/texi2pod.pl $< $@
doc/%.1: doc/%.pod
- pod2man --section=1 --center=" " --release=" " $< > $@
+ @echo " POD2MAN $<"
+ $(Q)pod2man --section=1 --center=" " --release=" " $< > $@
install: $(INSTALL_TARGETS-yes)
install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
- install -d "$(BINDIR)"
- install -c -m 755 $(PROGS) "$(BINDIR)"
+ @echo " INSTALL $(addprefix "$(BINDIR)/", $(PROGS))"
+ $(Q)install -d "$(BINDIR)"
+ $(Q)install -c -m 755 $(PROGS) "$(BINDIR)"
install-data: $(DATA_FILES)
- install -d "$(DATADIR)"
- install -m 644 $(DATA_FILES) "$(DATADIR)"
+ @echo " INSTALL $(addprefix $(DATADIR)/, $(notdir $(DATA_FILES)))"
+ $(Q)install -d "$(DATADIR)"
+ $(Q)install -m 644 $(DATA_FILES) "$(DATADIR)"
install-man: $(MANPAGES)
- install -d "$(MANDIR)/man1"
- install -m 644 $(MANPAGES) "$(MANDIR)/man1"
+ @echo " INSTALL \"$(MANDIR)/man1\" $(MANPAGES)"
+ $(Q)install -d "$(MANDIR)/man1"
+ $(Q)install -m 644 $(MANPAGES) "$(MANDIR)/man1"
uninstall: uninstall-progs uninstall-data uninstall-man
uninstall-progs:
- rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
+ @echo " UNINSTALL $(addprefix $(BINDIR)/, $(ALLPROGS))"
+ $(Q)rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
uninstall-data:
- rm -rf "$(DATADIR)"
+ @echo " UNINSTALL $(DATADIR)"
+ @rm -rf "$(DATADIR)"
uninstall-man:
- rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
+ @echo " UNINSTALL $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))"
+ $(Q)rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
testclean:
rm -rf tests/vsynth1 tests/vsynth2 tests/data
@@ -300,19 +313,23 @@ ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
$(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf
tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
- mkdir -p tests/vsynth1
- $(BUILD_ROOT)/$< 'tests/vsynth1/'
+ @echo " RUN $<"
+ $(Q)mkdir -p tests/vsynth1
+ $(Q)$(BUILD_ROOT)/$< 'tests/vsynth1/'
tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
- mkdir -p tests/vsynth2
- $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
+ @echo " RUN $<"
+ $(Q)mkdir -p tests/vsynth2
+ $(Q)$(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
- mkdir -p tests/data
- $(BUILD_ROOT)/$< $@
+ @echo " RUN $<"
+ $(Q)mkdir -p tests/data
+ $(Q)$(BUILD_ROOT)/$< $@
tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS)
- $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
+ @echo " LD $<"
+ $(Q)$(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
.PHONY: documentation *test regtest-* zlib-error alltools check config
More information about the ffmpeg-devel
mailing list