Makefile 4.1 KB

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