Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Made it possible to build SDL from a fresh checkout without any addit…
Browse files Browse the repository at this point in the history
…ional steps.

The trick is that if you're using configure and you don't want to have SDL_config.h and SDL_revision.h to show up as modified, you need to configure and build from a separate directory.

You also need to include SDL_revision.h directly if you want to use the SDL_REVISION constant, as a side effect of these changes.
  • Loading branch information
slouken committed Feb 16, 2011
1 parent 5b36352 commit 717eb8f
Show file tree
Hide file tree
Showing 19 changed files with 45,462 additions and 137 deletions.
12 changes: 0 additions & 12 deletions .hgignore
@@ -1,19 +1,13 @@
syntax:glob
aclocal.m4
autom4te*
config.cache
config.log
config.status
configure
libtool
Makefile
sdl-config
SDL.spec
SDL.qpg
build
build-deps
VisualC
VisualCE
# for Xcode
*.orig
*.swp
Expand All @@ -29,18 +23,12 @@ VisualCE
(^|/)build($|/)
.DS_Store
sdl.pc
include/SDL_config.h
include/SDL_revision.h
test/aclocal.m4
test/autom4te*
test/config.cache
test/config.log
test/config.status
test/configure
test/Makefile
test/SDL.dll
test/stdout.txt
test/stderr.txt
test/checkkeys
test/graywin
test/loopwave
Expand Down
8 changes: 2 additions & 6 deletions Makefile.ds
Expand Up @@ -122,7 +122,7 @@ all: $(TARGET) install nds_test
src/atomic/SDL_spinlock.o: src/atomic/SDL_spinlock.c
$(CC) $(CFLAGS) -mno-thumb -o $@ -c $^

$(TARGET): copy_config $(OBJS)
$(TARGET): $(OBJS)
$(AR) rc $(TARGET) $(OBJS)
-@ ($(RANLIB) $@ || true) >/dev/null 2>&1

Expand All @@ -136,9 +136,5 @@ nds_test:
# $(MAKE) -C test/nds-test-progs/sprite
# $(MAKE) -C test/nds-test-progs/sprite2

copy_config:
@cp include/SDL_config.h.default include/SDL_config.h

clean:
rm -f include/SDL_config.h $(OBJS)

rm -f $(OBJS)
15 changes: 4 additions & 11 deletions Makefile.in
Expand Up @@ -72,7 +72,6 @@ HDRS = \
SDL_quit.h \
SDL_rect.h \
SDL_render.h \
SDL_revision.h \
SDL_rwops.h \
SDL_scancode.h \
SDL_shape.h \
Expand Down Expand Up @@ -134,6 +133,7 @@ install-hdrs:
$(INSTALL) -m 644 $(srcdir)/include/$$file $(DESTDIR)$(includedir)/SDL/$$file; \
done
$(INSTALL) -m 644 include/SDL_config.h $(DESTDIR)$(includedir)/SDL/SDL_config.h
$(INSTALL) -m 644 include/SDL_revision.h $(DESTDIR)$(includedir)/SDL/SDL_revision.h
install-lib: $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET)
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)
$(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(TARGET) $(DESTDIR)$(libdir)/$(TARGET)
Expand All @@ -153,6 +153,7 @@ uninstall-hdrs:
rm -f $(DESTDIR)$(includedir)/SDL/$$file; \
done
rm -f $(DESTDIR)$(includedir)/SDL/SDL_config.h
rm -f $(DESTDIR)$(includedir)/SDL/SDL_revision.h
-rmdir $(DESTDIR)$(includedir)/SDL
uninstall-lib:
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(TARGET)
Expand All @@ -166,7 +167,7 @@ clean:
if test -f test/Makefile; then (cd test; $(MAKE) $@); fi

distclean: clean
rm -f Makefile include/SDL_config.h sdl-config
rm -f Makefile include/SDL_config.h include/SDL_revision.h sdl-config
rm -f SDL.qpg
rm -f config.status config.cache config.log libtool
rm -rf $(srcdir)/autom4te*
Expand All @@ -178,15 +179,11 @@ distclean: clean
-name '*.orig' -o \
-name '.#*' \) \
-exec rm -f {} \;
cp $(srcdir)/include/SDL_config.h.default $(srcdir)/include/SDL_config.h
if test -f test/Makefile; then (cd test; $(MAKE) $@); fi

