Makefile 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. #
  2. # Licensed to Cloudera, Inc. under one
  3. # or more contributor license agreements. See the NOTICE file
  4. # distributed with this work for additional information
  5. # regarding copyright ownership. Cloudera, Inc. licenses this file
  6. # to you under the Apache License, Version 2.0 (the
  7. # "License"); you may not use this file except in compliance
  8. # with the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. #
  18. ifeq ($(ROOT),)
  19. $(error "Error: Expect the environment variable $$ROOT to point to the Desktop installation")
  20. endif
  21. include $(ROOT)/Makefile.sdk
  22. default::
  23. @echo ' env-install : Install into virtual-env'
  24. #
  25. # env-install
  26. # Install app into the virtual environment.
  27. #
  28. .PHONY: env-install
  29. env-install: compile ext-env-install
  30. @echo '--- Installing $(APP_NAME) into virtual-env'
  31. @$(ENV_PYTHON) setup.py develop -N -q
  32. ###################################
  33. # Build Hadoop plugins
  34. ###################################
  35. PLUGIN_DIR := $(realpath .)
  36. PLUGIN_JAVA_LIB := $(PLUGIN_DIR)/java-lib
  37. PLUGIN_JAVA_DIR := $(PLUGIN_DIR)/java
  38. PLUGIN := $(PLUGIN_JAVA_LIB)/hue-plugins-$(DESKTOP_VERSION).jar
  39. BLD_DIR_PLUGINS := $(PLUGIN_DIR)/java/target
  40. STATIC_GROUP_MAPPING_DIR := $(realpath .)/static-group-mapping
  41. STATIC_GROUP_MAPPING_SRC := $(STATIC_GROUP_MAPPING_DIR)/src
  42. STATIC_GROUP_MAPPING_BUILD := $(STATIC_GROUP_MAPPING_DIR)/target
  43. STATIC_GROUP_MAPPING_LIB := $(STATIC_GROUP_MAPPING_DIR)/java-lib
  44. STATIC_GROUP_MAPPING := $(STATIC_GROUP_MAPPING_LIB)/static-group-mapping-$(DESKTOP_VERSION).jar
  45. SUDO_SHELL_DIR := $(realpath .)/sudo-shell
  46. SUDO_SHELL_SRC := $(SUDO_SHELL_DIR)/src
  47. SUDO_SHELL_BUILD := $(SUDO_SHELL_DIR)/target
  48. SUDO_SHELL_LIB := $(SUDO_SHELL_DIR)/java-lib
  49. SUDO_SHELL := $(SUDO_SHELL_LIB)/sudo-shell-$(DESKTOP_VERSION).jar
  50. compile: $(PLUGIN) $(STATIC_GROUP_MAPPING) $(SUDO_SHELL)
  51. # Build the plugin jar iff the source is present
  52. ifneq (,$(wildcard $(PLUGIN_JAVA_DIR)))
  53. PLUGIN_OPTS := -Dbuild.dir=$(BLD_DIR_PLUGINS) \
  54. -Dhadoop.home=$(HADOOP_HOME) \
  55. -Dplugins.version=$(DESKTOP_VERSION)
  56. $(PLUGIN): $(shell find $(PLUGIN_JAVA_DIR) )
  57. mkdir -p $(PLUGIN_JAVA_LIB)
  58. @echo "--- Building Hadoop plugins"
  59. cd $(PLUGIN_JAVA_DIR) && mvn clean install -DskipTests
  60. cp $(BLD_DIR_PLUGINS)/hue-plugins-$(MAVEN_VERSION).jar $(PLUGIN)
  61. clean::
  62. rm -rf $(PLUGIN_JAVA_LIB)
  63. cd $(PLUGIN_JAVA_DIR) && mvn clean ||:
  64. else
  65. $(PLUGIN):
  66. $(error Cannot build hadoop plugin without source)
  67. endif
  68. # Build the static group mapping jar iff the source is present
  69. ifneq (,$(wildcard $(STATIC_GROUP_MAPPING_SRC)))
  70. STATIC_GROUP_MAPPING_OPTS := -Dbuild.dir=$(STATIC_GROUP_MAPPING_BUILD) \
  71. -Dhadoop.home=$(HADOOP_HOME) \
  72. -Dstatic-group-mapping.version=$(DESKTOP_VERSION)
  73. $(STATIC_GROUP_MAPPING): $(shell find $(STATIC_GROUP_MAPPING_SRC))
  74. mkdir -p $(STATIC_GROUP_MAPPING_LIB)
  75. @echo "--- Building static UserGroupMappingService"
  76. cd $(STATIC_GROUP_MAPPING_DIR) && mvn clean install -DskipTests
  77. cp $(STATIC_GROUP_MAPPING_BUILD)/static-group-mapping-$(MAVEN_VERSION).jar $(STATIC_GROUP_MAPPING)
  78. clean::
  79. rm -rf $(STATIC_GROUP_MAPPING_LIB)
  80. cd $(STATIC_GROUP_MAPPING_DIR) && mvn clean ||:
  81. else
  82. $(STATIC_GROUP_MAPPING):
  83. $(error Cannot build static-group-mapping jar without source)
  84. endif
  85. # Build the sudo shell jar iff the source is present
  86. ifneq (,$(wildcard $(SUDO_SHELL_SRC)))
  87. SUDO_SHELL_OPTS := -Dbuild.dir=$(SUDO_SHELL_BUILD) \
  88. -Dhadoop.home=$(HADOOP_HOME) \
  89. -Dsudo-shell.version=$(DESKTOP_VERSION)
  90. $(SUDO_SHELL): $(shell find $(SUDO_SHELL_SRC))
  91. mkdir -p $(SUDO_SHELL_LIB)
  92. @echo "--- Building sudo fsshell tool"
  93. cd $(SUDO_SHELL_DIR) && mvn clean install -DskipTests
  94. cp $(SUDO_SHELL_BUILD)/sudo-shell-$(MAVEN_VERSION).jar $(SUDO_SHELL)
  95. clean::
  96. rm -rf $(SUDO_SHELL_LIB)
  97. cd $(SUDO_SHELL_DIR) && mvn clean ||:
  98. else
  99. $(SUDO_SHELL):
  100. $(error cannot build sudo-shell jar without source)
  101. endif
  102. #
  103. # Tell the `bdist' target to exclude our java source.
  104. #
  105. BDIST_EXCLUDES += \
  106. --exclude=java \
  107. --exclude=static-group-mapping/src \
  108. --exclude=sudo-shell/src \
  109. --exclude=regenerate-thrift.sh