OSDN Git Service

Merge branch 'develop' into macos-develop
[hengbandforosx/hengbandosx.git] / src / Makefile.am
index c06fdd9..ec23aa7 100644 (file)
@@ -152,8 +152,6 @@ hengband_SOURCES = \
        core/magic-effects-timeout-reducer.cpp core/magic-effects-timeout-reducer.h \
        core/object-compressor.cpp core/object-compressor.h \
        core/player-processor.cpp core/player-processor.h \
-       core/player-redraw-types.h \
-       core/player-update-types.h \
        core/score-util.cpp core/score-util.h \
        core/scores.cpp core/scores.h \
        core/show-file.cpp core/show-file.h \
@@ -296,7 +294,6 @@ hengband_SOURCES = \
        io/exit-panic.cpp io/exit-panic.h \
        io/files-util.cpp io/files-util.h \
        io/gf-descriptions.cpp io/gf-descriptions.h \
-       io/inet.cpp io/inet.h \
        io/input-key-acceptor.cpp io/input-key-acceptor.h \
        io/input-key-processor.cpp io/input-key-processor.h \
        io/input-key-requester.cpp io/input-key-requester.h \
@@ -397,8 +394,10 @@ hengband_SOURCES = \
        main/scene-table-monster.cpp main/scene-table-monster.h \
        main/sound-definitions-table.cpp main/sound-definitions-table.h \
        main/sound-of-music.cpp main/sound-of-music.h \
-       main/x11-gamma-builder.cpp main/x11-gamma-builder.h \
-       main/x11-type-string.cpp main/x11-type-string.h \
+       \
+       main-unix/unix-user-ids.cpp main-unix/unix-user-ids.h \
+       main-unix/x11-gamma-builder.cpp main-unix/x11-gamma-builder.h \
+       main-unix/x11-type-string.cpp main-unix/x11-type-string.h \
        \
        market/arena-info-table.cpp market/arena-info-table.h \
        market/building-initializer.cpp market/building-initializer.h \
@@ -700,7 +699,6 @@ hengband_SOURCES = \
        player-ability/player-strength.cpp player-ability/player-strength.h \
        player-ability/player-wisdom.cpp player-ability/player-wisdom.h \
        \
-       player-attack/player-attack-util.h \
        player-attack/attack-chaos-effect.cpp player-attack/attack-chaos-effect.h \
        player-attack/blood-sucking-processor.cpp player-attack/blood-sucking-processor.h \
        player-attack/player-attack.cpp player-attack/player-attack.h \
@@ -923,8 +921,9 @@ hengband_SOURCES = \
        system/h-system.h system/h-type.h \
        system/item-entity.cpp system/item-entity.h \
        system/monster-entity.cpp system/monster-entity.h \
-       system/monster-race-info.h \
+       system/monster-race-info.cpp system/monster-race-info.h \
        system/player-type-definition.cpp system/player-type-definition.h \
+       system/redrawing-flags-updater.cpp system/redrawing-flags-updater.h \
        system/system-variables.cpp system/system-variables.h \
        system/terrain-type-definition.cpp system/terrain-type-definition.h \
        system/gamevalue.h \
@@ -1042,26 +1041,122 @@ EXTRA_hengband_SOURCES = \
        main-win/main-win-tokenizer.cpp main-win/main-win-tokenizer.h \
        main-win/main-win-utils.cpp main-win/main-win-utils.h \
        main-win/wav-reader.cpp main-win/wav-reader.h \
+       main-cap.cpp \
        wall.bmp \
        stdafx.cpp stdafx.h
 
+cocoa_xcode_files = \
+       cocoa/AppDelegate.m \
+       cocoa/Base.lproj/MainMenu.xib \
+       cocoa/Base.lproj/SoundAndMusic.xib
+cocoa_icon_files = \
+       cocoa/hengband_Icons.icns \
+       cocoa/Save.icns \
+       cocoa/Edit.icns \
+       cocoa/Data.icns
+cocoa_plist_template = cocoa/Angband-Cocoa.xml
+cocoa_plist_strings_template = cocoa/Angband-Cocoa.strings
+cocoa_plist_files = \
+       cocoa/CommandMenu.plist
+cocoa_en_nib_files = \
+       cocoa/Base.lproj/MainMenu.nib \
+       cocoa/Base.lproj/SoundAndMusic.nib
+cocoa_en_strings_files = \
+       cocoa/en.lproj/Localizable.strings \
+       cocoa/en.lproj/CommandMenu.strings \
+       cocoa/en.lproj/GraphicsMenu.strings
+cocoa_ja_strings_files = \
+       cocoa/ja.lproj/MainMenu.strings \
+       cocoa/ja.lproj/SoundAndMusic.strings \
+       cocoa/ja.lproj/Localizable.strings \
+       cocoa/ja.lproj/CommandMenu.strings \
+       cocoa/ja.lproj/GraphicsMenu.strings
+
 EXTRA_DIST = \
