Makefile.in
author Sam Lantinga
Sat, 08 Jun 2019 18:22:18 -0700
changeset 12803 70d338e248c8
parent 12713 8ed803255020
child 12998 b87ba0fad17e
permissions -rw-r--r--
Fixed bug 4294 - Audio: perform more validation on conversion request

janisozaur

There are many cases which are not able to be handled by SDL's audio conversion routines, including too low (negative) rate, too high rate (impossible to allocate).

This patch aims to report such issues early and handle others in a graceful manner. The "INT32_MAX / RESAMPLER_SAMPLES_PER_ZERO_CROSSING" value is the conservative approach in terms of what can _technically_ be supported, but its value is 4'194'303, or just shy of 4.2MHz. I highly doubt any sane person would use such rates, especially in SDL2, so I would like to drive this limit further down, but would need some assistance to do that, as doing so would have to introduce an arbitrary value. Are you OK with such approach? What would a good value be? Wikipedia (https://en.wikipedia.org/wiki/High-resolution_audio) lists 96kHz as the highest sampling rate in use, even if I quadruple it for a good measure, to 384kHz it's still an order of magnitude lower than 4MHz.
     1 # Makefile to build and install the SDL library
     2 
     3 top_builddir = .
     4 srcdir  = @srcdir@
     5 objects = build
     6 gen = gen
     7 prefix = @prefix@
     8 exec_prefix = @exec_prefix@
     9 bindir	= @bindir@
    10 libdir  = @libdir@
    11 includedir = @includedir@
    12 datarootdir = @datarootdir@
    13 datadir	= @datadir@
    14 auxdir	= @ac_aux_dir@
    15 distpath = $(srcdir)/..
    16 distdir = SDL2-@SDL_VERSION@
    17 distfile = $(distdir).tar.gz
    18 
    19 @SET_MAKE@
    20 SHELL	= @SHELL@
    21 CC      = @CC@
    22 INCLUDE = @INCLUDE@
    23 CFLAGS  = @BUILD_CFLAGS@
    24 EXTRA_CFLAGS = @EXTRA_CFLAGS@
    25 LDFLAGS = @BUILD_LDFLAGS@
    26 EXTRA_LDFLAGS = @EXTRA_LDFLAGS@
    27 LIBTOOL = @LIBTOOL@
    28 INSTALL = @INSTALL@
    29 AR	= @AR@
    30 RANLIB	= @RANLIB@
    31 WINDRES	= @WINDRES@
    32 
    33 TARGET  = libSDL2.la
    34 OBJECTS = @OBJECTS@
    35 GEN_HEADERS = @GEN_HEADERS@
    36 GEN_OBJECTS = @GEN_OBJECTS@
    37 VERSION_OBJECTS = @VERSION_OBJECTS@
    38 
    39 SDLMAIN_TARGET = libSDL2main.la
    40 SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@
    41 
    42 SDLTEST_TARGET = libSDL2_test.la
    43 SDLTEST_OBJECTS = @SDLTEST_OBJECTS@
    44 
    45 WAYLAND_SCANNER = @WAYLAND_SCANNER@
    46 
    47 INSTALL_SDL2_CONFIG = @INSTALL_SDL2_CONFIG@
    48 
    49 SRC_DIST = *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.ac debian docs include Makefile.* sdl2-config.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in SDL2Config.cmake src test VisualC.html VisualC VisualC-WinRT Xcode Xcode-iOS wayland-protocols
    50 GEN_DIST = SDL2.spec
    51 
    52 ifneq ($V,1)
    53 RUN_CMD_AR     = @echo "  AR    " $@;
    54 RUN_CMD_CC     = @echo "  CC    " $@;
    55 RUN_CMD_CXX    = @echo "  CXX   " $@;
    56 RUN_CMD_LTLINK = @echo "  LTLINK" $@;
    57 RUN_CMD_RANLIB = @echo "  RANLIB" $@;
    58 RUN_CMD_GEN    = @echo "  GEN   " $@;
    59 LIBTOOL += --quiet
    60 endif
    61 
    62 HDRS = \
    63 	SDL.h \
    64 	SDL_assert.h \
    65 	SDL_atomic.h \
    66 	SDL_audio.h \
    67 	SDL_bits.h \
    68 	SDL_blendmode.h \
    69 	SDL_clipboard.h \
    70 	SDL_cpuinfo.h \
    71 	SDL_egl.h \
    72 	SDL_endian.h \
    73 	SDL_error.h \
    74 	SDL_events.h \
    75 	SDL_filesystem.h \
    76 	SDL_gamecontroller.h \
    77 	SDL_gesture.h \
    78 	SDL_haptic.h \
    79 	SDL_hints.h \
    80 	SDL_joystick.h \
    81 	SDL_keyboard.h \
    82 	SDL_keycode.h \
    83 	SDL_loadso.h \
    84 	SDL_log.h \
    85 	SDL_main.h \
    86 	SDL_messagebox.h \
    87 	SDL_mouse.h \
    88 	SDL_mutex.h \
    89 	SDL_name.h \
    90 	SDL_opengl.h \
    91 	SDL_opengl_glext.h \
    92 	SDL_opengles.h \
    93 	SDL_opengles2_gl2ext.h \
    94 	SDL_opengles2_gl2.h \
    95 	SDL_opengles2_gl2platform.h \
    96 	SDL_opengles2.h \
    97 	SDL_opengles2_khrplatform.h \
    98 	SDL_pixels.h \
    99 	SDL_platform.h \
   100 	SDL_power.h \
   101 	SDL_quit.h \
   102 	SDL_rect.h \
   103 	SDL_render.h \
   104 	SDL_rwops.h \
   105 	SDL_scancode.h \
   106 	SDL_sensor.h \
   107 	SDL_shape.h \
   108 	SDL_stdinc.h \
   109 	SDL_surface.h \
   110 	SDL_system.h \
   111 	SDL_syswm.h \
   112 	SDL_thread.h \
   113 	SDL_timer.h \
   114 	SDL_touch.h \
   115 	SDL_types.h \
   116 	SDL_version.h \
   117 	SDL_video.h \
   118 	SDL_vulkan.h \
   119 	begin_code.h \
   120 	close_code.h
   121 
   122 SDLTEST_HDRS = $(shell ls $(srcdir)/include | fgrep SDL_test)
   123 
   124 LT_AGE      = @LT_AGE@
   125 LT_CURRENT  = @LT_CURRENT@
   126 LT_RELEASE  = @LT_RELEASE@
   127 LT_REVISION = @LT_REVISION@
   128 LT_LDFLAGS  = -no-undefined -rpath $(libdir) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
   129 
   130 all: $(srcdir)/configure Makefile $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLTEST_TARGET)
   131 
   132 $(srcdir)/configure: $(srcdir)/configure.ac
   133 	@echo "Warning, configure is out of date, please re-run autogen.sh"
   134 
   135 Makefile: $(srcdir)/Makefile.in
   136 	$(SHELL) config.status $@
   137 
   138 Makefile.in:;
   139 
   140 $(objects)/.created:
   141 	$(SHELL) $(auxdir)/mkinstalldirs $(objects)
   142 	touch $@
   143 
   144 update-revision:
   145 	$(SHELL) $(auxdir)/updaterev.sh
   146 
   147 .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)
   148 
   149 $(objects)/$(TARGET): $(GEN_HEADERS) $(GEN_OBJECTS) $(OBJECTS) $(VERSION_OBJECTS)
   150 	$(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $(OBJECTS) $(GEN_OBJECTS) $(VERSION_OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
   151 
   152 $(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS)
   153 	$(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -static -o $@ $(SDLMAIN_OBJECTS) -rpath $(libdir)
   154 
   155 $(objects)/$(SDLTEST_TARGET): $(SDLTEST_OBJECTS)
   156 	$(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -static -o $@ $(SDLTEST_OBJECTS) -rpath $(libdir)
   157 
   158 install: all install-bin install-hdrs install-lib install-data
   159 install-bin:
   160 ifeq ($(INSTALL_SDL2_CONFIG),TRUE)
   161 	$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(bindir)
   162 	$(INSTALL) -m 755 sdl2-config $(DESTDIR)$(bindir)/sdl2-config
   163 endif
   164 
   165 install-hdrs: update-revision
   166 	$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(includedir)/SDL2
   167 	for file in $(HDRS) $(SDLTEST_HDRS); do \
   168 	    $(INSTALL) -m 644 $(srcdir)/include/$$file $(DESTDIR)$(includedir)/SDL2/$$file; \
   169 	done
   170 	$(INSTALL) -m 644 include/SDL_config.h $(DESTDIR)$(includedir)/SDL2/SDL_config.h
   171 	if test -f include/SDL_revision.h; then \
   172 	    $(INSTALL) -m 644 include/SDL_revision.h $(DESTDIR)$(includedir)/SDL2/SDL_revision.h; \
   173 	else \
   174 	    $(INSTALL) -m 644 $(srcdir)/include/SDL_revision.h $(DESTDIR)$(includedir)/SDL2/SDL_revision.h; \
   175 	fi
   176 
   177 install-lib: $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLTEST_TARGET)
   178 	$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)
   179 	$(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(TARGET) $(DESTDIR)$(libdir)/$(TARGET)
   180 	$(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(SDLMAIN_TARGET) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
   181 	$(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(SDLTEST_TARGET) $(DESTDIR)$(libdir)/$(SDLTEST_TARGET)
   182 install-data:
   183 	$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(datadir)/aclocal
   184 	$(INSTALL) -m 644 $(srcdir)/sdl2.m4 $(DESTDIR)$(datadir)/aclocal/sdl2.m4
   185 	$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/pkgconfig
   186 	$(INSTALL) -m 644 sdl2.pc $(DESTDIR)$(libdir)/pkgconfig
   187 ifeq ($(INSTALL_SDL2_CONFIG),TRUE)
   188 	$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/cmake/SDL2
   189 	$(INSTALL) -m 644 sdl2-config.cmake $(DESTDIR)$(libdir)/cmake/SDL2
   190 endif
   191 
   192 uninstall: uninstall-bin uninstall-hdrs uninstall-lib uninstall-data
   193 uninstall-bin:
   194 	rm -f $(DESTDIR)$(bindir)/sdl2-config
   195 uninstall-hdrs:
   196 	for file in $(HDRS) $(SDLTEST_HDRS); do \
   197 	    rm -f $(DESTDIR)$(includedir)/SDL2/$$file; \
   198 	done
   199 	rm -f $(DESTDIR)$(includedir)/SDL2/SDL_config.h
   200 	rm -f $(DESTDIR)$(includedir)/SDL2/SDL_revision.h
   201 	-rmdir $(DESTDIR)$(includedir)/SDL2
   202 uninstall-lib:
   203 	$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(TARGET)
   204 	rm -f $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
   205 	rm -f $(DESTDIR)$(libdir)/$(SDLTEST_TARGET)
   206 uninstall-data:
   207 	rm -f $(DESTDIR)$(datadir)/aclocal/sdl2.m4
   208 	rm -f $(DESTDIR)$(libdir)/pkgconfig/sdl2.pc
   209 	rm -f $(DESTDIR)$(libdir)/cmake/SDL2/sdl2-config.cmake
   210 
   211 clean:
   212 	rm -rf $(objects)
   213 	rm -rf $(gen)
   214 	if test -f test/Makefile; then (cd test; $(MAKE) $@); fi
   215 
   216 distclean: clean
   217 	rm -f Makefile Makefile.rules sdl2-config
   218 	rm -f config.status config.cache config.log libtool
   219 	rm -rf $(srcdir)/autom4te*
   220 	find $(srcdir) \( \
   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 test/Makefile; then (cd test; $(MAKE) $@); fi
   229 
   230 dist $(distfile):
   231 	$(SHELL) $(auxdir)/mkinstalldirs $(distdir)
   232 	(cd $(srcdir); tar cf - $(SRC_DIST)) | (cd $(distdir); tar xf -)
   233 	tar cf - $(GEN_DIST) | (cd $(distdir); tar xf -)
   234 	find $(distdir) \( \
   235 	    -name '*~' -o \
   236 	    -name '*.bak' -o \
   237 	    -name '*.old' -o \
   238 	    -name '*.rej' -o \
   239 	    -name '*.orig' -o \
   240 	    -name '.#*' \) \
   241 	    -exec rm -f {} \;
   242 	if test -f $(distdir)/test/Makefile; then (cd $(distdir)/test && make distclean); fi
   243 	(cd $(distdir); build-scripts/updaterev.sh)
   244 	tar cvf - $(distdir) | gzip --best >$(distfile)
   245 	rm -rf $(distdir)
   246 
   247 rpm: $(distfile)
   248 	rpmbuild -ta $?