| 1 | # Makefile for buildroot2 |
|---|
| 2 | # |
|---|
| 3 | # Copyright (C) 1999-2005 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 | #-------------------------------------------------------------- |
|---|
| 21 | # Just run 'make menuconfig', configure stuff, then run 'make'. |
|---|
| 22 | # You shouldn't need to mess with anything beyond this point... |
|---|
| 23 | #-------------------------------------------------------------- |
|---|
| 24 | TOPDIR=./ |
|---|
| 25 | CONFIG_CONFIG_IN = Config.in |
|---|
| 26 | CONFIG_DEFCONFIG = .defconfig |
|---|
| 27 | CONFIG = scripts/kconfig |
|---|
| 28 | |
|---|
| 29 | noconfig_targets := menuconfig config oldconfig randconfig \ |
|---|
| 30 | defconfig allyesconfig allnoconfig release tags \ |
|---|
| 31 | $(shell find . -name *_defconfig |sed 's/.*\///') |
|---|
| 32 | |
|---|
| 33 | # Pull in the user's configuration file |
|---|
| 34 | ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) |
|---|
| 35 | -include $(TOPDIR).config |
|---|
| 36 | endif |
|---|
| 37 | |
|---|
| 38 | ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y) |
|---|
| 39 | |
|---|
| 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:=uclibc busybox |
|---|
| 47 | include package/Makefile.in |
|---|
| 48 | |
|---|
| 49 | ############################################################# |
|---|
| 50 | # |
|---|
| 51 | # You should probably leave this stuff alone unless you know |
|---|
| 52 | # what you are doing. |
|---|
| 53 | # |
|---|
| 54 | ############################################################# |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | all: world |
|---|
| 59 | |
|---|
| 60 | # In this section, we need .config |
|---|
| 61 | include .config.cmd |
|---|
| 62 | |
|---|
| 63 | # We also need the various per-package makefiles, which also add |
|---|
| 64 | # each selected package to TARGETS if that package was selected |
|---|
| 65 | # in the .config file. |
|---|
| 66 | include package/*/*.mk |
|---|
| 67 | include target/*/*.mk |
|---|
| 68 | |
|---|
| 69 | # target stuff is last so it can override anything else |
|---|
| 70 | include target/Makefile.in |
|---|
| 71 | |
|---|
| 72 | TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS)) |
|---|
| 73 | TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS)) |
|---|
| 74 | TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS)) |
|---|
| 75 | |
|---|
| 76 | world: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \ |
|---|
| 77 | $(TARGET_PACKAGES_DIR) $(TARGETS) |
|---|
| 78 | |
|---|
| 79 | .PHONY: all world clean dirclean distclean source $(TARGETS) \ |
|---|
| 80 | $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \ |
|---|
| 81 | $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR) |
|---|
| 82 | |
|---|
| 83 | ############################################################# |
|---|
| 84 | # |
|---|
| 85 | # staging and target directories do NOT list these as |
|---|
| 86 | # dependencies anywhere else |
|---|
| 87 | # |
|---|
| 88 | ############################################################# |
|---|
| 89 | $(DL_DIR): |
|---|
| 90 | @mkdir -p $(DL_DIR) |
|---|
| 91 | |
|---|
| 92 | $(BUILD_DIR): |
|---|
| 93 | @mkdir -p $(BUILD_DIR) |
|---|
| 94 | |
|---|
| 95 | $(TOOL_BUILD_DIR): |
|---|
| 96 | @mkdir -p $(TOOL_BUILD_DIR) |
|---|
| 97 | |
|---|
| 98 | $(STAGING_DIR): |
|---|
| 99 | @mkdir -p $(STAGING_DIR)/lib |
|---|
| 100 | @mkdir -p $(STAGING_DIR)/include |
|---|
| 101 | @mkdir -p $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME) |
|---|
| 102 | @ln -snf ../lib $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib |
|---|
| 103 | |
|---|
| 104 | $(TARGET_DIR): |
|---|
| 105 | if [ -f "$(TARGET_SKELETON)" ] ; then \ |
|---|
| 106 | $(ZCAT) $(TARGET_SKELETON) | tar -C $(BUILD_DIR) -xf -; \ |
|---|
| 107 | fi; |
|---|
| 108 | if [ -d "$(TARGET_SKEL_DIR)" ] ; then \ |
|---|
| 109 | cp -fa $(TARGET_SKEL_DIR)/* $(TARGET_DIR)/; \ |
|---|
| 110 | fi; |
|---|
| 111 | touch $(STAGING_DIR)/.fakeroot.00000 |
|---|
| 112 | -find $(TARGET_DIR) -type d -name CVS | xargs rm -rf |
|---|
| 113 | -find $(TARGET_DIR) -type d -name .svn | xargs rm -rf |
|---|
| 114 | |
|---|
| 115 | $(TARGET_PACKAGES_DIR): |
|---|
| 116 | @mkdir -p $(TARGET_PACKAGES_DIR) |
|---|
| 117 | |
|---|
| 118 | source: $(TARGETS_SOURCE) |
|---|
| 119 | |
|---|
| 120 | ############################################################# |
|---|
| 121 | # |
|---|
| 122 | # Cleanup and misc junk |
|---|
| 123 | # |
|---|
| 124 | ############################################################# |
|---|
| 125 | clean: $(TARGETS_CLEAN) |
|---|
| 126 | rm -rf $(STAGING_DIR) $(TARGET_PACKAGES_DIR) $(TARGET_DIR) $(IMAGE) |
|---|
| 127 | |
|---|
| 128 | dirclean: $(TARGETS_DIRCLEAN) |
|---|
| 129 | rm -rf $(STAGING_DIR) $(TARGET_PACKAGES_DIR) $(TARGET_DIR) $(IMAGE) |
|---|
| 130 | |
|---|
| 131 | distclean: |
|---|
| 132 | ifeq ($(DL_DIR),$(BASE_DIR)/dl) |
|---|
| 133 | rm -rf $(DL_DIR) |
|---|
| 134 | endif |
|---|
| 135 | rm -rf $(BUILD_DIR) $(LINUX_KERNEL) $(IMAGE) |
|---|
| 136 | |
|---|
| 137 | sourceball: |
|---|
| 138 | rm -rf $(BUILD_DIR) |
|---|
| 139 | set -e; \ |
|---|
| 140 | cd ..; \ |
|---|
| 141 | rm -f buildroot.tar.bz2; \ |
|---|
| 142 | tar -cvf buildroot.tar buildroot; \ |
|---|
| 143 | bzip2 -9 buildroot.tar; \ |
|---|
| 144 | |
|---|
| 145 | |
|---|
| 146 | else # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y) |
|---|
| 147 | |
|---|
| 148 | all: menuconfig |
|---|
| 149 | |
|---|
| 150 | # configuration |
|---|
| 151 | # --------------------------------------------------------------------------- |
|---|
| 152 | |
|---|
| 153 | $(CONFIG)/conf: |
|---|
| 154 | $(MAKE) -C $(CONFIG) conf |
|---|
| 155 | -@if [ ! -f .config ] ; then \ |
|---|
| 156 | cp $(CONFIG_DEFCONFIG) .config; \ |
|---|
| 157 | fi |
|---|
| 158 | $(CONFIG)/mconf: |
|---|
| 159 | $(MAKE) -C $(CONFIG) ncurses conf mconf |
|---|
| 160 | -@if [ ! -f .config ] ; then \ |
|---|
| 161 | cp $(CONFIG_DEFCONFIG) .config; \ |
|---|
| 162 | fi |
|---|
| 163 | |
|---|
| 164 | menuconfig: $(CONFIG)/mconf |
|---|
| 165 | @$(CONFIG)/mconf $(CONFIG_CONFIG_IN) |
|---|
| 166 | |
|---|
| 167 | config: $(CONFIG)/conf |
|---|
| 168 | @$(CONFIG)/conf $(CONFIG_CONFIG_IN) |
|---|
| 169 | |
|---|
| 170 | oldconfig: $(CONFIG)/conf |
|---|
| 171 | @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN) |
|---|
| 172 | |
|---|
| 173 | randconfig: $(CONFIG)/conf |
|---|
| 174 | @$(CONFIG)/conf -r $(CONFIG_CONFIG_IN) |
|---|
| 175 | |
|---|
| 176 | allyesconfig: $(CONFIG)/conf |
|---|
| 177 | #@$(CONFIG)/conf -y $(CONFIG_CONFIG_IN) |
|---|
| 178 | #sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config |
|---|
| 179 | @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN) |
|---|
| 180 | |
|---|
| 181 | allnoconfig: $(CONFIG)/conf |
|---|
| 182 | @$(CONFIG)/conf -n $(CONFIG_CONFIG_IN) |
|---|
| 183 | |
|---|
| 184 | defconfig: $(CONFIG)/conf |
|---|
| 185 | @$(CONFIG)/conf -d $(CONFIG_CONFIG_IN) |
|---|
| 186 | |
|---|
| 187 | %_defconfig: $(CONFIG)/conf |
|---|
| 188 | cp $(shell find . -name $@) .config |
|---|
| 189 | @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN) |
|---|
| 190 | |
|---|
| 191 | ############################################################# |
|---|
| 192 | # |
|---|
| 193 | # Cleanup and misc junk |
|---|
| 194 | # |
|---|
| 195 | ############################################################# |
|---|
| 196 | clean: |
|---|
| 197 | rm -f .config .config.old .config.cmd .tmpconfig.h |
|---|
| 198 | - $(MAKE) -C $(CONFIG) clean |
|---|
| 199 | |
|---|
| 200 | distclean: clean |
|---|
| 201 | rm -rf sources/* |
|---|
| 202 | |
|---|
| 203 | endif # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y) |
|---|
| 204 | |
|---|
| 205 | .PHONY: dummy subdirs release distclean clean config oldconfig \ |
|---|
| 206 | menuconfig tags check test depend defconfig |
|---|
| 207 | |
|---|
| 208 | |
|---|