Makefile.in
author David Ludwig <dludwig@pobox.com>
Sat, 29 Nov 2014 10:09:30 -0500
changeset 9247 eddb899239fe
parent 8876 60edb019f0fe
child 9769 4716db508b0d
permissions -rw-r--r--
WinRT: bug and data-integrity fixes for SDL_GetPrefPath()

This change does a few things, all with regards to the WinRT implementation of
SDL_GetPrefPath():

1. it fixes a bug whereby SDL_GetPrefPath() did not create the directory it
returned. On other SDL platforms, SDL_GetPrefPath() will create separate
directories for its 'org' and 'app' folders. Without this, attempts to create
files in the pref-path would fail, unless those directories were first created
by the app, or by some other library the app used. This change makes sure
that these directories get created, before SDL_GetPrefPath() returns to its
caller(s).


2. it defaults to having SDL_GetPrefPath() return a WinRT 'Local' folder
on all platforms. Previously, for Windows Store apps, it would have used a
different, 'Roaming' folder. Files in Roaming folders can be automatically,
and synchronized across multiple devices by Windows. This synchronization can
happen while the app runs, with new files being copied into a running app's
pref-path. Unless an app is specifically designed to handle this scenario,
there is a chance that save-data could be overwritten in unwanted or
unexpected ways.

The default is now to use a Local folder, which does not get synchronized, and
which is arguably a bit safer to use. Apps that wish to use Roaming folders
can do so by setting SDL_HINT_WINRT_PREF_PATH_ROOT to "roaming", however it
is recommended that one first read Microsoft's documentation for Roaming
files, a link to which is provided in README-winrt.md.

To preserve older pref-path selection behavior (found in SDL 2.0.3, as well as
many pre-2.0.4 versions of SDL from hg.libsdl.org), which uses a Roaming path
in Windows Store apps, and a Local path in Windows Phone, set
SDL_HINT_WINRT_PREF_PATH_ROOT to "old".

Please note that Roaming paths are not supported on Windows Phone 8.0, due to
limitations in the OS itself. Attempts to use this will fail.
(Windows Phone 8.1 does not have this limitation, however.)


