Makefile 4.6 KB

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