Use gcc's built-in dependency generation, thanks to Adam Strzelecki
authorSam Lantinga <slouken@libsdl.org>
Sun, 04 Oct 2009 04:28:46 +0000
changeset 422614c9a2f8279
parent 421 de784f36729a
child 423 f79b6b1367f4
Use gcc's built-in dependency generation, thanks to Adam Strzelecki
Makefile.in
build-scripts/makedep.sh
configure.in
     1.1 --- a/Makefile.in	Sun Oct 04 02:54:48 2009 +0000
     1.2 +++ b/Makefile.in	Sun Oct 04 04:28:46 2009 +0000
     1.3 @@ -3,14 +3,14 @@
     1.4  top_builddir = .
     1.5  srcdir  = @srcdir@
     1.6  objects = build
     1.7 -depend	= build-deps
     1.8  prefix = @prefix@
     1.9  exec_prefix = @exec_prefix@
    1.10  bindir	= $(DESTDIR)@bindir@
    1.11  libdir  = $(DESTDIR)@libdir@
    1.12  includedir = $(DESTDIR)@includedir@
    1.13 -datadir	= $(DESTDIR)@datadir@
    1.14 -mandir	= $(DESTDIR)@mandir@
    1.15 +datarootdir = $(DESTDIR)@datarootdir@
    1.16 +datadir	= @datadir@
    1.17 +mandir	= @mandir@
    1.18  auxdir	= @ac_aux_dir@
    1.19  distpath = $(srcdir)/..
    1.20  distdir = SDL_mixer-@VERSION@
    1.21 @@ -33,8 +33,10 @@
    1.22  SDL_LIBS = @SDL_LIBS@
    1.23  
    1.24  TARGET  = libSDL_mixer.la
    1.25 -SOURCES = @SOURCES@
    1.26  OBJECTS = @OBJECTS@
    1.27 +VERSION_OBJECTS = @VERSION_OBJECTS@
    1.28 +PLAYWAVE_OBJECTS = @PLAYWAVE_OBJECTS@
    1.29 +PLAYMUS_OBJECTS = @PLAYMUS_OBJECTS@
    1.30  
    1.31  DIST = CHANGES COPYING CWProjects.sea.bin MPWmake.sea.bin Makefile.in SDL_mixer.pc.in README SDL_mixer.h SDL_mixer.qpg.in SDL_mixer.spec SDL_mixer.spec.in VisualC.zip Watcom-OS2.zip Xcode.tar.gz acinclude autogen.sh build-scripts configure configure.in dynamic_mp3.c dynamic_mp3.h dynamic_ogg.c dynamic_ogg.h effect_position.c effect_stereoreverse.c effects_internal.c effects_internal.h gcc-fat.sh load_aiff.c load_aiff.h load_ogg.c load_ogg.h load_voc.c load_voc.h mikmod mixer.c music.c music_cmd.c music_cmd.h music_mad.c music_mad.h music_ogg.c music_ogg.h native_midi native_midi_gpl playmus.c playwave.c timidity wavestream.c wavestream.h version.rc
    1.32  
    1.33 @@ -57,28 +59,27 @@
    1.34  $(objects):
    1.35  	$(SHELL) $(auxdir)/mkinstalldirs $@
    1.36  
    1.37 +.PHONY: all install install-hdrs install-lib install-bin uninstall uninstall-hdrs uninstall-lib uninstall-bin clean distclean dist
    1.38 +
    1.39 +-include $(OBJECTS:.lo=.d)
    1.40 +@DEPENDS@
    1.41 +@VERSION_DEPENDS@
    1.42 +
    1.43 +-include $(PLAYWAVE_OBJECTS:.lo=.d)
    1.44 +@PLAYWAVE_DEPENDS@
    1.45 +
    1.46 +-include $(PLAYMUS_OBJECTS:.lo=.d)
    1.47 +@PLAYMUS_DEPENDS@
    1.48 +
    1.49 +$(objects)/$(TARGET): $(OBJECTS) $(VERSION_OBJECTS)
    1.50 +	$(LIBTOOL) --mode=link $(CC) -o $@ $(OBJECTS) $(VERSION_OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
    1.51 +
    1.52  $(objects)/playwave$(EXE): $(objects)/playwave.lo $(objects)/$(TARGET)
    1.53  	$(LIBTOOL) --mode=link $(CC) -o $@ $(objects)/playwave.lo $(SDL_CFLAGS) $(SDL_LIBS) $(objects)/$(TARGET)
    1.54  
    1.55  $(objects)/playmus$(EXE): $(objects)/playmus.lo $(objects)/$(TARGET)
    1.56  	$(LIBTOOL) --mode=link $(CC) -o $@ $(objects)/playmus.lo $(SDL_CFLAGS) $(SDL_LIBS) $(objects)/$(TARGET)
    1.57  
    1.58 -.PHONY: all depend install install-hdrs install-lib install-bin uninstall uninstall-hdrs uninstall-lib uninstall-bin clean distclean dist
    1.59 -depend:
    1.60 -	@SOURCES="$(SOURCES)" INCLUDE="$(INCLUDE)" output="$(depend)" \
    1.61 -	$(SHELL) $(auxdir)/makedep.sh
    1.62 -	echo "\$$(objects)/playwave.lo: \$$(srcdir)/playwave.c" >>$(depend)
    1.63 -	echo "	\$$(LIBTOOL) --mode=compile \$$(CC) \$$(CFLAGS) \$$(SDL_CFLAGS) -c \$$(srcdir)/playwave.c  -o \$$@" >>$(depend)
    1.64 -	echo "" >>$(depend)
    1.65 -	echo "\$$(objects)/playmus.lo: \$$(srcdir)/playmus.c" >>$(depend)
    1.66 -	echo "	\$$(LIBTOOL) --mode=compile \$$(CC) \$$(CFLAGS) \$$(SDL_CFLAGS) -c \$$(srcdir)/playmus.c  -o \$$@" >>$(depend)
    1.67 -	echo "" >>$(depend)
    1.68 -
    1.69 -include $(depend)
    1.70 -
    1.71 -$(objects)/$(TARGET): $(OBJECTS)
    1.72 -	$(LIBTOOL) --mode=link $(CC) -o $@ $(OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
    1.73 -
    1.74  install: all install-hdrs install-lib #install-bin
    1.75  install-hdrs:
    1.76  	$(SHELL) $(auxdir)/mkinstalldirs $(includedir)/SDL
    1.77 @@ -117,7 +118,7 @@
    1.78  distclean: clean
    1.79  	rm -f Makefile
    1.80  	rm -f SDL_mixer.qpg
    1.81 -	rm -f config.status config.cache config.log libtool $(depend)
    1.82 +	rm -f config.status config.cache config.log libtool
    1.83  	rm -f SDL_mixer.pc
    1.84  	rm -rf $(srcdir)/autom4te*
    1.85  	find $(srcdir) \( \
     2.1 --- a/build-scripts/makedep.sh	Sun Oct 04 02:54:48 2009 +0000
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,93 +0,0 @@
     2.4 -#!/bin/sh
     2.5 -#
     2.6 -# Generate dependencies from a list of source files
     2.7 -
     2.8 -# Check to make sure our environment variables are set
     2.9 -if test x"$SOURCES" = x -o x"$output" = x; then
    2.10 -    echo "SOURCES, and output needs to be set"
    2.11 -    exit 1
    2.12 -fi
    2.13 -cache_prefix=".#$$"
    2.14 -
    2.15 -generate_var()
    2.16 -{
    2.17 -    echo $1 | sed -e 's|^.*/||' -e 's|\.|_|g'
    2.18 -}
    2.19 -
    2.20 -search_deps()
    2.21 -{
    2.22 -    base=`echo $1 | sed 's|/[^/]*$||'`
    2.23 -    grep '#include "' <$1 | sed -e 's|.*"\([^"]*\)".*|\1|' | \
    2.24 -    while read file
    2.25 -    do cache=${cache_prefix}_`generate_var $file`
    2.26 -       if test -f $cache; then
    2.27 -          : # We already ahve this cached
    2.28 -       else
    2.29 -           : >$cache
    2.30 -           for path in $base
    2.31 -           do dep="$path/$file"
    2.32 -              if test -f "$dep"; then
    2.33 -                 echo "	$dep \\" >>$cache
    2.34 -                 search_deps $dep >>$cache
    2.35 -                 break
    2.36 -              fi
    2.37 -           done
    2.38 -       fi
    2.39 -       cat $cache
    2.40 -    done
    2.41 -}
    2.42 -
    2.43 -:>${output}.new
    2.44 -for src in $SOURCES
    2.45 -do  echo "Generating dependencies for $src"
    2.46 -    ext=`echo $src | sed 's|.*\.\(.*\)|\1|'`
    2.47 -    if test x"$ext" = x"rc"; then
    2.48 -        obj=`echo $src | sed "s|^.*/\([^ ]*\)\..*|\1.o|g"`
    2.49 -    else
    2.50 -        obj=`echo $src | sed "s|^.*/\([^ ]*\)\..*|\1.lo|g"`
    2.51 -    fi
    2.52 -    echo "\$(objects)/$obj: $src \\" >>${output}.new
    2.53 -    search_deps $src | sort | uniq >>${output}.new
    2.54 -    case $ext in
    2.55 -        c) cat >>${output}.new <<__EOF__
    2.56 -
    2.57 -	\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src  -o \$@
    2.58 -
    2.59 -__EOF__
    2.60 -        ;;
    2.61 -        cc) cat >>${output}.new <<__EOF__
    2.62 -
    2.63 -	\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src  -o \$@
    2.64 -
    2.65 -__EOF__
    2.66 -        ;;
    2.67 -        m) cat >>${output}.new <<__EOF__
    2.68 -
    2.69 -	\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src  -o \$@
    2.70 -
    2.71 -__EOF__
    2.72 -        ;;
    2.73 -        asm) cat >>${output}.new <<__EOF__
    2.74 -
    2.75 -	\$(LIBTOOL) --tag=CC --mode=compile \$(auxdir)/strip_fPIC.sh \$(NASM) $src -o \$@
    2.76 -
    2.77 -__EOF__
    2.78 -        ;;
    2.79 -        S) cat >>${output}.new <<__EOF__
    2.80 -
    2.81 -	\$(LIBTOOL)  --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src  -o \$@
    2.82 -
    2.83 -__EOF__
    2.84 -        ;;
    2.85 -        rc) cat >>${output}.new <<__EOF__
    2.86 -
    2.87 -	\$(WINDRES) $src \$@
    2.88 -
    2.89 -__EOF__
    2.90 -        ;;
    2.91 -        *)   echo "Unknown file extension: $ext";;
    2.92 -    esac
    2.93 -    echo "" >>${output}.new
    2.94 -done
    2.95 -mv ${output}.new ${output}
    2.96 -rm -f ${cache_prefix}*
     3.1 --- a/configure.in	Sun Oct 04 02:54:48 2009 +0000
     3.2 +++ b/configure.in	Sun Oct 04 04:28:46 2009 +0000
     3.3 @@ -87,7 +87,7 @@
     3.4  
     3.5  case "$host" in
     3.6      *-*-cygwin* | *-*-mingw32*)
     3.7 -        SOURCES="$srcdir/version.rc"
     3.8 +        VERSION_SOURCES="$srcdir/version.rc"
     3.9          EXE=".exe"
    3.10          if test "$build" != "$host"; then # cross-compiling
    3.11              # Default cross-compile location
    3.12 @@ -485,13 +485,47 @@
    3.13      AC_MSG_WARN([MP3 support disabled])
    3.14  fi
    3.15  
    3.16 -OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
    3.17 -OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
    3.18 +
    3.19 +OBJECTS=`echo $SOURCES`
    3.20 +DEPENDS=`echo $SOURCES`
    3.21 +OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
    3.22 +DEPENDS=`echo "$DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.c,\\
    3.23 +$(objects)/\2.lo: \1/\2.c\\
    3.24 +	\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -MMD -MT \$@ -c \$< -o \$@,g'`
    3.25 +
    3.26 +VERSION_OBJECTS=`echo $VERSION_SOURCES`
    3.27 +VERSION_DEPENDS=`echo $VERSION_SOURCES`
    3.28 +VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
    3.29 +VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.rc,\\
    3.30 +$(objects)/\2.o: \1/\2.rc\\
    3.31 +	\$(WINDRES) \$< \$@,g'`
    3.32 +
    3.33 +PLAYWAVE_SOURCES="$srcdir/playwave.c"
    3.34 +PLAYWAVE_OBJECTS=`echo $PLAYWAVE_SOURCES`
    3.35 +PLAYWAVE_DEPENDS=`echo $PLAYWAVE_SOURCES`
    3.36 +PLAYWAVE_OBJECTS=`echo "$PLAYWAVE_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
    3.37 +PLAYWAVE_DEPENDS=`echo "$PLAYWAVE_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.c,\\
    3.38 +$(objects)/\2.lo: \1/\2.c\\
    3.39 +	\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -MMD -MT \$@ -c \$< -o \$@,g'`
    3.40 +
    3.41 +PLAYMUS_SOURCES="$srcdir/playmus.c"
    3.42 +PLAYMUS_OBJECTS=`echo $PLAYMUS_SOURCES`
    3.43 +PLAYMUS_DEPENDS=`echo $PLAYMUS_SOURCES`
    3.44 +PLAYMUS_OBJECTS=`echo "$PLAYMUS_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
    3.45 +PLAYMUS_DEPENDS=`echo "$PLAYMUS_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.c,\\
    3.46 +$(objects)/\2.lo: \1/\2.c\\
    3.47 +	\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -MMD -MT \$@ -c \$< -o \$@,g'`
    3.48  
    3.49  dnl Expand the sources and objects needed to build the library
    3.50  AC_SUBST(ac_aux_dir)
    3.51 -AC_SUBST(SOURCES)
    3.52  AC_SUBST(OBJECTS)
    3.53 +AC_SUBST(DEPENDS)
    3.54 +AC_SUBST(VERSION_OBJECTS)
    3.55 +AC_SUBST(VERSION_DEPENDS)
    3.56 +AC_SUBST(PLAYWAVE_OBJECTS)
    3.57 +AC_SUBST(PLAYWAVE_DEPENDS)
    3.58 +AC_SUBST(PLAYMUS_OBJECTS)
    3.59 +AC_SUBST(PLAYMUS_DEPENDS)
    3.60  AC_SUBST(BUILD_CFLAGS)
    3.61  AC_SUBST(EXTRA_CFLAGS)
    3.62  AC_SUBST(BUILD_LDFLAGS)
    3.63 @@ -504,7 +538,4 @@
    3.64  
    3.65  AC_OUTPUT([
    3.66      Makefile SDL_mixer.spec SDL_mixer.qpg SDL_mixer.pc
    3.67 -], [
    3.68 -    : >build-deps
    3.69 -    if test x"$MAKE" = x; then MAKE=make; fi; $MAKE depend
    3.70  ])