GNUmakefile 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. name := higan
  2. build := performance
  3. openmp := false
  4. local := true
  5. flags += -I. -I.. -I../higan
  6. ifeq ($(local),true)
  7. ifeq ($(findstring arm,$(shell uname -m)),arm)
  8. # According to
  9. # https://community.arm.com/developer/tools-software/tools/b/tools-software-ides-blog/posts/compiler-flags-across-architectures-march-mtune-and-mcpu
  10. # ... -mcpu=native is the ARM equivalent of -march=native on x86.
  11. flags += -mcpu=native
  12. else
  13. # This is not portable, but since Windows doesn't provide a uname binary,
  14. # it has to be the default.
  15. flags += -march=native
  16. endif
  17. endif
  18. nall.path := ../nall
  19. include $(nall.path)/GNUmakefile
  20. libco.path := ../libco
  21. include $(libco.path)/GNUmakefile
  22. ruby.path := ../ruby
  23. include $(ruby.path)/GNUmakefile
  24. hiro.path := ../hiro
  25. hiro.resource := resource/higan.rc
  26. include $(hiro.path)/GNUmakefile
  27. cores := fc sfc sg ms md pce msx cv gb gba ws ngp
  28. higan.path := ../higan
  29. include $(higan.path)/GNUmakefile
  30. higan-ui.path := ../higan-ui
  31. higan-ui.objects += higan-ui higan-ui-resource higan-ui-emulator
  32. higan-ui.objects += higan-ui-input higan-ui-menus higan-ui-program higan-ui-settings
  33. higan-ui.objects := $(higan-ui.objects:%=$(object.path)/%.o)
  34. $(object.path)/higan-ui.o: $(higan-ui.path)/higan-ui.cpp
  35. $(object.path)/higan-ui-resource.o: $(higan-ui.path)/resource/resource.cpp
  36. $(object.path)/higan-ui-emulator.o: $(higan-ui.path)/emulator/emulator.cpp
  37. $(object.path)/higan-ui-input.o: $(higan-ui.path)/input/input.cpp
  38. $(object.path)/higan-ui-menus.o: $(higan-ui.path)/menus/menus.cpp
  39. $(object.path)/higan-ui-program.o: $(higan-ui.path)/program/program.cpp
  40. $(object.path)/higan-ui-settings.o: $(higan-ui.path)/settings/settings.cpp
  41. all.objects := $(libco.objects) $(ruby.objects) $(hiro.objects) $(higan.objects) $(higan-ui.objects)
  42. all.options := $(libco.options) $(ruby.options) $(hiro.options) $(higan.options) $(higan-ui.options) $(options)
  43. all: $(all.objects)
  44. $(info Linking $(output.path)/$(name) ...)
  45. +@$(compiler) -o $(output.path)/$(name) $(all.objects) $(all.options)
  46. ifeq ($(platform),macos)
  47. rm -rf $(output.path)/$(name).app
  48. mkdir -p $(output.path)/$(name).app/Contents/MacOS/
  49. mkdir -p $(output.path)/$(name).app/Contents/Resources/
  50. mv $(output.path)/$(name) $(output.path)/$(name).app/Contents/MacOS/$(name)
  51. cp resource/$(name).plist $(output.path)/$(name).app/Contents/Info.plist
  52. sips -s format icns resource/$(name).png --out $(output.path)/$(name).app/Contents/Resources/$(name).icns
  53. endif
  54. verbose: nall.verbose ruby.verbose hiro.verbose all;
  55. clean:
  56. ifeq ($(platform),macos)
  57. rm -rf $(output.path)/$(name).app
  58. endif
  59. $(call delete,$(object.path)/*)
  60. $(call delete,$(output.path)/*)
  61. install: all
  62. ifeq ($(platform),windows)
  63. mkdir -p $(prefix)/$(name)/
  64. cp -R $(higan.path)/System/* $(prefix)/$(name)/
  65. else ifeq ($(shell id -un),root)
  66. $(error "make install should not be run as root")
  67. else ifeq ($(platform),macos)
  68. mkdir -p ~/Library/Application\ Support/$(name)/
  69. cp -R $(output.path)/$(name).app /Applications/$(name).app
  70. cp -R $(higan.path)/System/* ~/Library/Application\ Support/$(name)/
  71. else ifneq ($(filter $(platform),linux bsd),)
  72. mkdir -p $(prefix)/bin/
  73. mkdir -p $(prefix)/share/applications/
  74. mkdir -p $(prefix)/share/icons/
  75. mkdir -p $(prefix)/share/$(name)/
  76. cp $(output.path)/$(name) $(prefix)/bin/$(name)
  77. cp -R $(higan.path)/System/* $(prefix)/share/$(name)/
  78. sed "/^Exec/s:$(name):$(prefix)/bin/$(name):" resource/$(name).desktop >$(prefix)/share/applications/$(name).desktop
  79. cp resource/$(name).png $(prefix)/share/icons/$(name).png
  80. endif
  81. uninstall:
  82. ifeq ($(platform),windows)
  83. else ifeq ($(shell id -un),root)
  84. $(error "make uninstall should not be run as root")
  85. else ifeq ($(platform),macos)
  86. rm -rf /Applications/$(name).app
  87. else ifneq ($(filter $(platform),linux bsd),)
  88. rm -f $(prefix)/bin/$(name)
  89. rm -f $(prefix)/share/applications/$(name).desktop
  90. rm -f $(prefix)/share/icons/$(name).png
  91. endif
  92. -include $(object.path)/*.d