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.
slouken@1362
     1
# Makefile to build and install the SDL library
slouken@1362
     2
slouken@1362
     3
top_builddir = .
slouken@1362
     4
srcdir  = @srcdir@
slouken@1362
     5
objects = build
jadahl@10303
     6
gen = gen
slouken@1362
     7
prefix = @prefix@
slouken@1362
     8
exec_prefix = @exec_prefix@
slouken@2156
     9
bindir	= @bindir@
slouken@2156
    10
libdir  = @libdir@
slouken@2156
    11
includedir = @includedir@
slouken@2156
    12
datarootdir = @datarootdir@
slouken@2156
    13
datadir	= @datadir@
slouken@1391
    14
auxdir	= @ac_aux_dir@
slouken@1362
    15
distpath = $(srcdir)/..
slouken@6250
    16
distdir = SDL2-@SDL_VERSION@
slouken@1362
    17
distfile = $(distdir).tar.gz
slouken@1362
    18
slouken@1380
    19
@SET_MAKE@
slouken@1362
    20
SHELL	= @SHELL@
slouken@1362
    21
CC      = @CC@
slouken@1362
    22
INCLUDE = @INCLUDE@
slouken@1362
    23
CFLAGS  = @BUILD_CFLAGS@
slouken@1521
    24
EXTRA_CFLAGS = @EXTRA_CFLAGS@
slouken@1393
    25
LDFLAGS = @BUILD_LDFLAGS@
slouken@1521
    26
EXTRA_LDFLAGS = @EXTRA_LDFLAGS@
slouken@1362
    27
LIBTOOL = @LIBTOOL@
slouken@1362
    28
INSTALL = @INSTALL@
slouken@1419
    29
AR	= @AR@
slouken@1419
    30
RANLIB	= @RANLIB@
slouken@2204
    31
WINDRES	= @WINDRES@
slouken@1362
    32
slouken@6250
    33
TARGET  = libSDL2.la
slouken@1362
    34
OBJECTS = @OBJECTS@
jadahl@10303
    35
GEN_HEADERS = @GEN_HEADERS@
jadahl@10303
    36
GEN_OBJECTS = @GEN_OBJECTS@
slouken@3334
    37
VERSION_OBJECTS = @VERSION_OBJECTS@
slouken@1362
    38
slouken@11245
    39
SDLMAIN_TARGET = libSDL2main.la
slouken@1397
    40
SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@
slouken@1397
    41
slouken@11245
    42
SDLTEST_TARGET = libSDL2_test.la
slouken@6688
    43
SDLTEST_OBJECTS = @SDLTEST_OBJECTS@
slouken@6688
    44
jadahl@10303
    45
WAYLAND_SCANNER = @WAYLAND_SCANNER@
jadahl@10303
    46
hugh@12713
    47
INSTALL_SDL2_CONFIG = @INSTALL_SDL2_CONFIG@
hugh@12713
    48
hugh@12673
    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
slouken@6250
    50
GEN_DIST = SDL2.spec
slouken@1362
    51
sbc@8876
    52
ifneq ($V,1)
sbc@8876
    53
RUN_CMD_AR     = @echo "  AR    " $@;
sbc@8876
    54
RUN_CMD_CC     = @echo "  CC    " $@;
sbc@8876
    55
RUN_CMD_CXX    = @echo "  CXX   " $@;
sbc@8876
    56
RUN_CMD_LTLINK = @echo "  LTLINK" $@;
sbc@8876
    57
RUN_CMD_RANLIB = @echo "  RANLIB" $@;
jadahl@10303
    58
RUN_CMD_GEN    = @echo "  GEN   " $@;
sbc@8876
    59
LIBTOOL += --quiet
sbc@8876
    60
endif
sbc@8876
    61
slouken@4929
    62
HDRS = \
slouken@4929
    63
	SDL.h \
slouken@4929
    64
	SDL_assert.h \
slouken@4929
    65
	SDL_atomic.h \
slouken@4929
    66
	SDL_audio.h \
slouken@8829
    67
	SDL_bits.h \
