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