| 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 | # Two of the same kind.. |
|---|
| 25 | TOPDIR=./ |
|---|
| 26 | BASE_DIR:=${shell pwd} |
|---|
| 27 | |
|---|
| 28 | CONFIG_CONFIG_IN = Config.in |
|---|
| 29 | CONFIG_DEFCONFIG = .defconfig |
|---|
| 30 | CONFIG = scripts/kconfig |
|---|
| 31 | |
|---|
| 32 | # Which version of floppyfw is this? |
|---|
| 33 | FLOPPYFW_VERSION=3.1.0 |
|---|
| 34 | |
|---|
| 35 | # Old gruff, need to put somewhere else later. |
|---|
| 36 | SCRIPTS_DIR = $(BASE_DIR)/scripts |
|---|
| 37 | PATCH_DIR = $(BASE_DIR)/patches |
|---|
| 38 | CONFIG_DIR = $(BASE_DIR)/configs |
|---|
| 39 | FILES_DIR = $(BASE_DIR)/files |
|---|
| 40 | TMP_DIR = $(BASE_DIR)/tmp |
|---|
| 41 | MODULES_DIR = $(BUILD_DIR)/modules |
|---|
| 42 | PACKAGES_SKELETON_DIR = $(BASE_DIR)/skeletons/packages |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | SED=/usr/bin/perl -p -i -e |
|---|
| 46 | LZMAD=lzmacat |
|---|
| 47 | # LZMAC=lzma -c |
|---|
| 48 | LZMAC=lzmacomp |
|---|
| 49 | RM=rm -f |
|---|
| 50 | # For now, it's only this anyway: |
|---|
| 51 | BR2_ARCH="i386" |
|---|
| 52 | |
|---|
| 53 | noconfig_targets := menuconfig config oldconfig randconfig \ |
|---|
| 54 | defconfig allyesconfig allnoconfig release tags \ |
|---|
| 55 | $(shell find . -name *_defconfig |sed 's/.*\///') |
|---|
| 56 | |
|---|
| 57 | # Pull in the user's configuration file |
|---|
| 58 | ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) |
|---|
| 59 | -include $(TOPDIR).config |
|---|
| 60 | endif |
|---|
| 61 | |
|---|
| 62 | ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y) |
|---|
| 63 | |
|---|
| 64 | ############################################################# |
|---|
| 65 | # |
|---|
| 66 | # The list of stuff to build for the target toolchain |
|---|
| 67 | # along with the packages to build for the target. |
|---|
| 68 | # |
|---|
| 69 | ############################################################## |
|---|
| 70 | # We need these so we just put them here. |
|---|
| 71 | TARGETS:=uclibc linux busybox |
|---|
| 72 | include package/Makefile.in |
|---|
| 73 | # include target/Makefile.in |
|---|
| 74 | |
|---|
| 75 | ############################################################# |
|---|
| 76 | # |
|---|
| 77 | # You should probably leave this stuff alone unless you know |
|---|
| 78 | # what you are doing. |
|---|
| 79 | # |
|---|
| 80 | ############################################################# |
|---|
| 81 | |
|---|
| 82 | all: world |
|---|
| 83 | |
|---|
| 84 | echotarg: |
|---|
| 85 | echo $(TARGETS) |
|---|
| 86 | |
|---|
| 87 | # In this section, we need .config |
|---|
| 88 | include .config.cmd |
|---|
| 89 | |
|---|
| 90 | # We also need the various per-package makefiles, which also add |
|---|
| 91 | # each selected package to TARGETS if that package was selected |
|---|
| 92 | # in the .config file. |
|---|
| 93 | include package/*/*.mk |
|---|
| 94 | include target/*/*.mk |
|---|
| 95 | |
|---|
| 96 | # target stuff is last so it can override anything else |
|---|
| 97 | include target/Makefile.in |
|---|
| 98 | |
|---|
| 99 | TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS)) |
|---|
| 100 | TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS)) |
|---|
| 101 | TARGETS_SOURCE_CONFIGURED:=$(patsubst %,%-source-configured,$(TARGETS)) |
|---|
| 102 | TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS)) |
|---|
| 103 | TARGETS_MENUCONFIG:=$(patsubst %,%-menuconfig,$(TARGETS)) |
|---|
| 104 | |
|---|
| 105 | world: echotarg $(TMP_DIR) $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) \ |
|---|
| 106 | $(TARGET_DIR) $(TARGET_PACKAGES_DIR) $(TARGETS) floppy |
|---|
| 107 | |
|---|
| 108 | |
|---|
| 109 | .PHONY: all world clean dirclean distclean source veryclean $(TARGETS) \ |
|---|
| 110 | $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \ |
|---|
| 111 | $(TARGETS_SOURCE_CONFIGURED) $(TARGETS_MENUCONFIG) \ |
|---|
| 112 | $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR) \ |
|---|
| 113 | floppy |
|---|
| 114 | |
|---|
| 115 | ############################################################# |
|---|
| 116 | # |
|---|
| 117 | # staging and target directories do NOT list these as |
|---|
| 118 | # dependencies anywhere else |
|---|
| 119 | # |
|---|
| 120 | ############################################################# |
|---|
| 121 | $(TMP_DIR): |
|---|
| 122 | mkdir -p $(TMP_DIR) |
|---|
| 123 | |
|---|
| 124 | $(DL_DIR): |
|---|
| 125 | mkdir -p $(DL_DIR) |
|---|
| 126 | |
|---|
| 127 | $(BUILD_DIR): |
|---|
| 128 | mkdir -p $(BUILD_DIR) |
|---|
| 129 | # Can put it here anyway. |
|---|
| 130 | mkdir -p $(MODULES_DIR)/modules |
|---|
| 131 | |
|---|
| 132 | $(TOOL_BUILD_DIR): |
|---|
| 133 | mkdir -p $(TOOL_BUILD_DIR) |
|---|
| 134 | |
|---|
| 135 | $(STAGING_DIR): |
|---|
| 136 | mkdir -p $(STAGING_DIR)/lib |
|---|
| 137 | mkdir -p $(STAGING_DIR)/include |
|---|
| 138 | # mkdir -p $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME) |
|---|
| 139 | # ln -snf ../lib $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib |
|---|
| 140 | |
|---|
| 141 | # TARGET_DIR and INITRD_MASTER are created in initrd.mk and add.mk |
|---|
| 142 | |
|---|
| 143 | #$(TARGET_DIR): $(TMP_DIR) $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) \ |
|---|
| 144 | # $(TARGET_PACKAGES_DIR) |
|---|
| 145 | # if [ -f "$(TARGET_SKELETON)" ] ; then \ |
|---|
| 146 | # $(ZCAT) $(TARGET_SKELETON) | tar -C $(BUILD_DIR) -xf -; \ |
|---|
| 147 | # fi; |
|---|
| 148 | # if [ -d "$(TARGET_SKEL_DIR)" ] ; then \ |
|---|
| 149 | # cp -fa $(TARGET_SKEL_DIR)/* $(TARGET_DIR)/; \ |
|---|
| 150 | # fi; |
|---|
| 151 | # touch $(STAGING_DIR)/.fakeroot.00000 |
|---|
| 152 | # -find $(TARGET_DIR) -type d -name CVS | xargs rm -rf |
|---|
| 153 | # -find $(TARGET_DIR) -type d -name .svn | xargs rm -rf |
|---|
| 154 | |
|---|
| 155 | $(TARGET_PACKAGES_DIR): |
|---|
| 156 | mkdir -p $(TARGET_PACKAGES_DIR) |
|---|
| 157 | |
|---|
| 158 | source: $(TARGETS_SOURCE) |
|---|
| 159 | |
|---|
| 160 | ############################################################# |
|---|
| 161 | # |
|---|
| 162 | # Cleanup and misc junk |
|---|
| 163 | # |
|---|
| 164 | ############################################################# |
|---|
| 165 | clean: $(TARGETS_CLEAN) |
|---|
| 166 | rm -rf $(STAGING_DIR) $(TARGET_PACKAGES_DIR) $(TARGET_DIR) $(IMAGE) |
|---|
| 167 | |
|---|
| 168 | dirclean: $(TARGETS_DIRCLEAN) |
|---|
| 169 | rm -rf $(STAGING_DIR) $(TARGET_PACKAGES_DIR) $(TARGET_DIR) $(IMAGE) |
|---|
| 170 | |
|---|
| 171 | distclean: |
|---|
| 172 | ifeq ($(DL_DIR),$(BASE_DIR)/dl) |
|---|
| 173 | rm -rf $(DL_DIR) |
|---|
| 174 | endif |
|---|
| 175 | rm -rf $(BUILD_DIR) $(LINUX_KERNEL) $(IMAGE) |
|---|
| 176 | |
|---|
| 177 | veryclean: |
|---|
| 178 | $(RM) -r $(BUILD_DIR) |
|---|
| 179 | # Dangerous.. |
|---|
| 180 | $(RM) -r floppy* |
|---|
| 181 | |
|---|
| 182 | sourceball: |
|---|
| 183 | rm -rf $(BUILD_DIR) |
|---|
| 184 | set -e; \ |
|---|
| 185 | cd ..; \ |
|---|
| 186 | rm -f buildroot.tar.bz2; \ |
|---|
| 187 | tar -cvf buildroot.tar buildroot; \ |
|---|
| 188 | bzip2 -9 buildroot.tar; \ |
|---|
| 189 | |
|---|
| 190 | |
|---|
| 191 | else # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y) |
|---|
| 192 | |
|---|
| 193 | all: menuconfig |
|---|
| 194 | |
|---|
| 195 | # configuration |
|---|
| 196 | # --------------------------------------------------------------------------- |
|---|
| 197 | |
|---|
| 198 | HOSTCC=/bin/gcc |
|---|
| 199 | export HOSTCC |
|---|
| 200 | $(CONFIG)/conf: |
|---|
| 201 | @mkdir -p $(CONFIG)/buildroot-config |
|---|
| 202 | $(MAKE) CC=$(HOSTCC) -C $(CONFIG) conf |
|---|
| 203 | -if [ ! -f .config ] ; then \ |
|---|
| 204 | cp $(CONFIG_DEFCONFIG) .config; \ |
|---|
| 205 | fi |
|---|
| 206 | $(CONFIG)/mconf: |
|---|
| 207 | @mkdir -p $(CONFIG)/buildroot-config |
|---|
| 208 | $(MAKE) CC=$(HOSTCC) -C $(CONFIG) conf mconf |
|---|
| 209 | -if [ ! -f .config ] ; then \ |
|---|
| 210 | cp $(CONFIG_DEFCONFIG) .config; \ |
|---|
| 211 | fi |
|---|
| 212 | |
|---|
| 213 | menuconfig: $(CONFIG)/mconf |
|---|
| 214 | $(CONFIG)/mconf $(CONFIG_CONFIG_IN) |
|---|
| 215 | |
|---|
| 216 | config: $(CONFIG)/conf |
|---|
| 217 | $(CONFIG)/conf $(CONFIG_CONFIG_IN) |
|---|
| 218 | |
|---|
| 219 | oldconfig: $(CONFIG)/conf |
|---|
| 220 | $(CONFIG)/conf -o $(CONFIG_CONFIG_IN) |
|---|
| 221 | |
|---|
| 222 | randconfig: $(CONFIG)/conf |
|---|
| 223 | $(CONFIG)/conf -r $(CONFIG_CONFIG_IN) |
|---|
| 224 | |
|---|
| 225 | allyesconfig: $(CONFIG)/conf |
|---|
| 226 | #$(CONFIG)/conf -y $(CONFIG_CONFIG_IN) |
|---|
| 227 | #sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config |
|---|
| 228 | $(CONFIG)/conf -o $(CONFIG_CONFIG_IN) |
|---|
| 229 | |
|---|
| 230 | allnoconfig: $(CONFIG)/conf |
|---|
| 231 | $(CONFIG)/conf -n $(CONFIG_CONFIG_IN) |
|---|
| 232 | |
|---|
| 233 | defconfig: $(CONFIG)/conf |
|---|
| 234 | $(CONFIG)/conf -d $(CONFIG_CONFIG_IN) |
|---|
| 235 | |
|---|
| 236 | %_defconfig: $(CONFIG)/conf |
|---|
| 237 | cp $(shell find . -name $@) .config |
|---|
| 238 | $(CONFIG)/conf -o $(CONFIG_CONFIG_IN) |
|---|
| 239 | |
|---|
| 240 | ############################################################# |
|---|
| 241 | # |
|---|
| 242 | # Cleanup and misc junk |
|---|
| 243 | # |
|---|
| 244 | ############################################################# |
|---|
| 245 | clean: |
|---|
| 246 | rm -f .config .config.old .config.cmd .tmpconfig.h |
|---|
| 247 | - $(MAKE) -C $(CONFIG) clean |
|---|
| 248 | |
|---|
| 249 | distclean: clean |
|---|
| 250 | rm -rf sources/* |
|---|
| 251 | |
|---|
| 252 | veryclean: |
|---|
| 253 | $(RM) -r $(BUILD_DIR) |
|---|
| 254 | # Dangerous.. |
|---|
| 255 | $(RM) -r floppy* |
|---|
| 256 | |
|---|
| 257 | sourceball: |
|---|
| 258 | $(RM) -r $(BUILD_DIR) |
|---|
| 259 | set -e; \ |
|---|
| 260 | cd ..; \ |
|---|
| 261 | $(RM) buildroot.tar.bz2; \ |
|---|
| 262 | tar -cvf buildroot.tar buildroot; \ |
|---|
| 263 | bzip2 -9 buildroot.tar |
|---|
| 264 | |
|---|
| 265 | endif # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y) |
|---|
| 266 | |
|---|
| 267 | .PHONY: dummy subdirs release distclean clean config oldconfig \ |
|---|
| 268 | menuconfig tags check test depend defconfig veryclean |
|---|
| 269 | |
|---|
| 270 | |
|---|