bundle.mk 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. # Input Variables
  2. # THEOS_SHARED_BUNDLE_INSTALL_NAME: bundle name and extension
  3. # THEOS_SHARED_BUNDLE_INSTALL_PATH: bundle install path
  4. # _THEOS_SHARED_BUNDLE_STAGE_PATH: bundle resource path (typically just INSTALL_PATH/INSTALL_NAME)
  5. #
  6. # Instance Variables:
  7. # xxx_RESOURCE_FILES: list of resource files to install (why would you use this in favour of xxx_RESOURCE_DIRS? eh.)
  8. # xxx_RESOURCE_DIRS: folders to copy resources from
  9. # note a deviation from gnustep-make's xxx_RESOURCE_DIRS which simply specifies resource subdirectories to create
  10. # defaults to Resources/ if it exists.
  11. .PHONY: shared-instance-bundle-stage
  12. ifeq ($(_THEOS_CURRENT_OPERATION),stage)
  13. THEOS_SHARED_BUNDLE_BINARY_PATH = $(_THEOS_SHARED_BUNDLE_STAGE_PATH)/$(_THEOS_TARGET_BUNDLE_BINARY_SUBDIRECTORY)
  14. THEOS_SHARED_BUNDLE_RESOURCE_PATH = $(_THEOS_SHARED_BUNDLE_STAGE_PATH)/$(_THEOS_TARGET_BUNDLE_RESOURCE_SUBDIRECTORY)
  15. else
  16. THEOS_SHARED_BUNDLE_BINARY_PATH = $(_THEOS_SHARED_BUNDLE_BUILD_PATH)/$(_THEOS_TARGET_BUNDLE_BINARY_SUBDIRECTORY)
  17. THEOS_SHARED_BUNDLE_RESOURCE_PATH = $(_THEOS_SHARED_BUNDLE_BUILD_PATH)/$(_THEOS_TARGET_BUNDLE_RESOURCE_SUBDIRECTORY)
  18. endif
  19. $(_THEOS_SHARED_BUNDLE_BUILD_PATH)/$(_THEOS_TARGET_BUNDLE_BINARY_SUBDIRECTORY) $(_THEOS_SHARED_BUNDLE_BUILD_PATH)/$(_THEOS_TARGET_BUNDLE_RESOURCE_SUBDIRECTORY) $(_THEOS_SHARED_BUNDLE_BUILD_PATH)/$(_THEOS_TARGET_BUNDLE_INFO_PLIST_SUBDIRECTORY)::
  20. $(ECHO_NOTHING)mkdir -p "$@"$(ECHO_END)
  21. _RESOURCE_FILES := $(or $($(THEOS_CURRENT_INSTANCE)_BUNDLE_RESOURCES),$($(THEOS_CURRENT_INSTANCE)_RESOURCE_FILES))
  22. _RESOURCE_DIRS := $(or $($(THEOS_CURRENT_INSTANCE)_BUNDLE_RESOURCE_DIRS),$($(THEOS_CURRENT_INSTANCE)_RESOURCE_DIRS))
  23. ifeq ($(_RESOURCE_DIRS),)
  24. ifeq ($(call __exists,Resources),$(_THEOS_TRUE))
  25. _RESOURCE_DIRS := Resources
  26. else
  27. _RESOURCE_DIRS :=
  28. endif
  29. endif
  30. shared-instance-bundle-all:: $(_THEOS_SHARED_BUNDLE_BUILD_PATH)/$(_THEOS_TARGET_BUNDLE_BINARY_SUBDIRECTORY) $(_THEOS_SHARED_BUNDLE_BUILD_PATH)/$(_THEOS_TARGET_BUNDLE_RESOURCE_SUBDIRECTORY) $(_THEOS_SHARED_BUNDLE_BUILD_PATH)/$(_THEOS_TARGET_BUNDLE_INFO_PLIST_SUBDIRECTORY)
  31. ifneq ($(_RESOURCE_FILES),)
  32. $(ECHO_COPYING_RESOURCE_FILES)for f in $(_RESOURCE_FILES); do \
  33. if [ -f "$$f" -o -d "$$f" ]; then \
  34. rsync -a "$$f" "$(_THEOS_SHARED_BUNDLE_BUILD_PATH)$(_THEOS_TARGET_BUNDLE_RESOURCE_SUBDIRECTORY)/" $(_THEOS_RSYNC_EXCLUDE_COMMANDLINE); \
  35. else \
  36. $(PRINT_FORMAT_WARNING) "Warning: ignoring missing bundle resource $$f." >&2; \
  37. fi; \
  38. done$(ECHO_END)
  39. endif
  40. ifneq ($(_RESOURCE_DIRS),)
  41. $(ECHO_COPYING_RESOURCE_DIRS)for d in $(_RESOURCE_DIRS); do \
  42. if [ -d "$$d" ]; then \
  43. rsync -a "$$d/" "$(_THEOS_SHARED_BUNDLE_BUILD_PATH)$(_THEOS_TARGET_BUNDLE_RESOURCE_SUBDIRECTORY)/" $(_THEOS_RSYNC_EXCLUDE_COMMANDLINE); \
  44. else \
  45. $(PRINT_FORMAT_WARNING) "Warning: ignoring missing bundle resource directory $$d." >&2; \
  46. fi; \
  47. done$(ECHO_END)
  48. endif
  49. ifneq ($(_THEOS_TARGET_BUNDLE_INFO_PLIST_SUBDIRECTORY),$(_THEOS_TARGET_BUNDLE_RESOURCE_SUBDIRECTORY))
  50. $(ECHO_NOTHING)if [ -f "$(_THEOS_SHARED_BUNDLE_BUILD_PATH)$(_THEOS_TARGET_BUNDLE_RESOURCE_SUBDIRECTORY)/Info.plist" ]; then\
  51. mv "$(_THEOS_SHARED_BUNDLE_BUILD_PATH)$(_THEOS_TARGET_BUNDLE_RESOURCE_SUBDIRECTORY)/Info.plist" "$(_THEOS_SHARED_BUNDLE_BUILD_PATH)$(_THEOS_TARGET_BUNDLE_INFO_PLIST_SUBDIRECTORY)/Info.plist";\
  52. fi$(ECHO_END)
  53. endif
  54. shared-instance-bundle-stage::
  55. ifneq ($($(THEOS_CURRENT_INSTANCE)_INSTALL),0)
  56. $(ECHO_NOTHING)mkdir -p "$(_THEOS_SHARED_BUNDLE_STAGE_PATH)"$(ECHO_END)
  57. $(ECHO_NOTHING)rsync -a "$(_THEOS_SHARED_BUNDLE_BUILD_PATH)/" "$(_THEOS_SHARED_BUNDLE_STAGE_PATH)"$(ECHO_END)
  58. endif