Eric Andersen | 2d523c2 | 2004-10-09 01:06:03 +0000 | [diff] [blame] | 1 | # Makefile for buildroot2 |
Eric Andersen | ffde94b | 2001-12-22 00:56:11 +0000 | [diff] [blame] | 2 | # |
Eric Andersen | 15b26ae | 2005-02-07 22:19:26 +0000 | [diff] [blame] | 3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> |
Eric Andersen | ffde94b | 2001-12-22 00:56:11 +0000 | [diff] [blame] | 4 | # |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 5 | # This program is free software; you can redistribute it and/or modify |
Eric Andersen | 2d523c2 | 2004-10-09 01:06:03 +0000 | [diff] [blame] | 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. |
Eric Andersen | ffde94b | 2001-12-22 00:56:11 +0000 | [diff] [blame] | 9 | # |
Eric Andersen | 2d523c2 | 2004-10-09 01:06:03 +0000 | [diff] [blame] | 10 | # This program is distributed in the hope that it will be useful, |
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
Eric Andersen | 2d523c2 | 2004-10-09 01:06:03 +0000 | [diff] [blame] | 13 | # General Public License for more details. |
Eric Andersen | ffde94b | 2001-12-22 00:56:11 +0000 | [diff] [blame] | 14 | # |
Eric Andersen | 2d523c2 | 2004-10-09 01:06:03 +0000 | [diff] [blame] | 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 | # |
Eric Andersen | ffde94b | 2001-12-22 00:56:11 +0000 | [diff] [blame] | 19 | |
Eric Andersen | 2d523c2 | 2004-10-09 01:06:03 +0000 | [diff] [blame] | 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 = package/config |
| 28 | |
| 29 | noconfig_targets := menuconfig config oldconfig randconfig \ |
| 30 | defconfig allyesconfig allnoconfig clean distclean \ |
| 31 | release tags |
| 32 | |
| 33 | # Pull in the user's configuration file |
| 34 | ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) |
| 35 | -include $(TOPDIR).config |
| 36 | endif |
| 37 | |
Eric Andersen | bad6428 | 2004-10-09 21:12:25 +0000 | [diff] [blame] | 38 | ifeq ($(BR2_TAR_VERBOSITY),y) |
Eric Andersen | bb05a9a | 2004-10-09 21:19:47 +0000 | [diff] [blame] | 39 | TAR_OPTIONS=-xvf |
Mike Frysinger | 1f41bb7 | 2004-10-09 18:58:04 +0000 | [diff] [blame] | 40 | else |
Eric Andersen | bb05a9a | 2004-10-09 21:19:47 +0000 | [diff] [blame] | 41 | TAR_OPTIONS=-xf |
Mike Frysinger | 1f41bb7 | 2004-10-09 18:58:04 +0000 | [diff] [blame] | 42 | endif |
| 43 | |
Eric Andersen | 2d523c2 | 2004-10-09 01:06:03 +0000 | [diff] [blame] | 44 | ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y) |
Eric Andersen | ffde94b | 2001-12-22 00:56:11 +0000 | [diff] [blame] | 45 | |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 46 | ############################################################# |
| 47 | # |
Eric Andersen | 2d523c2 | 2004-10-09 01:06:03 +0000 | [diff] [blame] | 48 | # The list of stuff to build for the target toolchain |
| 49 | # along with the packages to build for the target. |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 50 | # |
Eric Andersen | 2d523c2 | 2004-10-09 01:06:03 +0000 | [diff] [blame] | 51 | ############################################################## |
Manuel Novoa III | 56239e4 | 2004-10-15 08:26:30 +0000 | [diff] [blame] | 52 | TARGETS:=host-sed kernel-headers uclibc-configured binutils gcc uclibc-target-utils |
Eric Andersen | 2d523c2 | 2004-10-09 01:06:03 +0000 | [diff] [blame] | 53 | include toolchain/Makefile.in |
Eric Andersen | 2d523c2 | 2004-10-09 01:06:03 +0000 | [diff] [blame] | 54 | include package/Makefile.in |
Eric Andersen | 27bc59d | 2003-01-17 04:31:36 +0000 | [diff] [blame] | 55 | |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 56 | ############################################################# |
| 57 | # |
Eric Andersen | ef407d3 | 2004-01-29 23:21:00 +0000 | [diff] [blame] | 58 | # You should probably leave this stuff alone unless you know |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 59 | # what you are doing. |
| 60 | # |
| 61 | ############################################################# |
Manuel Novoa III | d632d42 | 2003-11-01 05:34:41 +0000 | [diff] [blame] | 62 | |
Eric Andersen | cb7d5b8 | 2003-09-14 11:38:35 +0000 | [diff] [blame] | 63 | |
Eric Andersen | ffde94b | 2001-12-22 00:56:11 +0000 | [diff] [blame] | 64 | |
| 65 | all: world |
| 66 | |
Eric Andersen | 2d523c2 | 2004-10-09 01:06:03 +0000 | [diff] [blame] | 67 | # In this section, we need .config |
| 68 | include .config.cmd |
| 69 | |
Eric Andersen | d06645d | 2005-02-10 03:06:39 +0000 | [diff] [blame] | 70 | # We also need the various per-package makefiles, which also add |
| 71 | # each selected package to TARGETS if that package was selected |
| 72 | # in the .config file. |
| 73 | include toolchain/*/*.mk |
| 74 | include package/*/*.mk |
| 75 | include target/*/*.mk |
| 76 | |
Eric Andersen | 79f5f1e | 2005-02-17 03:00:29 +0000 | [diff] [blame^] | 77 | # target stuff is last so it can override anything else |
| 78 | include target/Makefile.in |
| 79 | |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 80 | TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS)) |
Eric Andersen | a5c2354 | 2003-02-19 08:56:04 +0000 | [diff] [blame] | 81 | TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS)) |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 82 | TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS)) |
Eric Andersen | ffde94b | 2001-12-22 00:56:11 +0000 | [diff] [blame] | 83 | |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 84 | world: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) $(TARGETS) |
Eric Andersen | ffde94b | 2001-12-22 00:56:11 +0000 | [diff] [blame] | 85 | |
Eric Andersen | a5c2354 | 2003-02-19 08:56:04 +0000 | [diff] [blame] | 86 | .PHONY: all world clean dirclean distclean source $(TARGETS) \ |
Eric Andersen | 747b16d | 2004-12-11 10:33:19 +0000 | [diff] [blame] | 87 | $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \ |
| 88 | $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR) |
Jon Nelson | c79e998 | 2002-01-05 20:26:15 +0000 | [diff] [blame] | 89 | |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 90 | ############################################################# |
| 91 | # |
Eric Andersen | ef407d3 | 2004-01-29 23:21:00 +0000 | [diff] [blame] | 92 | # staging and target directories do NOT list these as |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 93 | # dependancies anywhere else |
| 94 | # |
| 95 | ############################################################# |
| 96 | $(DL_DIR): |
Eric Andersen | bf38723 | 2004-12-11 10:35:18 +0000 | [diff] [blame] | 97 | @mkdir -p $(DL_DIR) |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 98 | |
| 99 | $(BUILD_DIR): |
Eric Andersen | bf38723 | 2004-12-11 10:35:18 +0000 | [diff] [blame] | 100 | @mkdir -p $(BUILD_DIR) |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 101 | |
Manuel Novoa III | 3ad3d8a | 2004-09-03 00:49:43 +0000 | [diff] [blame] | 102 | $(TOOL_BUILD_DIR): |
Eric Andersen | bf38723 | 2004-12-11 10:35:18 +0000 | [diff] [blame] | 103 | @mkdir -p $(TOOL_BUILD_DIR) |
Manuel Novoa III | 3ad3d8a | 2004-09-03 00:49:43 +0000 | [diff] [blame] | 104 | |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 105 | $(STAGING_DIR): |
Eric Andersen | bf38723 | 2004-12-11 10:35:18 +0000 | [diff] [blame] | 106 | @mkdir -p $(STAGING_DIR)/lib |
| 107 | @mkdir -p $(STAGING_DIR)/include |
| 108 | @mkdir -p $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME) |
| 109 | @ln -sf ../lib $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 110 | |
| 111 | $(TARGET_DIR): |
Eric Andersen | 3f28417 | 2004-10-09 05:28:18 +0000 | [diff] [blame] | 112 | zcat target/default/skel.tar.gz | tar -C $(BUILD_DIR) -xf - |
| 113 | cp -a target/default/target_skeleton/* $(TARGET_DIR)/ |
Eric Andersen | 1a35a66 | 2005-02-11 20:52:06 +0000 | [diff] [blame] | 114 | -find $(TARGET_DIR) -type d -name .svn -exec rm -rf {} \; > /dev/null 2>&1 |
Eric Andersen | ffde94b | 2001-12-22 00:56:11 +0000 | [diff] [blame] | 115 | |
Eric Andersen | a5c2354 | 2003-02-19 08:56:04 +0000 | [diff] [blame] | 116 | source: $(TARGETS_SOURCE) |
Eric Andersen | ffde94b | 2001-12-22 00:56:11 +0000 | [diff] [blame] | 117 | |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 118 | ############################################################# |
| 119 | # |
| 120 | # Cleanup and misc junk |
| 121 | # |
| 122 | ############################################################# |
| 123 | clean: $(TARGETS_CLEAN) |
Manuel Novoa III | 3ad3d8a | 2004-09-03 00:49:43 +0000 | [diff] [blame] | 124 | rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE) |
Eric Andersen | ffde94b | 2001-12-22 00:56:11 +0000 | [diff] [blame] | 125 | |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 126 | dirclean: $(TARGETS_DIRCLEAN) |
Manuel Novoa III | 3ad3d8a | 2004-09-03 00:49:43 +0000 | [diff] [blame] | 127 | rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE) |
Eric Andersen | ffde94b | 2001-12-22 00:56:11 +0000 | [diff] [blame] | 128 | |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 129 | distclean: |
| 130 | rm -rf $(DL_DIR) $(BUILD_DIR) $(LINUX_KERNEL) $(IMAGE) |
Eric Andersen | ffde94b | 2001-12-22 00:56:11 +0000 | [diff] [blame] | 131 | |
Manuel Novoa III | 3ad3d8a | 2004-09-03 00:49:43 +0000 | [diff] [blame] | 132 | sourceball: |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 133 | rm -rf $(BUILD_DIR) |
| 134 | set -e; \ |
| 135 | cd ..; \ |
| 136 | rm -f buildroot.tar.bz2; \ |
| 137 | tar -cvf buildroot.tar buildroot; \ |
| 138 | bzip2 -9 buildroot.tar; \ |
Eric Andersen | 2d523c2 | 2004-10-09 01:06:03 +0000 | [diff] [blame] | 139 | |
| 140 | |
| 141 | else # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y) |
| 142 | |
| 143 | all: menuconfig |
| 144 | |
| 145 | # configuration |
| 146 | # --------------------------------------------------------------------------- |
| 147 | |
| 148 | $(CONFIG)/conf: |
| 149 | $(MAKE) -C $(CONFIG) conf |
| 150 | -@if [ ! -f .config ] ; then \ |
| 151 | cp $(CONFIG_DEFCONFIG) .config; \ |
| 152 | fi |
| 153 | $(CONFIG)/mconf: |
| 154 | $(MAKE) -C $(CONFIG) ncurses conf mconf |
| 155 | -@if [ ! -f .config ] ; then \ |
| 156 | cp $(CONFIG_DEFCONFIG) .config; \ |
| 157 | fi |
| 158 | |
| 159 | menuconfig: $(CONFIG)/mconf |
| 160 | @$(CONFIG)/mconf $(CONFIG_CONFIG_IN) |
| 161 | |
| 162 | config: $(CONFIG)/conf |
| 163 | @$(CONFIG)/conf $(CONFIG_CONFIG_IN) |
| 164 | |
| 165 | oldconfig: $(CONFIG)/conf |
| 166 | @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN) |
| 167 | |
| 168 | randconfig: $(CONFIG)/conf |
| 169 | @$(CONFIG)/conf -r $(CONFIG_CONFIG_IN) |
| 170 | |
| 171 | allyesconfig: $(CONFIG)/conf |
| 172 | #@$(CONFIG)/conf -y $(CONFIG_CONFIG_IN) |
| 173 | #sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config |
| 174 | @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN) |
| 175 | |
| 176 | allnoconfig: $(CONFIG)/conf |
| 177 | @$(CONFIG)/conf -n $(CONFIG_CONFIG_IN) |
| 178 | |
| 179 | defconfig: $(CONFIG)/conf |
| 180 | @$(CONFIG)/conf -d $(CONFIG_CONFIG_IN) |
| 181 | |
| 182 | ############################################################# |
| 183 | # |
| 184 | # Cleanup and misc junk |
| 185 | # |
| 186 | ############################################################# |
| 187 | clean: |
| 188 | rm -f .config .config.old .config.cmd .tmpconfig.h |
| 189 | - $(MAKE) -C $(CONFIG) clean |
| 190 | |
| 191 | distclean: clean |
| 192 | rm -rf sources/* |
| 193 | |
| 194 | endif # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y) |
| 195 | |
| 196 | .PHONY: dummy subdirs release distclean clean config oldconfig \ |
| 197 | menuconfig tags check test depend |
| 198 | |
| 199 | |