From: nhmall Date: Sun, 29 Jan 2023 03:43:48 +0000 (-0500) Subject: soundlib in the Makefile hints updated X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=86368148bfe384acd710967ec5024feb17404d6b;p=nethack soundlib in the Makefile hints updated Move pieces of the Makefile hints sound-related changes that are not macOS-specific from sys/unix/hints/macOS.370 to some new include files. The WANT_MACSOUND block stays in sys/unix/hints/macOS.370 because it is system-specific. Before this change, the various Makefiles were assembled via hints files macOS.370 or linux.370. Both were using included portions from the following files in the sys/unix/hints/include directory, in this sequence: -INCLUDE multiw-1.370 -INCLUDE multiw-2.370 -INCLUDE compiler.370 -INCLUDE multiw-3.370 -INCLUDE cross-pre.370 -INCLUDE gbdates-pre.370 -INCLUDE gbdates-post.370 -INCLUDE cross-post.370 After this change, the various Makefiles will still be assembled via hints files macOS.370 or linux.370. They will continue to use included portions from the following files in the sys/unix/hints/include directory, but with three additional include files related to sound and soundlibs. This is the new sequence: -INCLUDE multiw-1.370 -INCLUDE multiw-2.370 -INCLUDE compiler.370 -INCLUDE multiw-3.370 + -INCLUDE multisnd1-pre.370 -INCLUDE cross-pre.370 -INCLUDE gbdates-pre.370 + -INCLUDE multisnd2-pre.370 -INCLUDE gbdates-post.370 + -INCLUDE multisnd-post.370 -INCLUDE cross-post.370 The include mechanism continues to allow common portions that can be shared between macOS and Linux to be maintained in a single place only, with minimal duplication. Now, that has been extended to include Makefile lines related to sounds and soundlib. --- diff --git a/sys/unix/hints/include/multisnd-post.370 b/sys/unix/hints/include/multisnd-post.370 new file mode 100644 index 000000000..114f5c40c --- /dev/null +++ b/sys/unix/hints/include/multisnd-post.370 @@ -0,0 +1,22 @@ +#------------------------------------------------------------------------------ +# NetHack 3.7 multisnd-post.370 $NHDT-Date: 1597332785 2020/08/13 15:33:05 $ $NHDT-Branch: NetHack-3.7 $ + +ifeq "$(HAVE_SNDLIB)" "1" +$(TARGETPFX)$(SNDLIBOBJ): $(SNDLIBSRC) $(HACK_H) + $(CC) $(CFLAGS) -c -o$@ $(SNDLIBSRC) +ifeq "$(NEEDS_WAV)" "1" +$(WAVDIR)/%.wav: ../util/uudecode $(WAVDIR)/%.uu + $^ + mv $(notdir $@) $@ + +../util/uudecode: uudecode.o + $(CC) $(LFLAGS) uudecode.o -o $@ + +uudecode.o: ../sys/share/uudecode.c + $(CC) $(CFLAGS) -c -o $@ ../sys/share/uudecode.c +endif # NEEDS_WAV +endif # HAVE_SNDLIB + +# end of multisnd-post.370 +#------------------------------------------------------------------------------ + diff --git a/sys/unix/hints/include/multisnd1-pre.370 b/sys/unix/hints/include/multisnd1-pre.370 new file mode 100644 index 000000000..45cf1b1b6 --- /dev/null +++ b/sys/unix/hints/include/multisnd1-pre.370 @@ -0,0 +1,39 @@ +#------------------------------------------------------------------------------ +# NetHack 3.7 multisnd1-pre.370 $NHDT-Date: 1597332785 2020/08/13 15:33:05 $ $NHDT-Branch: NetHack-3.7 $ +# +# If it's cross-platform it belongs in this file. +# If it's macOS-only, it belongs in macOS.370. +# If it's linux-only, it belongs in linux.370. +# + +#ifdef WANT_TESTSOUND +#HAVE_SNDLIB = 1 +#SNDCFLAGS+= -DSND_LIB_TESTSOUND +## NEEDS_SND_USERSOUNDS +## NEEDS_SND_SEAUTOMAP +## NEEDS_WAV +#SNDLIBSRC = ../sound/testsound/testsound.c +#SNDLIBOBJ = testsound.o +#LFLAGS += -lm +#endif # WANT_TESTSOUND + +# HAVE_SNDLIB or NEEDS_SND_USERSOUNDS or NEEDS_SND_SEAUTOMAP +# would have to be set prior to this. Any of them could have +# been set just above, or they could have been set in +# multiw-2 for Qt, or they could have been set in macOS.370 +# or linux.370 for something platform-specific. +# Regardless, if one of those is set, the related preprocessor +# defines need to be added to SNDCFLAGS here. +# +ifeq "$(HAVE_SNDLIB)" "1" +ifeq "$(NEEDS_SND_USERSOUNDS)" "1" +SNDCFLAGS+= -DUSER_SOUNDS +endif # NEEDS_SND_USERSOUNDS +ifeq "$(NEEDS_SND_SEAUTOMAP)" "1" +SNDCFLAGS+= -DSND_SOUNDEFFECTS_AUTOMAP +endif # NEEDS_SND_SEAUTOMAP +endif # HAVE_SNDLIB + +# +#------------------------------------------------------------------------------ + diff --git a/sys/unix/hints/include/multisnd2-pre.370 b/sys/unix/hints/include/multisnd2-pre.370 new file mode 100644 index 000000000..6a425ee4f --- /dev/null +++ b/sys/unix/hints/include/multisnd2-pre.370 @@ -0,0 +1,31 @@ +#------------------------------------------------------------------------------ +# NetHack 3.7 multisnd2-pre.370 $NHDT-Date: 1597332785 2020/08/13 15:33:05 $ $NHDT-Branch: NetHack-3.7 $ +# + +ifdef NEEDS_WAV +WAVDIR = ../sound/wav +SNDWAVS = se_squeak_A se_squeak_B se_squeak_B_flat se_squeak_C se_squeak_D \ + se_squeak_D_flat se_squeak_E se_squeak_E_flat se_squeak_F \ + se_squeak_F_sharp se_squeak_G se_squeak_G_sharp sound_Bell \ + sound_Bugle_A sound_Bugle_B sound_Bugle_C sound_Bugle_D \ + sound_Bugle_E sound_Bugle_F sound_Bugle_G \ + sound_Drum_Of_Earthquake sound_Fire_Horn sound_Frost_Horn \ + sound_Leather_Drum sound_Magic_Harp_A sound_Magic_Harp_B \ + sound_Magic_Harp_C sound_Magic_Harp_D sound_Magic_Harp_E \ + sound_Magic_Harp_F sound_Magic_Harp_G sound_Tooled_Horn_A \ + sound_Tooled_Horn_B sound_Tooled_Horn_C sound_Tooled_Horn_D \ + sound_Tooled_Horn_E sound_Tooled_Horn_F sound_Tooled_Horn_G \ + sound_Wooden_Flute_A sound_Wooden_Flute_B sound_Wooden_Flute_C \ + sound_Wooden_Flute_D sound_Wooden_Flute_E sound_Wooden_Flute_F \ + sound_Wooden_Flute_G sound_Wooden_Harp_A sound_Wooden_Harp_B \ + sound_Wooden_Harp_C sound_Wooden_Harp_D sound_Wooden_Harp_E \ + sound_Wooden_Harp_F sound_Wooden_Harp_G sound_Magic_Flute_A \ + sound_Magic_Flute_B sound_Magic_Flute_C sound_Magic_Flute_D \ + sound_Magic_Flute_E sound_Magic_Flute_F sound_Magic_Flute_G + +WAVS = $(addprefix $(WAVDIR)/, $(addsuffix .wav, $(SNDWAVS))) +endif # NEEDS_WAV + +# end of multisnd2-pre.370 +#------------------------------------------------------------------------------ + diff --git a/sys/unix/hints/include/multiw-2.370 b/sys/unix/hints/include/multiw-2.370 index 09bc577c4..f671335bb 100644 --- a/sys/unix/hints/include/multiw-2.370 +++ b/sys/unix/hints/include/multiw-2.370 @@ -147,6 +147,8 @@ WINSRC += $(WINQTSRC) WINOBJ0 += $(WINQTOBJ) SNDCFLAGS += -DSND_LIB_QTSOUND HAVE_SNDLIB = 1 +NEEDS_SND_USERSOUNDS = 1 +NEEDS_SND_SEAUTOMAP = 1 XTRASRC += tile.c XTRAOBJ += $(TARGETPFX)tile.o # diff --git a/sys/unix/hints/linux.370 b/sys/unix/hints/linux.370 index b0e83a6cd..ada161efc 100755 --- a/sys/unix/hints/linux.370 +++ b/sys/unix/hints/linux.370 @@ -113,18 +113,20 @@ endif #MAKEFILE_SRC endif #HAVE_NCURSESW endif #WANT_WIN_CURSES -# HAVE_SNDLIB could have been set in multiw-2 for Qt. -# If it is set, add USER_SOUNDS -ifeq "$(HAVE_SNDLIB)" "1" -SNDCFLAGS+= -DUSER_SOUNDS -endif +# +#-INCLUDE multisnd1-pre.370 +# -CFLAGS+= $(WINCFLAGS) #WINCFLAGS set from multiw-2.370 -CFLAGS+= $(SNDCFLAGS) #SNDCFLAGS set from multiw-2.370 +# WINCFLAGS set from multiw-2.370 +# SNDCFLAGS set from multisnd-pre.370 +CFLAGS+= $(WINCFLAGS) +CFLAGS+= $(SNDCFLAGS) CFLAGS+= $(NHCFLAGS) -CCXXFLAGS+= $(WINCFLAGS) #WINCFLAGS set from multiw-2.370 -CCXXFLAGS+= $(SNDCFLAGS) #SNDCFLAGS set from multiw-2.370 +# WINCFLAGS set from multiw-2.370 +# SNDCFLAGS set from multisnd-pre.370 +CCXXFLAGS+= $(WINCFLAGS) +CCXXFLAGS+= $(SNDCFLAGS) CCXXFLAGS+= $(NHCFLAGS) VARDATND = @@ -313,15 +315,19 @@ GAMEPERM = 0755 #-INCLUDE gbdates-pre.370 # +# +#-INCLUDE multisnd2-pre.370 +# + #-POST # #-INCLUDE gbdates-post.370 # - # -#-INCLUDE cross-post.370 +#-INCLUDE multisnd-post.370 # + ifdef WANT_LIBNH $(TARGETPFX)libnh.a: $(HOBJ) $(LIBNHSYSOBJ) ../lib/lua/liblua.a $(AR) rcs $@ $(HOBJ) $(LIBNHSYSOBJ) ../lib/lua/liblua.a @@ -331,4 +337,8 @@ $(TARGETPFX)libnhmain.o : ../sys/libnh/libnhmain.c $(HACK_H) $(TARGETPFX)winshim.o : ../win/shim/winshim.c $(HACK_H) $(CC) $(CFLAGS) -c -o$@ $< endif # WANT_LIBNH + # +#-INCLUDE cross-post.370 +# + diff --git a/sys/unix/hints/macOS.370 b/sys/unix/hints/macOS.370 index fa463437c..c4b9246a9 100755 --- a/sys/unix/hints/macOS.370 +++ b/sys/unix/hints/macOS.370 @@ -157,27 +157,27 @@ endif #MAKEFILE_SRC ifdef WANT_MACSOUND HAVE_SNDLIB = 1 -SNDCFLAGS+= -DSND_LIB_MACSOUND -DSND_SOUNDEFFECTS_AUTOMAP +NEEDS_SND_USERSOUNDS = 1 +NEEDS_SND_SEAUTOMAP = 1 +NEEDS_WAV = 1 +SNDCFLAGS+= -DSND_LIB_MACSOUND SNDLIBSRC = ../sound/macsound/macsound.m SNDLIBOBJ = macsound.o LFLAGS += -framework AppKit endif - -# HAVE_SNDLIB could have been set just above, or it could -# have been set in multiw-2 for Qt. Either way, if it is -# set, add USER_SOUNDS -ifeq "$(HAVE_SNDLIB)" "1" -SNDCFLAGS+= -DUSER_SOUNDS -endif -#WINCFLAGS set from multiw-2.370 -#SNDCFLAGS set from multiw-2.370 +# +#-INCLUDE multisnd1-pre.370 +# + +# WINCFLAGS set from multiw-2.370 +# SNDCFLAGS set from multisnd-pre.370 CFLAGS+= $(PKGCFLAGS) $(WINCFLAGS) CFLAGS+= $(SNDCFLAGS) CFLAGS+= $(NHCFLAGS) -#WINCFLAGS set from multiw-2.370 -#SNDCFLAGS set from multiw-2.370 +# WINCFLAGS set from multiw-2.370 +# SNDCFLAGS set from multisnd-pre.370 CCXXFLAGS+= $(WINCFLAGS) CCXXFLAGS+= $(SNDCFLAGS) CCXXFLAGS+= $(NHCFLAGS) @@ -392,49 +392,18 @@ VARDIR=$(HACKDIR) # #-INCLUDE gbdates-pre.370 # -ifdef WANT_MACSOUND -WAVDIR = ../sound/wav -SNDWAVS = se_squeak_A se_squeak_B se_squeak_B_flat se_squeak_C se_squeak_D \ - se_squeak_D_flat se_squeak_E se_squeak_E_flat se_squeak_F \ - se_squeak_F_sharp se_squeak_G se_squeak_G_sharp sound_Bell \ - sound_Bugle_A sound_Bugle_B sound_Bugle_C sound_Bugle_D \ - sound_Bugle_E sound_Bugle_F sound_Bugle_G \ - sound_Drum_Of_Earthquake sound_Fire_Horn sound_Frost_Horn \ - sound_Leather_Drum sound_Magic_Harp_A sound_Magic_Harp_B \ - sound_Magic_Harp_C sound_Magic_Harp_D sound_Magic_Harp_E \ - sound_Magic_Harp_F sound_Magic_Harp_G sound_Tooled_Horn_A \ - sound_Tooled_Horn_B sound_Tooled_Horn_C sound_Tooled_Horn_D \ - sound_Tooled_Horn_E sound_Tooled_Horn_F sound_Tooled_Horn_G \ - sound_Wooden_Flute_A sound_Wooden_Flute_B sound_Wooden_Flute_C \ - sound_Wooden_Flute_D sound_Wooden_Flute_E sound_Wooden_Flute_F \ - sound_Wooden_Flute_G sound_Wooden_Harp_A sound_Wooden_Harp_B \ - sound_Wooden_Harp_C sound_Wooden_Harp_D sound_Wooden_Harp_E \ - sound_Wooden_Harp_F sound_Wooden_Harp_G sound_Magic_Flute_A \ - sound_Magic_Flute_B sound_Magic_Flute_C sound_Magic_Flute_D \ - sound_Magic_Flute_E sound_Magic_Flute_F sound_Magic_Flute_G - -WAVS = $(addprefix $(WAVDIR)/, $(addsuffix .wav, $(SNDWAVS))) -endif +# +#-INCLUDE multisnd2-pre.370 +# #-POST # #-INCLUDE gbdates-post.370 # - -ifdef WANT_MACSOUND -$(TARGETPFX)$(SNDLIBOBJ): $(SNDLIBSRC) $(HACK_H) - $(CC) $(CFLAGS) -c -o$@ $(SNDLIBSRC) -$(WAVDIR)/%.wav: ../util/uudecode $(WAVDIR)/%.uu - $^ - mv $(notdir $@) $@ - -../util/uudecode: uudecode.o - $(CC) $(LFLAGS) uudecode.o -o $@ - -uudecode.o: ../sys/share/uudecode.c - $(CC) $(CFLAGS) -c -o $@ ../sys/share/uudecode.c -endif # WANT_MACSOUND +# +#-INCLUDE multisnd-post.370 +# ifdef WANT_LIBNH $(TARGETPFX)libnh.a: $(HOBJ) $(LIBNHSYSOBJ) ../lib/lua/liblua.a @@ -446,6 +415,10 @@ $(TARGETPFX)winshim.o : ../win/shim/winshim.c $(HACK_H) $(CC) $(CFLAGS) -c -o$@ $< endif # WANT_LIBNH +# +#-INCLUDE cross-post.370 +# + ifdef MAKEFILE_TOP ### ### Packaging @@ -628,5 +601,4 @@ endif # end of build_qt_pkg endif # WANT_WIN_QT for packaging endif # MAKEFILE_TOP # -#-INCLUDE cross-post.370 -# + diff --git a/util/.gitignore b/util/.gitignore index 72c61b948..40e8248dd 100644 --- a/util/.gitignore +++ b/util/.gitignore @@ -17,6 +17,7 @@ tile2x11 tile2bmp tile2beos gif2txt +uudecode txt2ppm tile2img.ttp xpm2ppm.ttp