slouken@4929
    68
	SDL_blendmode.h \
slouken@4929
    69
	SDL_clipboard.h \
slouken@4929
    70
	SDL_cpuinfo.h \
slouken@8829
    71
	SDL_egl.h \
slouken@4929
    72
	SDL_endian.h \
slouken@4929
    73
	SDL_error.h \
slouken@4929
    74
	SDL_events.h \
icculus@7667
    75
	SDL_filesystem.h \
slouken@6690
    76
	SDL_gamecontroller.h \
slouken@4929
    77
	SDL_gesture.h \
slouken@4929
    78
	SDL_haptic.h \
slouken@5189
    79
	SDL_hints.h \
slouken@4929
    80
	SDL_joystick.h \
slouken@4929
    81
	SDL_keyboard.h \
slouken@5340
    82
	SDL_keycode.h \
slouken@4929
    83
	SDL_loadso.h \
slouken@5221
    84
	SDL_log.h \
slouken@4929
    85
	SDL_main.h \
slouken@6607
    86
	SDL_messagebox.h \
slouken@4929
    87
	SDL_mouse.h \
slouken@4929
    88
	SDL_mutex.h \
slouken@4929
    89
	SDL_name.h \
slouken@4929
    90
	SDL_opengl.h \
icculus@8827
    91
	SDL_opengl_glext.h \
slouken@4929
    92
	SDL_opengles.h \
slouken@8829
    93
	SDL_opengles2_gl2ext.h \
slouken@8829
    94
	SDL_opengles2_gl2.h \
slouken@8829
    95
	SDL_opengles2_gl2platform.h \
slouken@6205
    96
	SDL_opengles2.h \
slouken@8829
    97
	SDL_opengles2_khrplatform.h \
slouken@4929
    98
	SDL_pixels.h \
slouken@4929
    99
	SDL_platform.h \
slouken@4929
   100
	SDL_power.h \
slouken@4929
   101
	SDL_quit.h \
slouken@4929
   102
	SDL_rect.h \
slouken@5145
   103
	SDL_render.h \
slouken@4929
   104
	SDL_rwops.h \
slouken@4929
   105
	SDL_scancode.h \
slouken@12130
   106
	SDL_sensor.h \
slouken@4929
   107
	SDL_shape.h \
slouken@4929
   108
	SDL_stdinc.h \
slouken@4929
   109
	SDL_surface.h \
slouken@6345
   110
	SDL_system.h \
slouken@4929
   111
	SDL_syswm.h \
slouken@4929
   112
	SDL_thread.h \
slouken@4929
   113
	SDL_timer.h \
slouken@4929
   114
	SDL_touch.h \
icculus@7387
   115
	SDL_types.h \
slouken@4929
   116
	SDL_version.h \
slouken@4929
   117
	SDL_video.h \
icculus@11365
   118
	SDL_vulkan.h \
slouken@4929
   119
	begin_code.h \
slouken@4929
   120
	close_code.h
slouken@2122
   121
slouken@6689
   122
SDLTEST_HDRS = $(shell ls $(srcdir)/include | fgrep SDL_test)
slouken@6688
   123
slouken@1362
   124
LT_AGE      = @LT_AGE@
slouken@1362
   125
LT_CURRENT  = @LT_CURRENT@
slouken@1362
   126
LT_RELEASE  = @LT_RELEASE@
slouken@1362
   127
LT_REVISION = @LT_REVISION@
slouken@11291
   128
LT_LDFLAGS  = -no-undefined -rpath $(libdir) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
slouken@1362
   129
slouken@12469
   130
all: $(srcdir)/configure Makefile $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLTEST_TARGET)
slouken@1622
   131
hugh@12673
   132
$(srcdir)/configure: $(srcdir)/configure.ac
slouken@11206
   133
	@echo "Warning, configure is out of date, please re-run autogen.sh"
slouken@1362
   134
slouken@1362
   135
Makefile: $(srcdir)/Makefile.in
slouken@1362
   136
	$(SHELL) config.status $@
slouken@1362
   137
slouken@3416
   138