3. It makes SDL_GetPrefPath(), when on Windows Phone 8.0, and when
SDL_HINT_WINRT_PREF_PATH_ROOT is set to "roaming", return NULL, rather than
silently defaulting to a Local path (then switching to a Roaming path if and
when the user upgraded to Windows Phone 8.1).
     1 # Makefile to build and install the SDL library
     2 
     3 top_builddir = .
     4 srcdir  = @srcdir@
     5 objects = build
     6 prefix = @prefix@
     7 exec_prefix = @exec_prefix@
     8 bindir	= @bindir@
     9 libdir  = @libdir@
    10 includedir = @includedir@
    11 datarootdir = @datarootdir@
    12 datadir	= @datadir@
    13 auxdir	= @ac_aux_dir@
    14 distpath = $(srcdir)/..
    15 distdir = SDL2-@SDL_VERSION@
    16 distfile = $(distdir).tar.gz
    17 
    18 @SET_MAKE@
    19 SHELL	= @SHELL@
    20 CC      = @CC@
    21 INCLUDE = @INCLUDE@
    22 CFLAGS  = @BUILD_CFLAGS@
    23 EXTRA_CFLAGS = @EXTRA_CFLAGS@
    24 LDFLAGS = @BUILD_LDFLAGS@
    25 EXTRA_LDFLAGS = @EXTRA_LDFLAGS@
    26 LIBTOOL = @LIBTOOL@
    27 INSTALL = @INSTALL@
    28 AR	= @AR@
    29 RANLIB	= @RANLIB@
    30 WINDRES	= @WINDRES@
    31 
    32 TARGET  = libSDL2.la
    33 OBJECTS = @OBJECTS@
    34 VERSION_OBJECTS = @VERSION_OBJECTS@
    35 
    36 SDLMAIN_TARGET = libSDL2main.a
    37 SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@
    38 
    39 SDLTEST_TARGET = libSDL2_test.a
    40 SDLTEST_OBJECTS = @SDLTEST_OBJECTS@
    41 
    42 SRC_DIST = *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake configure configure.in debian include Makefile.* sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in src test VisualC.html VisualC Xcode Xcode-iOS
    43 GEN_DIST = SDL2.spec
    44 
    45 ifneq ($V,1)
    46 RUN_CMD_AR     = @echo "  AR    " $@;
    47 RUN_CMD_CC     = @echo "  CC    " $@;
    48 RUN_CMD_CXX    = @echo "  CXX   " $@;
    49 RUN_CMD_LTLINK = @echo "  LTLINK" $@;
    50 RUN_CMD_RANLIB = @echo "  RANLIB" $@;
    51 LIBTOOL += --quiet
    52 endif
    53 
    54 HDRS = \
    55 	SDL.h \
    56 	SDL_assert.h \
    57 	SDL_atomic.h \
    58 	SDL_audio.h \
    59 	SDL_bits.h \
    60 	SDL_blendmode.h \
    61 	SDL_clipboard.h \
    62 	SDL_cpuinfo.h \
    63 	SDL_egl.h \
    64 	SDL_endian.h \
    65 	SDL_error.h \
    66 	SDL_events.h \
    67 	SDL_filesystem.h \
    68 	SDL_gamecontroller.h \
    69 	SDL_gesture.h \
    70 	SDL_haptic.h \
    71 	SDL_hints.h \
    72 	SDL_joystick.h \
    73 	SDL_keyboard.h \
    74 	SDL_keycode.h \
    75 	SDL_loadso.h \
    76 	SDL_log.h \
    77 	SDL_main.h \
    78 	SDL_messagebox.h \
    79 	SDL_mouse.h \
    80 	SDL_mutex.h \
    81 	SDL_name.h \
    82 	SDL_opengl.h \
    83 	SDL_opengl_glext.h \
    84 	SDL_opengles.h \
    85 	SDL_opengles2_gl2ext.h \
    86 	SDL_opengles2_gl2.h \
    87 	SDL_opengles2_gl2platform.h \
    88 	SDL_opengles2.h \
    89 	SDL_opengles2_khrplatform.h \
    90 	SDL_pixels.h \
    91 	SDL_platform.h \
    92 	SDL_power.h \
    93 	SDL_quit.h \
    94 	SDL_rect.h \
    95 	SDL_render.h \
    96 	SDL_rwops.h \
    97 	SDL_scancode.h \
    98 	SDL_shape.h \
    99 	SDL_stdinc.h \
   100 	SDL_surface.h \
   101 	SDL_system.h \
   102 	SDL_syswm.h \
   103 	SDL_thread.h \
   104 	SDL_timer.h \
   105 	SDL_touch.h \
   106 	SDL_types.h \
   107 	SDL_version.h \
   108 	SDL_video.h \
   109 	begin_code.h \
   110 	close_code.h
   111 
   112 SDLTEST_HDRS = $(shell ls $(srcdir)/include | fgrep SDL_test)
   113 
   114 LT_AGE      = @LT_AGE@
   115 LT_CURRENT  = @LT_CURRENT@
   116 LT_RELEASE  = @LT_RELEASE@
   117 LT_REVISION = @LT_REVISION@
   118 LT_LDFLAGS  = -no-undefined -rpath $(DESTDIR)$(libdir) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
   119 
   120 all: $(srcdir)/configure Makefile $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLTEST_TARGET)
   121 
   122 $(srcdir)/configure: $(srcdir)/configure.in
   123 	@echo "Warning, configure.in is out of date"
   124 	#(cd $(srcdir) && sh autogen.sh && sh configure)
   125 	@sleep 3
   126 
   127 Makefile: $(srcdir)/Makefile.in
   128 	$(SHELL) config.status $@
   129 
   130 Makefile.in:;
   131 
   132 $(objects):
   133 	$(SHELL) $(auxdir)/mkinstalldirs $@
   134 
   135 update-revision:
   136 	$(SHELL) $(auxdir)/updaterev.sh
   137 
   138 .PHONY: all update-revision install install-bin install-hdrs install-lib install-data uninstall uninstall-bin uninstall-hdrs uninstall-lib uninstall-data clean distclean dist $(OBJECTS:.lo=.d)
   139 
   140 $(objects)/$(TARGET): $(OBJECTS) $(VERSION_OBJECTS)
   141 	$(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $(OBJECTS) $(VERSION_OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
   142 
   143 $(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS)
   144 	$(RUN_CMD_AR)$(AR) cru $@ $(SDLMAIN_OBJECTS)
   145 	$(RUN_CMD_RANLIB)$(RANLIB) $@
   146 
   147 $(objects)/$(SDLTEST_TARGET): $(SDLTEST_OBJECTS)
   148 	$(RUN_CMD_AR)$(AR) cru $@ $(SDLTEST_OBJECTS)
   149 	$(RUN_CMD_RANLIB)$(RANLIB) $@
   150 
   151 install: all install-bin install-hdrs install-lib install-data
   152 install-bin:
   153 	$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(bindir)
   154 	$(INSTALL) -m 755 sdl2-config $(DESTDIR)$(bindir)/sdl2-config
   155 install-hdrs: update-revision
   156 	$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(includedir)/SDL2
   157 	for file in $(HDRS) $(SDLTEST_HDRS); do \
   158 	    $(INSTALL) -m 644 $(srcdir)/include/$$file $(DESTDIR)$(includedir)/SDL2/$$file; \
   159 	done
   160 	$(INSTALL) -m 644 include/SDL_config.h $(DESTDIR)$(includedir)/SDL2/SDL_config.h
   161 	if test -f include/SDL_revision.h; then \
   162 	    $(INSTALL) -m 644 include/SDL_revision.h $(DESTDIR)$(includedir)/SDL2/SDL_revision.h; \
   163 	else \
   164 	    $(INSTALL) -m 644 $(srcdir)/include/SDL_revision.h $(DESTDIR)$(includedir)/SDL2/SDL_revision.h; \
   165 	fi
   166 
   167 install-lib: $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLTEST_TARGET)
   168 	$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)
   169 	$(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(TARGET) $(DESTDIR)$(libdir)/$(TARGET)
   170 	$(INSTALL) -m 644 $(objects)/$(SDLMAIN_TARGET) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
   171 	$(RANLIB) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
   172 	$(INSTALL) -m 644 $(objects)/$(SDLTEST_TARGET) $(DESTDIR)$(libdir)/$(SDLTEST_TARGET)
   173 	$(RANLIB) $(DESTDIR)$(libdir)/$(SDLTEST_TARGET)
   174 install-data:
   175 	$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(datadir)/aclocal
   176 	$(INSTALL) -m 644 $(srcdir)/sdl2.m4 $(DESTDIR)$(datadir)/aclocal/sdl2.m4
   177 	$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/pkgconfig
   178 	$(INSTALL) -m 644 sdl2.pc $(DESTDIR)$(libdir)/pkgconfig
   179 
   180 uninstall: uninstall-bin uninstall-hdrs uninstall-lib uninstall-data
   181 uninstall-bin:
   182 	rm -f $(DESTDIR)$(bindir)/sdl2-config
   183 uninstall-hdrs:
   184 	for file in $(HDRS) $(SDLTEST_HDRS); do \
   185 	    rm -f $(DESTDIR)$(includedir)/SDL2/$$file; \
   186 	done
   187 	rm -f $(DESTDIR)$(includedir)/SDL2/SDL_config.h
   188 	rm -f $(DESTDIR)$(includedir)/SDL2/SDL_revision.h
   189 	-rmdir $(DESTDIR)$(includedir)/SDL2
   190 uninstall-lib:
   191 	$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(TARGET)
   192 	rm -f $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
   193 	rm -f $(DESTDIR)$(libdir)/$(SDLTEST_TARGET)
   194 uninstall-data:
   195 	rm -f $(DESTDIR)$(datadir)/aclocal/sdl2.m4
   196 	rm -f $(DESTDIR)$(libdir)/pkgconfig/sdl2.pc
   197 
   198 clean:
   199 	rm -rf $(objects)
   200 	if test -f test/Makefile; then (cd test; $(MAKE) $@); fi
   201 
   202 distclean: clean
   203 	rm -f Makefile Makefile.rules sdl2-config
   204 	rm -f config.status config.cache config.log libtool
   205 	rm -rf $(srcdir)/autom4te*
   206 	find $(srcdir) \( \
   207 	    -name '*~' -o \
   208 	    -name '*.bak' -o \
   209 	    -name '*.old' -o \
   210 	    -name '*.rej' -o \
   211 	    -name '*.orig' -o \
   212 	    -name '.#*' \) \
   213 	    -exec rm -f {} \;
   214 	if test -f test/Makefile; then (cd test; $(MAKE) $@); fi
   215 
   216 dist $(distfile):
   217 	$(SHELL) $(auxdir)/mkinstalldirs $(distdir)
   218 	(cd $(srcdir); tar cf - $(SRC_DIST)) | (cd $(distdir); tar xf -)
   219 	tar cf - $(GEN_DIST) | (cd $(distdir); tar xf -)
   220 	find $(distdir) \( \
   221 	    -name '*~' -o \
   222 	    -name '*.bak' -o \
   223 	    -name '*.old' -o \
   224 	    -name '*.rej' -o \
   225 	    -name '*.orig' -o \
   226 	    -name '.#*' \) \
   227 	    -exec rm -f {} \;
   228 	if test -f $(distdir)/test/Makefile; then (cd $(distdir)/test && make distclean); fi
   229 	(cd $(distdir); build-scripts/updaterev.sh)
   230 	tar cvf - $(distdir) | gzip --best >$(distfile)
   231 	rm -rf $(distdir)
   232 
   233 rpm: $(distfile)
   234 	rpmbuild -ta $?