[x264-devel] [PATCH] build: Generate dependency information as a side-effect of compilation
Steven Walters
kemuri9 at gmail.com
Sat May 3 18:20:18 CEST 2014
The frequency into which files include more additional headers
(dependencies expand), where this is actually beneficial is not that
prevalent on the project.
Also, this noticeably degrades the performance of building with ICL
(and similarly MSVS) where dependency generation is considerably
slower than gcc.
As such, I'm not sure as to the worth of this.
On Sat, May 3, 2014 at 10:30 AM, Diego Biurrun <diego at biurrun.de> wrote:
> This allows updating dependency information each time a file is changed,
> instead of creating dependency information once at the first build. In the
> latter case, dependency information is not updated each time a file is
> changed so that it can get out of date quickly.
> ---
>
> This could still use some testing on ARM and ICL.
>
> .gitignore | 2 +-
> Makefile | 27 +++++++++++----------------
> configure | 8 ++------
> 3 files changed, 14 insertions(+), 23 deletions(-)
>
> diff --git a/.gitignore b/.gitignore
> index 0ff9fed..4cf8134 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -1,5 +1,6 @@
> *~
> *.a
> +*.d
> *.diff
> *.orig
> *.rej
> @@ -16,7 +17,6 @@
> *.so*
> *.dylib
> .*.swp
> -.depend
> .DS_Store
> config.h
> config.mak
> diff --git a/Makefile b/Makefile
> index 3b64bb6..b9d95dc 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -140,12 +140,12 @@ cli: x264$(EXE)
> lib-static: $(LIBX264)
> lib-shared: $(SONAME)
>
> -$(LIBX264): $(GENERATED) .depend $(OBJS) $(OBJASM)
> +$(LIBX264): $(GENERATED) $(OBJS) $(OBJASM)
> rm -f $(LIBX264)
> $(AR)$@ $(OBJS) $(OBJASM)
> $(if $(RANLIB), $(RANLIB) $@)
>
> -$(SONAME): $(GENERATED) .depend $(OBJS) $(OBJASM) $(OBJSO)
> +$(SONAME): $(GENERATED) $(OBJS) $(OBJASM) $(OBJSO)
> $(LD)$@ $(OBJS) $(OBJASM) $(OBJSO) $(SOFLAGS) $(LDFLAGS)
>
> ifneq ($(EXE),)
> @@ -154,15 +154,14 @@ x264: x264$(EXE)
> checkasm: checkasm$(EXE)
> endif
>
> -x264$(EXE): $(GENERATED) .depend $(OBJCLI) $(CLI_LIBX264)
> +x264$(EXE): $(GENERATED) $(OBJCLI) $(CLI_LIBX264)
> $(LD)$@ $(OBJCLI) $(CLI_LIBX264) $(LDFLAGSCLI) $(LDFLAGS)
>
> -checkasm$(EXE): $(GENERATED) .depend $(OBJCHK) $(LIBX264)
> +checkasm$(EXE): $(GENERATED) $(OBJCHK) $(LIBX264)
> $(LD)$@ $(OBJCHK) $(LIBX264) $(LDFLAGS)
>
> -$(OBJS) $(OBJASM) $(OBJSO) $(OBJCLI) $(OBJCHK): .depend
> -
> %.o: %.asm
> + $(AS) $(ASFLAGS) -M -o $@ $< > $(@:.o=.d)
> $(AS) $(ASFLAGS) -o $@ $<
> -@ $(if $(STRIP), $(STRIP) -x $@) # delete local/anonymous symbols, so they don't show up in oprofile
>
> @@ -176,17 +175,13 @@ $(OBJS) $(OBJASM) $(OBJSO) $(OBJCLI) $(OBJCHK): .depend
> %.o: %.rc x264.h
> $(RC) $(RCFLAGS)$@ $<
>
> -.depend: config.mak
> - @rm -f .depend
> - @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS) $(SRCCLI) $(SRCSO)), $(CC) $(CFLAGS) $(SRC) $(DEPMT) $(SRC:$(SRCPATH)/%.c=%.o) $(DEPMM) 1>> .depend;)
> -
> config.mak:
> ./configure
>
> -depend: .depend
> -ifneq ($(wildcard .depend),)
> -include .depend
> -endif
> +ALLOBJS = $(OBJS) $(OBJASM) $(OBJSO) $(OBJCLI) $(OBJCHK)
> +ALLDEPS = $(ALLOBJS:.o=.d)
> +
> +-include $(ALLDEPS)
>
> SRC2 = $(SRCS) $(SRCCLI)
> # These should cover most of the important codepaths
> @@ -215,8 +210,8 @@ fprofiled:
> endif
>
> clean:
> - rm -f $(OBJS) $(OBJASM) $(OBJCLI) $(OBJSO) $(SONAME) *.a *.lib *.exp *.pdb x264 x264.exe .depend TAGS
> - rm -f checkasm checkasm.exe $(OBJCHK) $(GENERATED) x264_lookahead.clbin
> + rm -f $(ALLOBJS) $(ALLDEPS) $(SONAME) *.a *.lib *.exp *.pdb x264 x264.exe TAGS
> + rm -f checkasm checkasm.exe $(GENERATED) x264_lookahead.clbin
> rm -f $(SRC2:%.c=%.gcda) $(SRC2:%.c=%.gcno) *.dyn pgopti.dpi pgopti.dpi.lock
>
> distclean: clean
> diff --git a/configure b/configure
> index b7b3ef9..4225da0 100755
> --- a/configure
> +++ b/configure
> @@ -1092,8 +1092,7 @@ done
>
> if [ $compiler = ICL ]; then
> AR="xilib -nologo -out:"
> - DEPMM=-QMM
> - DEPMT=-QMT
> + CFLAGS="-QMMD $CFLAGS"
> HAVE_GETOPT_LONG=0
> LD="xilink -out:"
> LDFLAGS="-nologo -incremental:no $(icl_ldflags $LDFLAGS)"
> @@ -1110,8 +1109,7 @@ if [ $compiler = ICL ]; then
> fi
> else
> AR="$AR rc "
> - DEPMM="-MM -g0"
> - DEPMT="-MT"
> + CFLAGS="-MMD $CFLAGS"
> LD="$CC -o "
> LIBX264=libx264.a
> [ -n "$RC" ] && RCFLAGS="$RCFLAGS -I. -o "
> @@ -1157,8 +1155,6 @@ ARCH=$ARCH
> SYS=$SYS
> CC=$CC
> CFLAGS=$CFLAGS
> -DEPMM=$DEPMM
> -DEPMT=$DEPMT
> LD=$LD
> LDFLAGS=$LDFLAGS
> LIBX264=$LIBX264
> --
> 1.8.3.2
>
> _______________________________________________
> x264-devel mailing list
> x264-devel at videolan.org
> https://mailman.videolan.org/listinfo/x264-devel
More information about the x264-devel
mailing list