Makefile 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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/librdbms \
  49. libs/libsaml \
  50. libs/libsentry \
  51. libs/libsolr \
  52. libs/libzookeeper \
  53. libs/metadata \
  54. libs/notebook \
  55. libs/dashboard \
  56. libs/kafka
  57. .PHONY: default
  58. default:: hue syncdb
  59. ###################################
  60. # Configuration
  61. ###################################
  62. # <<<< DEV ONLY
  63. CONF_INI := $(patsubst $(CONF_DIR)/%.ini.tmpl,$(CONF_DIR)/%.ini,\
  64. $(wildcard $(CONF_DIR)/*.ini.tmpl))
  65. # Template ini to generate (only if it doesn't exist)
  66. $(CONF_DIR)/%.ini:: | $(CONF_DIR)/%.ini.tmpl
  67. echo "--- Generating $@"
  68. sed -e 's:$$HADOOP_HOME:$(HADOOP_HOME):' $| > $@
  69. # Pattern rule for HUE config file
  70. .PHONY: conf
  71. conf: $(CONF_INI)
  72. default:: conf
  73. # END DEV ONLY >>>>
  74. ###################################
  75. # Build apps
  76. ###################################
  77. # <<<< DEV ONLY
  78. include $(DESKTOP_ROOT)/devtools.mk
  79. # END DEV ONLY >>>>
  80. .PHONY: syncdb
  81. syncdb: $(DESKTOP_DB)
  82. $(DESKTOP_DB): $(BLD_DIR_BIN)/hue
  83. @if [ -n "$(DESKTOP_DEBUG)" ]; then \
  84. @echo "--- Regenerating database at $@" \
  85. @echo 'Removing old database (DESKTOP_DEBUG is set)' ; \
  86. @rm -f $@ ; \
  87. fi
  88. # Targets that simply recurse into all of the applications
  89. ENV_INSTALL_TARGETS := $(APPS:%=.recursive-env-install/%)
  90. $(info "----------------> ENV_INSTALL_TARGETS: $(ENV_INSTALL_TARGETS)")
  91. .recursive-env-install/%: %
  92. $(MAKE) -C $< env-install
  93. CLEAN_TARGETS := $(APPS:%=.recursive-clean/%)
  94. .recursive-clean/%: %
  95. $(MAKE) -C $< clean
  96. DISTCLEAN_TARGETS := $(APPS:%=.recursive-distclean/%)
  97. .recursive-distclean/%: %
  98. $(MAKE) -C $< distclean
  99. EXT_CLEAN_TARGETS := $(APPS:%=.recursive-ext-clean/%)
  100. .recursive-ext-clean/%: %
  101. $(MAKE) -C $< ext-clean
  102. .PHONY: env-install
  103. env-install: $(ENV_INSTALL_TARGETS)
  104. .PHONY: clean
  105. clean: $(CLEAN_TARGETS)
  106. @rm -f $(BLD_DIR)/.devtools
  107. .PHONY: distclean
  108. distclean: clean $(DISTCLEAN_TARGETS)
  109. .PHONY: ext-clean
  110. ext-clean: $(EXT_CLEAN_TARGETS)
  111. #
  112. # hue target
  113. #
  114. .PHONY: hue
  115. # <<<< DEV ONLY
  116. hue: $(BLD_DIR)/.devtools
  117. # END DEV ONLY >>>>
  118. hue: env-install
  119. @# Make symlink for backward compatibility
  120. @ln -sf hue $(BLD_DIR_BIN)/desktop
  121. ###################################
  122. # Distribution
  123. ###################################
  124. INSTALL_BDIST_TARGETS := $(APPS:%=.recursive-install-bdist/%)
  125. .recursive-install-bdist/%: %
  126. INSTALL_DIR=$(INSTALL_DIR)/desktop/$< \
  127. INSTALL_CONF_DIR=$(INSTALL_DIR)/desktop/conf \
  128. $(MAKE) -C $< install-bdist
  129. .PHONY: install
  130. install: install-source-parts $(INSTALL_BDIST_TARGETS)
  131. #
  132. # install-source-parts:
  133. # Installs the non-app parts (eg makefiles, conf) into
  134. # the INSTALL_DIR
  135. #
  136. # We should move all of the libs/* into some kind of container
  137. # python app, or into core.
  138. # TODO(todd) deal with these JS dependencies
  139. #
  140. SOURCE_PARTS = \
  141. $(wildcard *.mk) Makefile \
  142. conf
  143. .PHONY: install-source-parts
  144. install-source-parts:
  145. @mkdir -p $(INSTALL_DIR)/desktop
  146. @tar cf - $(SOURCE_PARTS) | tar -C $(INSTALL_DIR)/desktop -xf -
  147. @# Remove the application configuration files
  148. @find $(INSTALL_DIR)/desktop/conf -type l -exec rm {} \;
  149. # <<<< DEV ONLY
  150. ###################################
  151. # Internationalization
  152. ###################################
  153. COMPILE_LOCALE_TARGETS := $(APPS:%=.recursive-compile-locales/%)
  154. compile-locales: $(COMPILE_LOCALE_TARGETS)
  155. .recursive-compile-locales/%:
  156. @$(MAKE) -C $* compile-locale
  157. # END DEV ONLY >>>>