ffmpeg | branch: master | Christophe Gisquet <christophe.gisq...@gmail.com> | Sun Feb 8 12:18:27 2015 +0100| [bc8e044d8c3277958c920091412b77d4e7411d96] | committer: Michael Niedermayer
x86/doc/Makefile: DBG=1 to preprocess external asm The macro hell sometimes make it difficult to trace the source of an error, so it is easier to analyze the preprocessed output. This patch makes this automatical by specifying DBG=1 on the command line: a file ffmpeg/dir/file.asm gets preprocessed to builddir/dir/file.dbg.asm, which is then compiled. Signed-off-by: Michael Niedermayer <michae...@gmx.at> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bc8e044d8c3277958c920091412b77d4e7411d96 --- common.mak | 10 +++++++++- doc/build_system.txt | 5 +++++ doc/optimization.txt | 5 +++++ library.mak | 6 +++++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/common.mak b/common.mak index a493792..a6fabb3 100644 --- a/common.mak +++ b/common.mak @@ -5,6 +5,14 @@ # first so "all" becomes default target all: all-yes +DEFAULT_YASMD=.dbg + +ifndef DBG +YASMD= +else +YASMD=$(DEFAULT_YASMD) +endif + ifndef SUBDIR ifndef V @@ -138,7 +146,7 @@ $(TOOLOBJS): | tools OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(SLIBOBJS) $(TESTOBJS)) -CLEANSUFFIXES = *.d *.o *~ *.h.c *.map *.ver *.ho *.gcno *.gcda +CLEANSUFFIXES = *.d *.o *~ *.h.c *.map *.ver *.ho *.gcno *.gcda *$(DEFAULT_YASMD).asm DISTCLEANSUFFIXES = *.pc LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a diff --git a/doc/build_system.txt b/doc/build_system.txt index 2efde5c..20242b1 100644 --- a/doc/build_system.txt +++ b/doc/build_system.txt @@ -7,6 +7,11 @@ V Disable the default terse mode, the full command issued by make and its output will be shown on the screen. +DBG + Preprocess x86 external assembler files to a .dbg.asm file in the object + directory, which then gets compiled. Helps developping those assembler + files. + DESTDIR Destination directory for the install targets, useful to prepare packages or install FFmpeg in cross-environments. diff --git a/doc/optimization.txt b/doc/optimization.txt index 94a4277..1a0b98c 100644 --- a/doc/optimization.txt +++ b/doc/optimization.txt @@ -191,6 +191,11 @@ __asm__() block. Use external asm (nasm/yasm) or inline asm (__asm__()), do not use intrinsics. The latter requires a good optimizing compiler which gcc is not. +When debugging a x86 external asm compilation issue, if lost in the macro +expansions, add DBG=1 to your make command-line: the input file will be +preprocessed, stripped of the debug/empty lines, then compiled, showing the +actual lines causing issues. + Inline asm vs. external asm --------------------------- Both inline asm (__asm__("..") in a .c file, handled by a compiler such as gcc) diff --git a/library.mak b/library.mak index 72e5574..e23abd2 100644 --- a/library.mak +++ b/library.mak @@ -22,7 +22,11 @@ $(SUBDIR)%-test.i: $(SUBDIR)%-test.c $(SUBDIR)%-test.i: $(SUBDIR)%.c $(CC) $(CCFLAGS) $(CC_E) $< -$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm +$(SUBDIR)x86/%$(DEFAULT_YASMD).asm: $(SUBDIR)x86/%.asm + $(DEPYASM) $(YASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.asm=.d) + $(YASM) $(YASMFLAGS) -I $(<D)/ -e $< | sed '/^%/d;/^$$/d;' > $@ + +$(SUBDIR)x86/%.o: $(SUBDIR)x86/%$(YASMD).asm $(DEPYASM) $(YASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.o=.d) $(YASM) $(YASMFLAGS) -I $(<D)/ -o $@ $< -$(if $(ASMSTRIPFLAGS), $(STRIP) $(ASMSTRIPFLAGS) $@) _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog