Makefile 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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. include toolchain/*/*.mk
  69. include package/*/*.mk
  70. include target/*/*.mk
  71. #############################################################
  72. #
  73. # staging and target directories do NOT list these as
  74. # dependancies anywhere else
  75. #
  76. #############################################################
  77. $(DL_DIR):
  78. mkdir $(DL_DIR)
  79. $(BUILD_DIR):
  80. mkdir $(BUILD_DIR)
  81. $(TOOL_BUILD_DIR):
  82. mkdir $(TOOL_BUILD_DIR)
  83. $(STAGING_DIR):
  84. rm -rf $(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. rm -rf $(TARGET_DIR)
  91. zcat target/default/skel.tar.gz | tar -C $(BUILD_DIR) -xf -
  92. cp -a target/default/target_skeleton/* $(TARGET_DIR)/
  93. -find $(TARGET_DIR) -type d -name CVS -exec rm -rf {} \; > /dev/null 2>&1
  94. source: $(TARGETS_SOURCE)
  95. #############################################################
  96. #
  97. # Cleanup and misc junk
  98. #
  99. #############################################################
  100. clean: $(TARGETS_CLEAN)
  101. rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE)
  102. dirclean: $(TARGETS_DIRCLEAN)
  103. rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE)
  104. distclean:
  105. rm -rf $(DL_DIR) $(BUILD_DIR) $(LINUX_KERNEL) $(IMAGE)
  106. sourceball:
  107. rm -rf $(BUILD_DIR)
  108. set -e; \
  109. cd ..; \
  110. rm -f buildroot.tar.bz2; \
  111. tar -cvf buildroot.tar buildroot; \
  112. bzip2 -9 buildroot.tar; \
  113. else # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
  114. all: menuconfig
  115. # configuration
  116. # ---------------------------------------------------------------------------
  117. $(CONFIG)/conf:
  118. $(MAKE) -C $(CONFIG) conf
  119. -@if [ ! -f .config ] ; then \
  120. cp $(CONFIG_DEFCONFIG) .config; \
  121. fi
  122. $(CONFIG)/mconf:
  123. $(MAKE) -C $(CONFIG) ncurses conf mconf
  124. -@if [ ! -f .config ] ; then \
  125. cp $(CONFIG_DEFCONFIG) .config; \
  126. fi
  127. menuconfig: $(CONFIG)/mconf
  128. @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
  129. config: $(CONFIG)/conf
  130. @$(CONFIG)/conf $(CONFIG_CONFIG_IN)
  131. oldconfig: $(CONFIG)/conf
  132. @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
  133. randconfig: $(CONFIG)/conf
  134. @$(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
  135. allyesconfig: $(CONFIG)/conf
  136. #@$(CONFIG)/conf -y $(CONFIG_CONFIG_IN)
  137. #sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config
  138. @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
  139. allnoconfig: $(CONFIG)/conf
  140. @$(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
  141. defconfig: $(CONFIG)/conf
  142. @$(CONFIG)/conf -d $(CONFIG_CONFIG_IN)
  143. #############################################################
  144. #
  145. # Cleanup and misc junk
  146. #
  147. #############################################################
  148. clean:
  149. rm -f .config .config.old .config.cmd .tmpconfig.h
  150. - $(MAKE) -C $(CONFIG) clean
  151. distclean: clean
  152. rm -rf sources/*
  153. endif # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
  154. .PHONY: dummy subdirs release distclean clean config oldconfig \
  155. menuconfig tags check test depend