-       gcc-wrap
+       gcc-wrap \
+       $(cocoa_xcode_files) \
+       $(cocoa_icon_files) \
+       $(cocoa_plist_template) \
+       $(cocoa_plist_strings_template) \
+       $(cocoa_plist_files) \
+       $(cocoa_en_nib_files) \
+       $(cocoa_en_strings_files) \
+       $(cocoa_ja_strings_files)
 
-DEFAULT_INCLUDES = -I$(srcdir) -I$(top_builddir)/src
-CPPFLAGS += $(XFT_CFLAGS) $(libcurl_CFLAGS)
-if PCH
-CPPFLAGS += -include ../src/stdafx.h
+if COCOA
+hengband_SOURCES += \
+       main-cocoa.mm \
+       system/grafmode.h \
+       system/grafmode.cpp \
+       cocoa/AppDelegate.h \
+       cocoa/AngbandAudio.h \
+       cocoa/AngbandAudio.mm \
+       cocoa/SoundAndMusic.h \
+       cocoa/SoundAndMusic.mm
+AM_CFLAGS = -mmacosx-version-min=10.15 -Wunguarded-availability
+AM_OBJCXXFLAGS = -std=c++20 -fobjc-arc -mmacosx-version-min=10.15 -Wunguarded-availability -stdlib=libc++
+AM_CXXFLAGS = -mmacosx-version-min=10.15 -Wunguarded-availability -stdlib=libc++
+hengband_LDFLAGS = -framework cocoa -framework AVFoundation $(AM_LDFLAGS)
+hengband_LINK = MACOSX_DEPLOYMENT_TARGET=10.15 $(OBJCXXLINK) $(hengband_LDFLAGS) $(LDFLAGS) -o $@
+APPNAME = $(PACKAGE_NAME)
+APPEXE = hengband
+APPDIR = $(APPNAME).app
+BUNDLE_IDENTIFIER = jp.osdn.hengband
+BUNDLE_VERSION = $(PACKAGE_VERSION)
+BUNDLE_DISPLAY_NAME = $(APPNAME)
+BUNDLE_NAME = $(BUNDLE_DISPLAY_NAME)
+BUNDLE_DISPLAY_NAME_JA = 変愚蛮怒
+BUNDLE_NAME_JA = $(BUNDLE_DISPLAY_NAME_JA)
+# Be careful with characters (like '&') in the copyright that have special
+# meanings to sed.
+COPYRIGHT = Copyright © Mr. Hoge and many others
+# For now, using the line that appears in news_j.txt.  Is that appropriate?
+# The ampersand is a kanji so it doesn't seem to be treated as a special
+# character by sed.
+COPYRIGHT_JA = Mr.hoge (echizen@users.sourceforge.jp) & 多くの方々
+APPBNDL = $(bindir)/$(APPDIR)
+APPCONT = $(APPBNDL)/Contents
+APPBIN = $(APPCONT)/MacOS
+APPRES = $(APPCONT)/Resources
+appbin_PROGRAMS = $(APPEXE)
+appbindir = $(APPBIN)
+dist_appicon_DATA = $(cocoa_icon_files)
+appicondir = $(APPRES)
+appplist_DATA = $(cocoa_plist_files)
+appplistdir = $(APPRES)
+appennib_DATA = $(cocoa_en_nib_files)
+appennibdir = $(APPRES)/Base.lproj
+appen_DATA = $(cocoa_en_strings_files)
+appendir = $(APPRES)/en.lproj
+appja_DATA = $(cocoa_ja_strings_files)
+appjadir = $(APPRES)/ja.lproj
+else
+EXTRA_hengband_SOURCES += main-cocoa.mm system/grafmode.h system/grafmode.cpp \
+       cocoa/AppDelegate.h
+hengband_LINK = $(CXXLINK)
 endif
+
+# The "-I$(top_builddir)/src/cocoa" is there so can use the same include
+# directives in the cocoa/*.{h,mm} files when building here or rebuilding the
+# nib files in Xcode according to the procedure in cocoa/AppDelegate.m.
+DEFAULT_INCLUDES = -I$(srcdir) -I$(top_builddir)/src -I$(top_builddir)/src/cocoa
+CPPFLAGS += $(XFT_CFLAGS) $(libcurl_CFLAGS)
 LIBS += $(XFT_LIBS) $(libcurl_LIBS)
 COMPILE = $(srcdir)/gcc-wrap $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
        $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+OBJCXXCOMPILE = $(srcdir)/gcc-wrap $(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) \
