Makefile 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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. # <<<< DEV ONLY
  19. #
  20. # This Makefile essentially lists the applications, and delegates build targets
  21. # through to them.
  22. #
  23. # The interesting bit is done by the recursive_app_make_target macro (see below).
  24. # In essence, the important targets are:
  25. #
  26. # install-binary-apps
  27. # installs built applications into the install dir, without
  28. # installing them into a virtual environment.
  29. #
  30. # env-install
  31. # installs all of the applications into the virtual environment
  32. #
  33. # clean
  34. # cleans up
  35. #
  36. # END DEV ONLY >>>>
  37. export ROOT := $(realpath ..)
  38. DESKTOP_ROOT := $(realpath .)
  39. include $(ROOT)/Makefile.vars.priv
  40. APPS := core \
  41. libs/aws \
  42. libs/azure \
  43. libs/hadoop \
  44. libs/indexer \
  45. libs/libanalyze \
  46. libs/liboauth \
  47. libs/liboozie \
  48. libs/libopenid \
  49. libs/librdbms \
  50. libs/libsaml \
  51. libs/libsentry \
  52. libs/libsolr \
  53. libs/libzookeeper \
  54. libs/metadata \
  55. libs/notebook \
  56. libs/dashboard \
  57. libs/kafka
  58. .PHONY: default
  59. default:: hue syncdb
  60. ###################################
  61. # Configuration
  62. ###################################
  63. # <<<< DEV ONLY
  64. CONF_INI := $(patsubst $(CONF_DIR)/%.ini.tmpl,$(CONF_DIR)/%.ini,\
  65. $(wildcard $(CONF_DIR)/*.ini.tmpl))
  66. # Template ini to generate (only if it doesn't exist)
  67. $(CONF_DIR)/%.ini:: | $(CONF_DIR)/%.ini.tmpl
  68. echo "--- Generating $@"
  69. sed -e 's:$$HADOOP_HOME:$(HADOOP_HOME):' $| > $@
  70. # Pattern rule for HUE config file
  71. .PHONY: conf
  72. conf: $(CONF_INI)
  73. default:: conf
  74. # END DEV ONLY >>>>
  75. ###################################
  76. # Build apps
  77. ###################################
  78. # <<<< DEV ONLY
  79. include $(DESKTOP_ROOT)/devtools.mk
  80. # END DEV ONLY >>>>
  81. .PHONY: syncdb
  82. syncdb: $(DESKTOP_DB)
  83. $(DESKTOP_DB): $(BLD_DIR_BIN)/hue
  84. @if [ -n "$(DESKTOP_DEBUG)" ]; then \
  85. @echo "--- Regenerating database at $@" \
  86. @echo 'Removing old database (DESKTOP_DEBUG is set)' ; \
  87. @rm -f $@ ; \
  88. fi
  89. # Targets that simply recurse into all of the applications
  90. ENV_INSTALL_TARGETS := $(APPS:%=.recursive-env-install/%)
  91. $(info "----------------> ENV_INSTALL_TARGETS: $(ENV_INSTALL_TARGETS)")
  92. .recursive-env-install/%: %
  93. $(MAKE) -C $< env-install
  94. CLEAN_TARGETS := $(APPS:%=.recursive-clean/%)
  95. .recursive-clean/%: %
  96. $(MAKE) -C $< clean
  97. DISTCLEAN_TARGETS := $(APPS:%=.recursive-distclean/%)
  98. .recursive-distclean/%: %
  99. $(MAKE) -C $< distclean
  100. EXT_CLEAN_TARGETS := $(APPS:%=.recursive-ext-clean/%)
  101. .recursive-ext-clean/%: %
  102. $(MAKE) -C $< ext-clean
  103. .PHONY: env-install
  104. env-install: $(ENV_INSTALL_TARGETS)
  105. .PHONY: clean
  106. clean: $(CLEAN_TARGETS)
  107. @rm -f $(BLD_DIR)/.devtools
  108. .PHONY: distclean
  109. distclean: clean $(DISTCLEAN_TARGETS)
  110. .PHONY: ext-clean
  111. ext-clean: $(EXT_CLEAN_TARGETS)
  112. #
  113. # hue target
  114. #
  115. .PHONY: hue
  116. # <<<< DEV ONLY
  117. hue: $(BLD_DIR)/.devtools
  118. # END DEV ONLY >>>>
  119. hue: env-install
  120. @# Make symlink for backward compatibility
  121. @ln -sf hue $(BLD_DIR_BIN)/desktop
  122. ###################################
  123. # Distribution
  124. ###################################
  125. INSTALL_BDIST_TARGETS := $(APPS:%=.recursive-install-bdist/%)
  126. .recursive-install-bdist/%: %
  127. INSTALL_DIR=$(INSTALL_DIR)/desktop/$< \
  128. INSTALL_CONF_DIR=$(INSTALL_DIR)/desktop/conf \
  129. $(MAKE) -C $< install-bdist
  130. .PHONY: install
  131. install: install-source-parts $(INSTALL_BDIST_TARGETS)
  132. #
  133. # install-source-parts:
  134. # Installs the non-app parts (eg makefiles, conf) into
  135. # the INSTALL_DIR
  136. #
  137. # We should move all of the libs/* into some kind of container
  138. # python app, or into core.
  139. # TODO(todd) deal with these JS dependencies
  140. #
  141. SOURCE_PARTS = \
  142. $(wildcard *.mk) Makefile \
  143. conf
  144. .PHONY: install-source-parts
  145. install-source-parts:
  146. @mkdir -p $(INSTALL_DIR)/desktop
  147. @tar cf - $(SOURCE_PARTS) | tar -C $(INSTALL_DIR)/desktop -xf -
  148. @# Remove the application configuration files
  149. @find $(INSTALL_DIR)/desktop/conf -type l -exec rm {} \;
  150. # <<<< DEV ONLY
  151. ###################################
  152. # Internationalization
  153. ###################################
  154. COMPILE_LOCALE_TARGETS := $(APPS:%=.recursive-compile-locales/%)
  155. compile-locales: $(COMPILE_LOCALE_TARGETS)
  156. .recursive-compile-locales/%:
  157. @$(MAKE) -C $* compile-locale
  158. # END DEV ONLY >>>>