dist $(distfile):
$(SHELL) $(auxdir)/mkinstalldirs $(distdir)
tar cf - $(DIST) | (cd $(distdir); tar xf -)
cp $(distdir)/include/SDL_config.h.default $(distdir)/include/SDL_config.h
$(SHELL) $(distdir)/build-scripts/updaterev.sh
rm -rf `find $(distdir) -name .svn`
find $(distdir) \( \
-name '*~' -o \
-name '*.bak' -o \
Expand Down Expand Up @@ -223,8 +220,4 @@ indent:

# Run indent and then commit modified files
commit: indent
svn commit

# Create a SVN snapshot that people can run update on
snapshot:
$(SHELL) $(auxdir)/snapshot.sh
hg commit
26 changes: 11 additions & 15 deletions Makefile.minimal
Expand Up @@ -5,41 +5,37 @@ CFLAGS = -g -O2 $(INCLUDE)
AR = ar
RANLIB = ranlib

CONFIG_H = include/SDL_config.h
TARGET = libSDL.a
SOURCES = \
src/*.c \
src/audio/*.c \
src/cdrom/*.c \
src/audio/dummy/*.c \
src/cpuinfo/*.c \
src/events/*.c \
src/file/*.c \
src/joystick/*.c \
src/haptic/*.c \
src/haptic/dummy/*.c \
src/joystick/*.c \
src/joystick/dummy/*.c \
src/loadso/dummy/*.c \
src/power/*.c \
src/render/*.c \
src/render/software/*.c \
src/stdlib/*.c \
src/thread/*.c \
src/thread/generic/*.c \
src/timer/*.c \
src/timer/dummy/*.c \
src/video/*.c \
src/power/*.c \
src/audio/dummy/*.c \
src/video/dummy/*.c \
src/joystick/dummy/*.c \
src/haptic/dummy/*.c \
src/cdrom/dummy/*.c \
src/thread/generic/*.c \
src/timer/dummy/*.c \
src/loadso/dummy/*.c \

OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g')

all: $(TARGET)

$(TARGET): $(CONFIG_H) $(OBJECTS)
$(TARGET): $(OBJECTS)
$(AR) crv $@ $^
$(RANLIB) $@

$(CONFIG_H):
cp $(CONFIG_H).default $(CONFIG_H)

clean:
rm -f $(TARGET) $(OBJECTS)
6 changes: 2 additions & 4 deletions VisualC/SDL/SDL_VS2008.vcproj
Expand Up @@ -29,8 +29,7 @@
>
<Tool
Name="VCPreBuildEventTool"
Description="Making sure basic SDL headers are in place..."
CommandLine="echo Copying SDL_config_windows.h to SDL_config.h...&#x0D;&#x0A;xcopy /d /q /y &quot;$(ProjectDir)\..\..\include\SDL_config_windows.h&quot; &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot; goto SDLREVISIONOKAY&#x0D;&#x0A;echo Creating stub SDL_revision.h file...&#x0D;&#x0A;echo #define SDL_REVISION &quot;hg-0:baadf00d&quot; &gt;&quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot;&#x0D;&#x0A;:SDLREVISIONOKAY&#x0D;&#x0A;"
CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
Expand Down Expand Up @@ -200,8 +199,7 @@
>
<Tool
Name="VCPreBuildEventTool"
Description="Making sure basic SDL headers are in place..."
CommandLine="echo Copying SDL_config_windows.h to SDL_config.h...&#x0D;&#x0A;xcopy /d /q /y &quot;$(ProjectDir)\..\..\include\SDL_config_windows.h&quot; &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot; goto SDLREVISIONOKAY&#x0D;&#x0A;echo Creating stub SDL_revision.h file...&#x0D;&#x0A;echo #define SDL_REVISION &quot;hg-0:baadf00d&quot; &gt;&quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot;&#x0D;&#x0A;:SDLREVISIONOKAY&#x0D;&#x0A;"
CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
Expand Down
26 changes: 3 additions & 23 deletions VisualC/SDL/SDL_VS2010.vcxproj
Expand Up @@ -72,17 +72,7 @@
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent>
<Message>Making sure basic SDL headers are in place...</Message>
<Command>echo Copying SDL_config_windows.h to SDL_config.h...
xcopy /d /q /y "$(ProjectDir)\..\..\include\SDL_config_windows.h" "$(ProjectDir)\..\..\include\SDL_config.h"

if exist "$(ProjectDir)\..\..\include\SDL_revision.h" goto SDLREVISIONOKAY
echo Creating stub SDL_revision.h file...
echo #define SDL_REVISION "hg-0:baadf00d" &gt;"$(ProjectDir)\..\..\include\SDL_revision.h"
:SDLREVISIONOKAY
</Command>
</PreBuildEvent>
<PreBuildEvent />
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
Expand Down Expand Up @@ -150,17 +140,7 @@ echo #define SDL_REVISION "hg-0:baadf00d" &gt;"$(ProjectDir)\..\..\include\SDL_r
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PreBuildEvent>
<Message>Making sure basic SDL headers are in place...</Message>
<Command>echo Copying SDL_config_windows.h to SDL_config.h...
xcopy /d /q /y "$(ProjectDir)\..\..\include\SDL_config_windows.h" "$(ProjectDir)\..\..\include\SDL_config.h"

if exist "$(ProjectDir)\..\..\include\SDL_revision.h" goto SDLREVISIONOKAY
echo Creating stub SDL_revision.h file...
echo #define SDL_REVISION "hg-0:baadf00d" &gt;"$(ProjectDir)\..\..\include\SDL_revision.h"
:SDLREVISIONOKAY
</Command>
</PreBuildEvent>
<PreBuildEvent />
<Midl>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
Expand Down Expand Up @@ -466,4 +446,4 @@ echo #define SDL_REVISION "hg-0:baadf00d" &gt;"$(ProjectDir)\..\..\include\SDL_r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
9 changes: 3 additions & 6 deletions VisualC/SDLmain/SDLmain_VS2008.vcproj
Expand Up @@ -29,8 +29,7 @@
>
<Tool
Name="VCPreBuildEventTool"
Description="Making sure basic SDL headers are in place..."
CommandLine="echo Copying SDL_config_windows.h to SDL_config.h...&#x0D;&#x0A;copy /Y &quot;$(ProjectDir)\..\..\include\SDL_config_windows.h&quot; &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot; goto SDLREVISIONOKAY&#x0D;&#x0A;echo Creating stub SDL_revision.h file...&#x0D;&#x0A;echo #define SDL_REVISION &quot;hg-0:baadf00d&quot; &gt;&quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot;&#x0D;&#x0A;:SDLREVISIONOKAY&#x0D;&#x0A;"
CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
Expand Down Expand Up @@ -164,8 +163,7 @@
>
<Tool
Name="VCPreBuildEventTool"
Description="Making sure basic SDL headers are in place..."
CommandLine="echo Copying SDL_config_windows.h to SDL_config.h...&#x0D;&#x0A;copy /Y &quot;$(ProjectDir)\..\..\include\SDL_config_windows.h&quot; &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot; goto SDLREVISIONOKAY&#x0D;&#x0A;echo Creating stub SDL_revision.h file...&#x0D;&#x0A;echo #define SDL_REVISION &quot;hg-0:baadf00d&quot; &gt;&quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot;&#x0D;&#x0A;:SDLREVISIONOKAY&#x0D;&#x0A;"
CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
Expand Down Expand Up @@ -299,8 +297,7 @@
>
<Tool
Name="VCPreBuildEventTool"
Description="Making sure basic SDL headers are in place..."
CommandLine="echo Copying SDL_config_windows.h to SDL_config.h...&#x0D;&#x0A;copy /Y &quot;$(ProjectDir)\..\..\include\SDL_config_windows.h&quot; &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot; goto SDLREVISIONOKAY&#x0D;&#x0A;echo Creating stub SDL_revision.h file...&#x0D;&#x0A;echo #define SDL_REVISION &quot;hg-0:baadf00d&quot; &gt;&quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot;&#x0D;&#x0A;:SDLREVISIONOKAY&#x0D;&#x0A;"
CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
Expand Down
35 changes: 4 additions & 31 deletions VisualC/SDLmain/SDLmain_VS2010.vcxproj
Expand Up @@ -99,16 +99,7 @@
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PreBuildEvent>
<Message>Making sure basic SDL headers are in place...</Message>
<Command>echo Copying SDL_config_windows.h to SDL_config.h...
copy /Y "$(ProjectDir)\..\..\include\SDL_config_windows.h" "$(ProjectDir)\..\..\include\SDL_config.h"

if exist "$(ProjectDir)\..\..\include\SDL_revision.h" goto SDLREVISIONOKAY
echo Creating stub SDL_revision.h file...
echo #define SDL_REVISION "hg-0:baadf00d" &gt;"$(ProjectDir)\..\..\include\SDL_revision.h"
:SDLREVISIONOKAY</Command>
</PreBuildEvent>
<PreBuildEvent />
<ClCompile>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\include;..\..\include\SDL;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
Expand Down Expand Up @@ -150,16 +141,7 @@ echo #define SDL_REVISION "hg-0:baadf00d" &gt;"$(ProjectDir)\..\..\include\SDL_r
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_NoSTDIO|Win32'">
<PreBuildEvent>
<Message>Making sure basic SDL headers are in place...</Message>
<Command>echo Copying SDL_config_windows.h to SDL_config.h...
copy /Y "$(ProjectDir)\..\..\include\SDL_config_windows.h" "$(ProjectDir)\..\..\include\SDL_config.h"

if exist "$(ProjectDir)\..\..\include\SDL_revision.h" goto SDLREVISIONOKAY
echo Creating stub SDL_revision.h file...
echo #define SDL_REVISION "hg-0:baadf00d" &gt;"$(ProjectDir)\..\..\include\SDL_revision.h"
:SDLREVISIONOKAY</Command>
</PreBuildEvent>
<PreBuildEvent />
<ClCompile>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\include;..\..\include\SDL;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
Expand Down Expand Up @@ -201,16 +183,7 @@ echo #define SDL_REVISION "hg-0:baadf00d" &gt;"$(ProjectDir)\..\..\include\SDL_r
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent>
<Message>Making sure basic SDL headers are in place...</Message>
<Command>echo Copying SDL_config_windows.h to SDL_config.h...
copy /Y "$(ProjectDir)\..\..\include\SDL_config_windows.h" "$(ProjectDir)\..\..\include\SDL_config.h"

if exist "$(ProjectDir)\..\..\include\SDL_revision.h" goto SDLREVISIONOKAY
echo Creating stub SDL_revision.h file...
echo #define SDL_REVISION "hg-0:baadf00d" &gt;"$(ProjectDir)\..\..\include\SDL_revision.h"
:SDLREVISIONOKAY</Command>
</PreBuildEvent>
<PreBuildEvent />
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\include;..\..\include\SDL;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
Expand Down Expand Up @@ -255,4 +228,4 @@ echo #define SDL_REVISION "hg-0:baadf00d" &gt;"$(ProjectDir)\..\..\include\SDL_r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

0 comments on commit 717eb8f

Please sign in to comment.