Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Use gcc's built-in dependency generation, thanks to Adam Strzelecki

  • Loading branch information
slouken committed Oct 4, 2009
1 parent 03a11ca commit 5b834465234565df27c76d2013d8ca3df6e6eeac
Showing with 36 additions and 118 deletions.
  1. +9 −16 Makefile.in
  2. +0 −87 build-scripts/makedep.sh
  3. +27 −15 configure.in
@@ -3,7 +3,6 @@
top_builddir = .
srcdir = @srcdir@
objects = build
depend = build-deps
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
@@ -33,11 +32,10 @@ RANLIB = @RANLIB@
WINDRES = @WINDRES@

TARGET = libSDL.la
SOURCES = @SOURCES@
OBJECTS = @OBJECTS@
VERSION_OBJECTS = @VERSION_OBJECTS@

SDLMAIN_TARGET = libSDLmain.a
SDLMAIN_SOURCES = @SDLMAIN_SOURCES@
SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@

# PS3 SPU programs
@@ -74,20 +72,15 @@ $(srcdir)/include/SDL_revision.h: update-revision
update-revision:
$(SHELL) $(auxdir)/updaterev.sh

.PHONY: all update-revision depend install install-bin install-hdrs install-lib install-data install-man uninstall uninstall-bin uninstall-hdrs uninstall-lib uninstall-data uninstall-man clean distclean dist
depend: update-revision
@SOURCES="$(SOURCES)" INCLUDE="$(INCLUDE)" output="$(depend)" \
$(SHELL) $(auxdir)/makedep.sh
@for src in $(SDLMAIN_SOURCES); do \
obj=`echo $$src | sed -e 's|.*/||' -e 's|\.[^\.]*$$|.o|'`; \
echo "\$$(objects)/$$obj: $$src" >>$(depend); \
echo " \$$(CC) \$$(CFLAGS) \$$(EXTRA_CFLAGS) -c $$src -o \$$@" >>$(depend); \
done
.PHONY: all update-revision install install-bin install-hdrs install-lib install-data install-man uninstall uninstall-bin uninstall-hdrs uninstall-lib uninstall-data uninstall-man clean distclean dist

include $(depend)
-include $(OBJECTS:.lo=.d)
@DEPENDS@
@VERSION_DEPENDS@
@SDLMAIN_DEPENDS@

$(objects)/$(TARGET): $(OBJECTS)
$(LIBTOOL) --mode=link $(CC) -o $@ $(OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
$(objects)/$(TARGET): $(OBJECTS) $(VERSION_OBJECTS)
$(LIBTOOL) --mode=link $(CC) -o $@ $(OBJECTS) $(VERSION_OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)

$(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS)
$(AR) cru $@ $(SDLMAIN_OBJECTS)
@@ -147,7 +140,7 @@ clean:
distclean: clean
rm -f Makefile include/SDL_config.h sdl-config
rm -f SDL.qpg
rm -f config.status config.cache config.log libtool $(depend)
rm -f config.status config.cache config.log libtool
rm -rf $(srcdir)/autom4te*
find $(srcdir) \( \
-name '*~' -o \

This file was deleted.

@@ -2555,7 +2555,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
#EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lunicows"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lmsimg32 -lwinmm"
# The Win32 platform requires special setup
SOURCES="$SOURCES $srcdir/src/main/win32/*.rc"
VERSION_SOURCES="$srcdir/src/main/win32/*.rc"
SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
@@ -2769,15 +2769,28 @@ if test x$SDLMAIN_SOURCES = x; then
SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
fi

OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.asm,$(objects)/\1.lo,g'`
OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.lo,g'`
OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.lo,g'`
OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.S,$(objects)/\1.lo,g'`
OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`

SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.o,g'`
SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
OBJECTS=`echo $SOURCES`
DEPENDS=`echo $SOURCES`
for EXT in asm cc m c S; do
OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.'$EXT',$(objects)/\1.lo,g'`
DEPENDS=`echo "$DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.'$EXT',\\
$(objects)/\2.lo: \1/\2.'$EXT'\\
\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -MMD -MT \$@ -c \$< -o \$@,g'`
done

VERSION_OBJECTS=`echo $VERSION_SOURCES`
VERSION_DEPENDS=`echo $VERSION_SOURCES`
VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.rc,\\
$(objects)/\2.o: \1/\2.rc\\
\$(WINDRES) \$< \$@,g'`

SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES`
SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.c,\\
$(objects)/\2.o: \1/\2.c\\
\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -MMD -MT \$@ -c \$< -o \$@,g'`

# Set runtime shared library paths as needed

@@ -2829,10 +2842,12 @@ AC_SUBST(ENABLE_STATIC_FALSE)
dnl Expand the sources and objects needed to build the library
AC_SUBST(ac_aux_dir)
AC_SUBST(INCLUDE)
AC_SUBST(SOURCES)
AC_SUBST(OBJECTS)
AC_SUBST(SDLMAIN_SOURCES)
AC_SUBST(DEPENDS)
AC_SUBST(VERSION_OBJECTS)
AC_SUBST(VERSION_DEPENDS)
AC_SUBST(SDLMAIN_OBJECTS)
AC_SUBST(SDLMAIN_DEPENDS)
AC_SUBST(BUILD_CFLAGS)
AC_SUBST(EXTRA_CFLAGS)
AC_SUBST(BUILD_LDFLAGS)
@@ -2841,7 +2856,4 @@ AC_SUBST(WINDRES)

AC_OUTPUT([
Makefile sdl-config SDL.spec sdl.pc
], [
: >build-deps
if test x"$MAKE" = x; then MAKE=make; fi; $MAKE depend
])

0 comments on commit 5b83446

Please sign in to comment.