Makefile 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. # Makefile for buildroot2
  2. #
  3. # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. # General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. #
  19. #--------------------------------------------------------------
  20. # Just run 'make menuconfig', configure stuff, then run 'make'.
  21. # You shouldn't need to mess with anything beyond this point...
  22. #--------------------------------------------------------------
  23. TOPDIR=./
  24. CONFIG_CONFIG_IN = Config.in
  25. CONFIG_DEFCONFIG = .defconfig
  26. CONFIG = package/config
  27. noconfig_targets := menuconfig config oldconfig randconfig \
  28. defconfig allyesconfig allnoconfig clean distclean \
  29. release tags
  30. # Pull in the user's configuration file
  31. ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
  32. -include $(TOPDIR).config
  33. endif
  34. ifeq ($(BR2_TAR_VERBOSITY),y)
  35. TAR_OPTIONS=-xvf
  36. else
  37. TAR_OPTIONS=-xf
  38. endif
  39. ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
  40. #############################################################
  41. #
  42. # The list of stuff to build for the target toolchain
  43. # along with the packages to build for the target.
  44. #
  45. ##############################################################
  46. TARGETS:=host-sed kernel-headers uclibc-configured binutils gcc uclibc-target-utils
  47. include toolchain/Makefile.in
  48. include toolchain/*/Makefile.in
  49. include package/Makefile.in
  50. include package/*/Makefile.in
  51. include target/Makefile.in
  52. include target/*/Makefile.in
  53. #############################################################
  54. #
  55. # You should probably leave this stuff alone unless you know
  56. # what you are doing.
  57. #
  58. #############################################################
  59. all: world
  60. # In this section, we need .config
  61. include .config.cmd
  62. TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
  63. TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS))
  64. TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
  65. world: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) $(TARGETS)
  66. .PHONY: all world clean dirclean distclean source $(TARGETS) \
  67. $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \
  68. $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR)
  69. include toolchain/*/*.mk
  70. include package/*/*.mk
  71. include target/*/*.mk
  72. #############################################################
  73. #
  74. # staging and target directories do NOT list these as
  75. # dependancies anywhere else
  76. #
  77. #############################################################
  78. $(DL_DIR):
  79. @mkdir -p $(DL_DIR)
  80. $(BUILD_DIR):
  81. @mkdir -p $(BUILD_DIR)
  82. $(TOOL_BUILD_DIR):
  83. @mkdir -p $(TOOL_BUILD_DIR)
  84. $(STAGING_DIR):
  85. @mkdir -p $(STAGING_DIR)/lib
  86. @mkdir -p $(STAGING_DIR)/include
  87. @mkdir -p $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)
  88. @ln -sf ../lib $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib
  89. $(TARGET_DIR):
  90. zcat target/default/skel.tar.gz | tar -C $(BUILD_DIR) -xf -
  91. cp -a target/default/target_skeleton/* $(TARGET_DIR)/
  92. -find $(TARGET_DIR) -type d -name CVS -exec rm -rf {} \; > /dev/null 2>&1
  93. source: $(TARGETS_SOURCE)
  94. #############################################################
  95. #
  96. # Cleanup and misc junk
  97. #
  98. #############################################################
  99. clean: $(TARGETS_CLEAN)
  100. rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE)
  101. dirclean: $(TARGETS_DIRCLEAN)
  102. rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE)
  103. distclean:
  104. rm -rf $(DL_DIR) $(BUILD_DIR) $(LINUX_KERNEL) $(IMAGE)
  105. sourceball:
  106. rm -rf $(BUILD_DIR)
  107. set -e; \
  108. cd ..; \
  109. rm -f buildroot.tar.bz2; \
  110. tar -cvf buildroot.tar buildroot; \
  111. bzip2 -9 buildroot.tar; \
  112. else # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
  113. all: menuconfig
  114. # configuration
  115. # ---------------------------------------------------------------------------
  116. $(CONFIG)/conf:
  117. $(MAKE) -C $(CONFIG) conf
  118. -@if [ ! -f .config ] ; then \
  119. cp $(CONFIG_DEFCONFIG) .config; \
  120. fi
  121. $(CONFIG)/mconf:
  122. $(MAKE) -C $(CONFIG) ncurses conf mconf
  123. -@if [ ! -f .config ] ; then \
  124. cp $(CONFIG_DEFCONFIG) .config; \
  125. fi
  126. menuconfig: $(CONFIG)/mconf
  127. @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
  128. config: $(CONFIG)/conf
  129. @$(CONFIG)/conf $(CONFIG_CONFIG_IN)
  130. oldconfig: $(CONFIG)/conf
  131. @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
  132. randconfig: $(CONFIG)/conf
  133. @$(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
  134. allyesconfig: $(CONFIG)/conf
  135. #@$(CONFIG)/conf -y $(CONFIG_CONFIG_IN)
  136. #sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config
  137. @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
  138. allnoconfig: $(CONFIG)/conf
  139. @$(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
  140. defconfig: $(CONFIG)/conf
  141. @$(CONFIG)/conf -d $(CONFIG_CONFIG_IN)
  142. #############################################################
  143. #
  144. # Cleanup and misc junk
  145. #
  146. #############################################################
  147. clean:
  148. rm -f .config .config.old .config.cmd .tmpconfig.h
  149. - $(MAKE) -C $(CONFIG) clean
  150. distclean: clean
  151. rm -rf sources/*
  152. endif # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
  153. .PHONY: dummy subdirs release distclean clean config oldconfig \
  154. menuconfig tags check test depend