Added rules to build libSDLmain.a
authorSam Lantinga <slouken@libsdl.org>
Mon, 20 Feb 2006 22:15:38 +0000
changeset 1397 b189a73aa335
parent 1396 428c8690cf73
child 1398 27b719501eb4
Added rules to build libSDLmain.a Reverted Patrice's mint changes - you should fix the source files, not add include paths to the build process.
Makefile.in
configure.in
--- a/Makefile.in	Mon Feb 20 20:53:52 2006 +0000
+++ b/Makefile.in	Mon Feb 20 22:15:38 2006 +0000
@@ -30,6 +30,10 @@
 SOURCES = @SOURCES@
 OBJECTS = @OBJECTS@
 
+SDLMAIN_TARGET = libSDLmain.a
+SDLMAIN_SOURCES = @SDLMAIN_SOURCES@
+SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@
+
 DIST = acinclude.m4 autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS CWprojects.sea.bin docs docs.html EpocBuildFiles.zip include INSTALL Makefile.dc Makefile.in MPWmake.sea.bin PBProjects.tar.gz README* sdl-config.in sdl.m4 SDL.qpg.in SDL.spec SDL.spec.in setvars.cmd src test TODO VisualCE.zip VisualC.html VisualC.zip Watcom.mif WhatsNew Xcode21.tar.gz Xcode.tar.gz XcodeUniversal.tar.gz
 
 LT_AGE      = @LT_AGE@
@@ -38,7 +42,7 @@
 LT_REVISION = @LT_REVISION@
 LT_LDFLAGS  = -no-undefined -rpath $(libdir) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
 
-all: Makefile $(objects) $(objects)/$(TARGET)
+all: Makefile $(objects) $(objects)/$(TARGET) $(objects)/$(TARGET_SDLMAIN)
 
 Makefile: $(srcdir)/Makefile.in
 	$(SHELL) config.status $@
@@ -50,12 +54,21 @@
 depend:
 	SOURCES="$(SOURCES)" INCLUDE="$(INCLUDE)" objects="$(objects)" 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) -c $$src -o \$$@" >>$(depend); \
+	done
 
 include $(depend)
 
 $(objects)/$(TARGET): $(OBJECTS)
 	$(LIBTOOL) --mode=link $(CC) -o $@ $(OBJECTS) $(LDFLAGS) $(LIBS) $(LT_LDFLAGS)
 
+$(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS)
+	@AR@ cru $@ $(SDLMAIN_OBJECTS)
+	@RANLIB@ $@
+
 install: install-bin install-hdrs install-lib install-data install-man
 install-bin:
 	$(SHELL) $(auxdir)/mkinstalldirs $(bindir)
@@ -70,6 +83,7 @@
 install-lib:
 	$(SHELL) $(auxdir)/mkinstalldirs $(libdir)
 	$(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(TARGET) $(libdir)/$(TARGET)
+	$(INSTALL) -m 644 $(objects)/$(SDLMAIN_TARGET) $(libdir)/$(SDLMAIN_TARGET)
 install-data:
 	$(SHELL) $(auxdir)/mkinstalldirs $(datadir)/aclocal
 	$(INSTALL) -m 644 $(srcdir)/sdl.m4 $(datadir)/aclocal/sdl.m4
@@ -91,6 +105,7 @@
 	rm -f $(includedir)/SDL/SDL_config.h
 uninstall-lib:
 	$(LIBTOOL) --mode=uninstall rm -f $(libdir)/$(TARGET)
+	rm -f $(libdir)/$(SDLMAIN_TARGET)
 uninstall-data:
 	rm -f $(datadir)/aclocal/sdl.m4
 uninstall-man:
@@ -121,6 +136,7 @@
 	rm -rf `find $(distdir) -name CVS`
 	rm -f `find $(distdir) -name '.cvsignore'`
 	rm -f `find $(distdir) -name '.#*'`
+	rmdir `find $(distdir) -type d -empty`
 	tar cvf - $(distdir) | gzip --best >$(distfile)
 	rm -rf $(distdir)
 
--- a/configure.in	Mon Feb 20 20:53:52 2006 +0000
+++ b/configure.in	Mon Feb 20 22:15:38 2006 +0000
@@ -1175,6 +1175,7 @@
         if test x$video_qtopia = xyes; then
             AC_DEFINE(SDL_VIDEO_DRIVER_QTOPIA)
             SOURCES="$SOURCES $srcdir/src/video/qtopia/*.cc"
+            SDLMAIN_SOURCES="$srcdir/src/main/qtopia/*.cc"
             BUILD_CFLAGS="$BUILD_CFLAGS $QTOPIA_FLAGS"
             SDL_CFLAGS="$SDL_CFLAGS -DQWS -Dmain=SDL_main"
             SDL_LIBS="-lSDLmain $SDL_LIBS -L${QPEDIR}/lib -L${QTDIR}/lib/ -lqpe -lqte"
@@ -2117,6 +2118,7 @@
             BUILD_LDFLAGS="$BUILD_LDFLAGS -ldxguid"
         fi
         # The Win32 platform requires special setup
+        SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
         SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
         ;;
@@ -2219,6 +2221,7 @@
             have_loadso=yes
         fi
         # The MacOS X platform requires special setup.
+        SDLMAIN_SOURCES="$srcdir/src/main/macosx/*.m"
         AC_DEFINE(TARGET_API_MAC_CARBON)
         BUILD_CFLAGS="$BUILD_CFLAGS -fpascal-strings -DMACOSX"
         SDL_LIBS="-lSDLmain $SDL_LIBS"
@@ -2274,13 +2277,11 @@
             else
                 AC_DEFINE(SDL_TIMER_MINT)
                 SOURCES="$SOURCES $srcdir/src/timer/mint/*.c"
-                BUILD_CFLAGS="$BUILD_CFLAGS -I$srcdir/src/timer/mint"
             fi
             have_timers=yes
         fi
         # MiNT does not define "unix"
         BUILD_CFLAGS="$BUILD_CFLAGS -Dunix"
-        BUILD_CFLAGS="$BUILD_CFLAGS -I$srcdir/src/video/ataricommon"
         ;;
     *-riscos)
         ARCH=riscos
@@ -2345,12 +2346,19 @@
     fi
     SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
 fi
+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'`
 
+SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.o,g'`
+SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.o,g'`
+SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
+
 # Set runtime shared library paths as needed
 
 if test "x$enable_rpath" = "xyes"; then
@@ -2434,6 +2442,8 @@
 AC_SUBST(INCLUDE)
 AC_SUBST(SOURCES)
 AC_SUBST(OBJECTS)
+AC_SUBST(SDLMAIN_SOURCES)
+AC_SUBST(SDLMAIN_OBJECTS)
 AC_SUBST(BUILD_CFLAGS)
 AC_SUBST(BUILD_LDFLAGS)