Makefile.in:;
slouken@3416
   139
slouken@12469
   140
$(objects)/.created:
slouken@12469
   141
	$(SHELL) $(auxdir)/mkinstalldirs $(objects)
slouken@12469
   142
	touch $@
slouken@1362
   143
slouken@2982
   144
update-revision:
slouken@2982
   145
	$(SHELL) $(auxdir)/updaterev.sh
slouken@2982
   146
slouken@5346
   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)
slouken@1362
   148
jadahl@10303
   149
$(objects)/$(TARGET): $(GEN_HEADERS) $(GEN_OBJECTS) $(OBJECTS) $(VERSION_OBJECTS)
jadahl@10303
   150
	$(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $(OBJECTS) $(GEN_OBJECTS) $(VERSION_OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
slouken@1362
   151
slouken@1397
   152
$(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS)
slouken@11291
   153
	$(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -static -o $@ $(SDLMAIN_OBJECTS) -rpath $(libdir)
slouken@1397
   154
slouken@6688
   155
$(objects)/$(SDLTEST_TARGET): $(SDLTEST_OBJECTS)
slouken@11291
   156
	$(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -static -o $@ $(SDLTEST_OBJECTS) -rpath $(libdir)
slouken@6688
   157
slouken@3352
   158
install: all install-bin install-hdrs install-lib install-data
slouken@1362
   159
install-bin:
hugh@12713
   160
ifeq ($(INSTALL_SDL2_CONFIG),TRUE)
slouken@2156
   161
	$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(bindir)
slouken@6250
   162
	$(INSTALL) -m 755 sdl2-config $(DESTDIR)$(bindir)/sdl2-config
hugh@12713
   163
endif
hugh@12713
   164
slouken@5345
   165
install-hdrs: update-revision
slouken@6250
   166
	$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(includedir)/SDL2
slouken@6688
   167
	for file in $(HDRS) $(SDLTEST_HDRS); do \
slouken@6250
   168
	    $(INSTALL) -m 644 $(srcdir)/include/$$file $(DESTDIR)$(includedir)/SDL2/$$file; \
slouken@1362
   169
	done
slouken@6250
   170
	$(INSTALL) -m 644 include/SDL_config.h $(DESTDIR)$(includedir)/SDL2/SDL_config.h
slouken@5345
   171
	if test -f include/SDL_revision.h; then \
slouken@6250
   172
	    $(INSTALL) -m 644 include/SDL_revision.h $(DESTDIR)$(includedir)/SDL2/SDL_revision.h; \
slouken@5345
   173
	else \
slouken@6250
   174
	    $(INSTALL) -m 644 $(srcdir)/include/SDL_revision.h $(DESTDIR)$(includedir)/SDL2/SDL_revision.h; \
slouken@5345
   175
	fi
slouken@5345
   176
slouken@6688
   177
install-lib: $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLTEST_TARGET)
slouken@2156
   178
	$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)
slouken@2156
   179
	$(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(TARGET) $(DESTDIR)$(libdir)/$(TARGET)
slouken@11245
   180
	$(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(SDLMAIN_TARGET) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
slouken@11245
   181
	$(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(SDLTEST_TARGET) $(DESTDIR)$(libdir)/$(SDLTEST_TARGET)
slouken@1362
   182
install-data:
slouken@2156
   183
	$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(datadir)/aclocal
slouken@6250
   184
	$(INSTALL) -m 644 $(srcdir)/sdl2.m4 $(DESTDIR)$(datadir)/aclocal/sdl2.m4
slouken@2156
   185
	$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/pkgconfig
slouken@6250
   186
	$(INSTALL) -m 644 sdl2.pc $(DESTDIR)$(libdir)/pkgconfig
hugh@12713
   187
ifeq ($(INSTALL_SDL2_CONFIG),TRUE)
slouken@9785
   188
	$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/cmake/SDL2
slouken@9785
   189
	$(INSTALL) -m 644 sdl2-config.cmake $(DESTDIR)$(libdir)/cmake/SDL2
hugh@12713
   190
endif
slouken@1362
   191
slouken@3352
   192
uninstall: uninstall-bin uninstall-hdrs uninstall-lib uninstall-data
slouken@1362
   193
uninstall-bin:
slouken@6250
   194
	rm -f $(DESTDIR)$(bindir)/sdl2-config
slouken@1362
   195
uninstall-hdrs:
slouken@6688
   196
	for file in $(HDRS) $(SDLTEST_HDRS); do \
slouken@6250
   197
	    rm -f $(DESTDIR)$(includedir)/SDL2/$$file; \
slouken@1362
   198
	done
slouken@6250
   199
	rm -f $(DESTDIR)$(includedir)/SDL2/SDL_config.h
slouken@6250
   200
	rm -f $(DESTDIR)$(includedir)/SDL2/SDL_revision.h
slouken@6250
   201
	-rmdir $(DESTDIR)$(includedir)/SDL2
slouken@1362
   202
uninstall-lib:
slouken@2156
   203
	$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(TARGET)
slouken@2156
   204
	rm -f $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
slouken@6688
   205
	rm -f $(DESTDIR)$(libdir)/$(SDLTEST_TARGET)
slouken@1362
   206
uninstall-data:
slouken@6250
   207
	rm -f $(DESTDIR)$(datadir)/aclocal/sdl2.m4
slouken@6250
   208
	rm -f $(DESTDIR)$(libdir)/pkgconfig/sdl2.pc
slouken@9785
   209
	rm -f $(DESTDIR)$(libdir)/cmake/SDL2/sdl2-config.cmake
slouken@1362
   210
slouken@1362
   211
clean:
slouken@1362
   212
	rm -rf $(objects)
jadahl@10303
   213
	rm -rf $(gen)
slouken@1380
   214
	if test -f test/Makefile; then (cd test; $(MAKE) $@); fi
slouken@1362
   215
slouken@1362
   216
distclean: clean
slouken@6250
   217
	rm -f Makefile Makefile.rules sdl2-config
slouken@3334
   218
	rm -f config.status config.cache config.log libtool
slouken@1362
   219
	rm -rf $(srcdir)/autom4te*
slouken@1603
   220
	find $(srcdir) \( \
slouken@1603
   221
	    -name '*~' -o \
slouken@1603
   222
	    -name '*.bak' -o \
slouken@1603
   223
	    -name '*.old' -o \
slouken@1603
   224
	    -name '*.rej' -o \
slouken@1603
   225
	    -name '*.orig' -o \
slouken@1603
   226
	    -name '.#*' \) \
slouken@1362
   227
	    -exec rm -f {} \;
slouken@1380
   228
	if test -f test/Makefile; then (cd test; $(MAKE) $@); fi
slouken@1362
   229
slouken@1362
   230
dist $(distfile):
slouken@1391
   231
	$(SHELL) $(auxdir)/mkinstalldirs $(distdir)
slouken@5498
   232
	(cd $(srcdir); tar cf - $(SRC_DIST)) | (cd $(distdir); tar xf -)
slouken@5498
   233
	tar cf - $(GEN_DIST) | (cd $(distdir); tar xf -)
slouken@1846
   234
	find $(distdir) \( \
slouken@1845
   235
	    -name '*~' -o \
slouken@1845
   236
	    -name '*.bak' -o \
slouken@1845
   237
	    -name '*.old' -o \
slouken@1845
   238
	    -name '*.rej' -o \
slouken@1845
   239
	    -name '*.orig' -o \
slouken@1845
   240
	    -name '.#*' \) \
slouken@1845
   241
	    -exec rm -f {} \;
slouken@1848
   242
	if test -f $(distdir)/test/Makefile; then (cd $(distdir)/test && make distclean); fi
slouken@6886
   243
	(cd $(distdir); build-scripts/updaterev.sh)
slouken@1362
   244
	tar cvf - $(distdir) | gzip --best >$(distfile)
slouken@1362
   245
	rm -rf $(distdir)
slouken@1362
   246
slouken@1362
   247
rpm: $(distfile)
slouken@1362
   248
	rpmbuild -ta $?