+       $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS)
 CXXCOMPILE = $(srcdir)/gcc-wrap $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CXXFLAGS)
+       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
 
 if PCH
+# Would use CPPFLAGS, but that affects both the C++ and Objective-C++
+# preprocessing:  don't want to use the precompiled header for the
+# Objective-C++ code.
+CXXCOMPILE += -include ../src/stdafx.h
+
 stdafx.h.gch: stdafx.h stdafx.cpp Makefile
-       $(CXX) -x c++-header $(CXXFLAGS) $(srcdir)/stdafx.cpp -o $@
+       $(CXX) -x c++-header $(CXXFLAGS) $(AM_CXXFLAGS) $(srcdir)/stdafx.cpp -o $@
        if test none != "$(PCH_CHECKSUMMER)" ; then \
                rm -f "$@".sum ; \
                $(PCH_CHECKSUMMER) $@ > "$@".sum ; \
@@ -1076,6 +1171,51 @@ if SET_GID
        chmod g+s "$(DESTDIR)$(bindir)/hengband"
 endif
 
+if COCOA
+# Suppress the warnings from the EUC-JP encoded strings used when building
+# the Japanese version.
+AM_CFLAGS += -Wno-invalid-source-encoding
+AM_CXXFLAGS += -Wno-invalid-source-encoding
+AM_OBJCXXFLAGS += -Wno-invalid-source-encoding
+
+# Create lib/info within the application bundle since not currently
+# installing anything to it.  Other relevant lib directories should
+# be created from the Makefiles in the lib directory.
+install-data-local:
+       @mkdir -p $(APPCONT)
+       @mkdir -p $(appendir)
+       @mkdir -p $(appjadir)
+       @mkdir -p $(APPRES)/lib/info
+       sed -e 's/\$$VERSION\$$/$(PACKAGE_VERSION)/' \
+               -e 's/\$$COPYRIGHT\$$/$(COPYRIGHT)/' \
+               -e 's/\$$NAME\$$/$(APPNAME)/' \
+               -e 's/\$$EXECUTABLE\$$/$(APPEXE)/' \
+               -e 's/\$$BUNDLE_VERSION\$$/$(BUNDLE_VERSION)/' \
+               -e 's/\$$BUNDLE_IDENTIFIER\$$/$(BUNDLE_IDENTIFIER)/' \
+               -e 's/\$$BUNDLE_DISPLAY_NAME\$$/$(BUNDLE_DISPLAY_NAME)/' \
+               -e 's/\$$BUNDLE_NAME\$$/$(BUNDLE_NAME)/' \
+               $(srcdir)/$(cocoa_plist_template) > $(APPCONT)/Info.plist
+       sed -e 's/\$$VERSION\$$/$(PACKAGE_VERSION)/' \
+               -e 's/\$$COPYRIGHT\$$/$(COPYRIGHT)/' \
+               -e 's/\$$BUNDLE_DISPLAY_NAME\$$/$(BUNDLE_DISPLAY_NAME)/' \
+               -e 's/\$$BUNDLE_NAME\$$/$(BUNDLE_NAME)/' \
+               $(srcdir)/$(cocoa_plist_strings_template) > $(appendir)/InfoPlist.strings
+       sed -e 's/\$$VERSION\$$/$(PACKAGE_VERSION)/' \
+               -e 's/\$$COPYRIGHT\$$/$(COPYRIGHT_JA)/' \
+               -e 's/\$$BUNDLE_DISPLAY_NAME\$$/$(BUNDLE_DISPLAY_NAME_JA)/' \
+               -e 's/\$$BUNDLE_NAME\$$/$(BUNDLE_NAME_JA)/' \
+               $(srcdir)/$(cocoa_plist_strings_template) > $(appjadir)/InfoPlist.strings
+
+uninstall-local:
+       -rm $(APPCONT)/Info.plist
+       -rm $(appendir)/InfoPlist.strings
+       -rm $(appjadir)/InfoPlist.strings
+
+endif
+
+distclean-local:
+       -rm -r -f $(DEPDIR) */$(DEPDIR) */*/$(DEPDIR)
+
 clean-local:
        -rm stdafx.h.gch stdafx.h.gch.sum
        -rm -rf ../build