]> granicus.if.org Git - nethack/commitdiff
soundlib in the Makefile hints updated
authornhmall <nhmall@nethack.org>
Sun, 29 Jan 2023 03:43:48 +0000 (22:43 -0500)
committernhmall <nhmall@nethack.org>
Sun, 29 Jan 2023 03:43:48 +0000 (22:43 -0500)
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.

sys/unix/hints/include/multisnd-post.370 [new file with mode: 0644]
sys/unix/hints/include/multisnd1-pre.370 [new file with mode: 0644]
sys/unix/hints/include/multisnd2-pre.370 [new file with mode: 0644]
sys/unix/hints/include/multiw-2.370
sys/unix/hints/linux.370
sys/unix/hints/macOS.370
util/.gitignore

diff --git a/sys/unix/hints/include/multisnd-post.370 b/sys/unix/hints/include/multisnd-post.370
new file mode 100644 (file)
index 0000000..114f5c4
--- /dev/null
@@ -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 (file)
index 0000000..45cf1b1
--- /dev/null
@@ -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 (file)
index 0000000..6a425ee
--- /dev/null
@@ -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
+#------------------------------------------------------------------------------
+
index 09bc577c4d44130a0fa8c6d76de3c8995bbce583..f671335bb8787640b753a85c41b39cf02d70e888 100644 (file)
@@ -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
 #
index b0e83a6cd7f0995f172b8aa7ae4303af308fee75..ada161efc36ba7c477826cec09afb6a77a3a0bf0 100755 (executable)
@@ -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
+#
+
index fa463437ca65d8205b6c3b7a6f69109f79b6606a..c4b9246a98f52f2fca27112e6c5383499d4e1114 100755 (executable)
@@ -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
-#
+
index 72c61b948c8b7a182a57ae426a76c12c6e385361..40e8248dde11650ed51b3e2e0a7ed026e61750fd 100644 (file)
@@ -17,6 +17,7 @@ tile2x11
 tile2bmp
 tile2beos
 gif2txt
+uudecode
 txt2ppm
 tile2img.ttp
 xpm2ppm.ttp