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 \ |
"Steven J. Hill" | 0c1e709 | 2006-06-22 02:24:08 +0000 | [diff] [blame] | 30 | defconfig allyesconfig allnoconfig release tags \ |
Bernhard Reutner-Fischer | 9e25035 | 2006-12-02 19:01:10 +0000 | [diff] [blame] | 31 | |
| 32 | # $(shell find . -name *_defconfig |sed 's/.*\///') |
Eric Andersen | 2d523c2 | 2004-10-09 01:06:03 +0000 | [diff] [blame] | 33 | |
| 34 | # Pull in the user's configuration file |
| 35 | ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) |
| 36 | -include $(TOPDIR).config |
| 37 | endif |
| 38 | |
| 39 | ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y) |
Eric Andersen | ffde94b | 2001-12-22 00:56:11 +0000 | [diff] [blame] | 40 | |
Bernhard Reutner-Fischer | 99cf729 | 2007-02-12 13:38:06 +0000 | [diff] [blame] | 41 | # cc-option |
| 42 | # Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586) |
| 43 | # sets -march=winchip-c6 if supported else falls back to -march=i586 |
| 44 | # without checking the latter. |
| 45 | cc-option = $(shell if $(TARGET_CC) $(TARGET_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ |
| 46 | > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) |
| 47 | |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 48 | ############################################################# |
| 49 | # |
Eric Andersen | 2d523c2 | 2004-10-09 01:06:03 +0000 | [diff] [blame] | 50 | # The list of stuff to build for the target toolchain |
| 51 | # along with the packages to build for the target. |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 52 | # |
Eric Andersen | 2d523c2 | 2004-10-09 01:06:03 +0000 | [diff] [blame] | 53 | ############################################################## |
"Steven J. Hill" | 02f71aa | 2007-02-06 18:19:38 +0000 | [diff] [blame] | 54 | ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y) |
Eric Andersen | 98bc6da | 2006-07-18 23:43:58 +0000 | [diff] [blame] | 55 | TARGETS:=uclibc-configured binutils gcc uclibc-target-utils |
"Steven J. Hill" | 02f71aa | 2007-02-06 18:19:38 +0000 | [diff] [blame] | 56 | else |
| 57 | TARGETS:=uclibc |
| 58 | endif |
Eric Andersen | 2d523c2 | 2004-10-09 01:06:03 +0000 | [diff] [blame] | 59 | include toolchain/Makefile.in |
Eric Andersen | 2d523c2 | 2004-10-09 01:06:03 +0000 | [diff] [blame] | 60 | include package/Makefile.in |
Eric Andersen | 27bc59d | 2003-01-17 04:31:36 +0000 | [diff] [blame] | 61 | |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 62 | ############################################################# |
| 63 | # |
Eric Andersen | ef407d3 | 2004-01-29 23:21:00 +0000 | [diff] [blame] | 64 | # You should probably leave this stuff alone unless you know |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 65 | # what you are doing. |
| 66 | # |
| 67 | ############################################################# |
Manuel Novoa III | d632d42 | 2003-11-01 05:34:41 +0000 | [diff] [blame] | 68 | |
Eric Andersen | cb7d5b8 | 2003-09-14 11:38:35 +0000 | [diff] [blame] | 69 | |
Eric Andersen | ffde94b | 2001-12-22 00:56:11 +0000 | [diff] [blame] | 70 | |
| 71 | all: world |
| 72 | |
Eric Andersen | 2d523c2 | 2004-10-09 01:06:03 +0000 | [diff] [blame] | 73 | # In this section, we need .config |
| 74 | include .config.cmd |
| 75 | |
Eric Andersen | d06645d | 2005-02-10 03:06:39 +0000 | [diff] [blame] | 76 | # We also need the various per-package makefiles, which also add |
| 77 | # each selected package to TARGETS if that package was selected |
| 78 | # in the .config file. |
| 79 | include toolchain/*/*.mk |
| 80 | include package/*/*.mk |
Eric Andersen | d06645d | 2005-02-10 03:06:39 +0000 | [diff] [blame] | 81 | |
Eric Andersen | 79f5f1e | 2005-02-17 03:00:29 +0000 | [diff] [blame] | 82 | # target stuff is last so it can override anything else |
| 83 | include target/Makefile.in |
| 84 | |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 85 | TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS)) |
Eric Andersen | a5c2354 | 2003-02-19 08:56:04 +0000 | [diff] [blame] | 86 | TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS)) |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 87 | TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS)) |
Eric Andersen | ffde94b | 2001-12-22 00:56:11 +0000 | [diff] [blame] | 88 | |
Bernhard Reutner-Fischer | 6e2823c | 2006-11-17 15:43:51 +0000 | [diff] [blame] | 89 | world: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) $(TARGETS) |
Bernhard Reutner-Fischer | 870cb9e | 2006-11-17 11:21:23 +0000 | [diff] [blame] | 90 | dirs: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) |
Eric Andersen | ffde94b | 2001-12-22 00:56:11 +0000 | [diff] [blame] | 91 | |
Bernhard Reutner-Fischer | 870cb9e | 2006-11-17 11:21:23 +0000 | [diff] [blame] | 92 | .PHONY: all world dirs clean dirclean distclean source $(TARGETS) \ |
Eric Andersen | 747b16d | 2004-12-11 10:33:19 +0000 | [diff] [blame] | 93 | $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \ |
| 94 | $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR) |
Jon Nelson | c79e998 | 2002-01-05 20:26:15 +0000 | [diff] [blame] | 95 | |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 96 | ############################################################# |
| 97 | # |
Eric Andersen | ef407d3 | 2004-01-29 23:21:00 +0000 | [diff] [blame] | 98 | # staging and target directories do NOT list these as |
Mike Frysinger | d99c31c | 2006-05-26 01:18:09 +0000 | [diff] [blame] | 99 | # dependencies anywhere else |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 100 | # |
| 101 | ############################################################# |
Bernhard Reutner-Fischer | 8d583fc | 2007-01-30 00:58:18 +0000 | [diff] [blame] | 102 | $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR): |
| 103 | @mkdir -p $@ |
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): |
"Steven J. Hill" | 9c865d7 | 2007-05-07 03:56:47 +0000 | [diff] [blame^] | 106 | @mkdir -p $(STAGING_DIR)/bin |
Eric Andersen | bf38723 | 2004-12-11 10:35:18 +0000 | [diff] [blame] | 107 | @mkdir -p $(STAGING_DIR)/lib |
| 108 | @mkdir -p $(STAGING_DIR)/include |
Eric Andersen | 3da708e | 2007-01-10 06:55:27 +0000 | [diff] [blame] | 109 | @mkdir -p $(STAGING_DIR)/usr |
Eric Andersen | bf38723 | 2004-12-11 10:35:18 +0000 | [diff] [blame] | 110 | @mkdir -p $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME) |
"Steven J. Hill" | 4b2ebdb | 2007-04-28 17:09:44 +0000 | [diff] [blame] | 111 | @ln -snf ../include $(STAGING_DIR)/usr/include |
Eric Andersen | 3da708e | 2007-01-10 06:55:27 +0000 | [diff] [blame] | 112 | @ln -snf ../lib $(STAGING_DIR)/usr/lib |
Eric Andersen | 74ad4e1 | 2005-04-15 02:19:11 +0000 | [diff] [blame] | 113 | @ln -snf ../lib $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 114 | |
| 115 | $(TARGET_DIR): |
Eric Andersen | a4c685f | 2006-11-15 21:00:07 +0000 | [diff] [blame] | 116 | mkdir -p $(TARGET_DIR) |
Eric Andersen | ba70f94 | 2006-11-15 06:52:00 +0000 | [diff] [blame] | 117 | if [ -d "$(TARGET_SKELETON)" ] ; then \ |
| 118 | cp -fa $(TARGET_SKELETON)/* $(TARGET_DIR)/; \ |
Eric Andersen | bb15c22 | 2005-02-17 18:21:20 +0000 | [diff] [blame] | 119 | fi; |
Eric Andersen | 5418a92 | 2006-04-07 22:42:15 +0000 | [diff] [blame] | 120 | touch $(STAGING_DIR)/.fakeroot.00000 |
Eric Andersen | bb15c22 | 2005-02-17 18:21:20 +0000 | [diff] [blame] | 121 | -find $(TARGET_DIR) -type d -name CVS | xargs rm -rf |
| 122 | -find $(TARGET_DIR) -type d -name .svn | xargs rm -rf |
Eric Andersen | ffde94b | 2001-12-22 00:56:11 +0000 | [diff] [blame] | 123 | |
Bernhard Reutner-Fischer | 73be7f9 | 2007-04-06 16:36:48 +0000 | [diff] [blame] | 124 | source: $(TARGETS_SOURCE) $(HOST_SOURCE) |
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 | ############################################################# |
| 127 | # |
| 128 | # Cleanup and misc junk |
| 129 | # |
| 130 | ############################################################# |
| 131 | clean: $(TARGETS_CLEAN) |
Manuel Novoa III | 3ad3d8a | 2004-09-03 00:49:43 +0000 | [diff] [blame] | 132 | rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE) |
Eric Andersen | ffde94b | 2001-12-22 00:56:11 +0000 | [diff] [blame] | 133 | |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 134 | dirclean: $(TARGETS_DIRCLEAN) |
Manuel Novoa III | 3ad3d8a | 2004-09-03 00:49:43 +0000 | [diff] [blame] | 135 | rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE) |
Eric Andersen | ffde94b | 2001-12-22 00:56:11 +0000 | [diff] [blame] | 136 | |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 137 | distclean: |
Mike Frysinger | 5bc1f0c | 2005-09-09 02:49:10 +0000 | [diff] [blame] | 138 | ifeq ($(DL_DIR),$(BASE_DIR)/dl) |
| 139 | rm -rf $(DL_DIR) |
| 140 | endif |
| 141 | rm -rf $(BUILD_DIR) $(LINUX_KERNEL) $(IMAGE) |
Bernhard Reutner-Fischer | b513619 | 2007-01-19 18:00:49 +0000 | [diff] [blame] | 142 | $(MAKE) -C $(CONFIG) clean |
Eric Andersen | ffde94b | 2001-12-22 00:56:11 +0000 | [diff] [blame] | 143 | |
Manuel Novoa III | 3ad3d8a | 2004-09-03 00:49:43 +0000 | [diff] [blame] | 144 | sourceball: |
Eric Andersen | 08782ae | 2002-04-26 11:45:55 +0000 | [diff] [blame] | 145 | rm -rf $(BUILD_DIR) |
| 146 | set -e; \ |
| 147 | cd ..; \ |
| 148 | rm -f buildroot.tar.bz2; \ |
| 149 | tar -cvf buildroot.tar buildroot; \ |
| 150 | bzip2 -9 buildroot.tar; \ |
Eric Andersen | 2d523c2 | 2004-10-09 01:06:03 +0000 | [diff] [blame] | 151 | |
| 152 | |
| 153 | else # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y) |
| 154 | |
| 155 | all: menuconfig |
| 156 | |
| 157 | # configuration |
| 158 | # --------------------------------------------------------------------------- |
| 159 | |
| 160 | $(CONFIG)/conf: |
| 161 | $(MAKE) -C $(CONFIG) conf |
| 162 | -@if [ ! -f .config ] ; then \ |
| 163 | cp $(CONFIG_DEFCONFIG) .config; \ |
| 164 | fi |
| 165 | $(CONFIG)/mconf: |
| 166 | $(MAKE) -C $(CONFIG) ncurses conf mconf |
| 167 | -@if [ ! -f .config ] ; then \ |
| 168 | cp $(CONFIG_DEFCONFIG) .config; \ |
| 169 | fi |
| 170 | |
| 171 | menuconfig: $(CONFIG)/mconf |
| 172 | @$(CONFIG)/mconf $(CONFIG_CONFIG_IN) |
| 173 | |
| 174 | config: $(CONFIG)/conf |
| 175 | @$(CONFIG)/conf $(CONFIG_CONFIG_IN) |
| 176 | |
| 177 | oldconfig: $(CONFIG)/conf |
| 178 | @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN) |
| 179 | |
| 180 | randconfig: $(CONFIG)/conf |
| 181 | @$(CONFIG)/conf -r $(CONFIG_CONFIG_IN) |
| 182 | |
| 183 | allyesconfig: $(CONFIG)/conf |
| 184 | #@$(CONFIG)/conf -y $(CONFIG_CONFIG_IN) |
| 185 | #sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config |
| 186 | @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN) |
| 187 | |
| 188 | allnoconfig: $(CONFIG)/conf |
| 189 | @$(CONFIG)/conf -n $(CONFIG_CONFIG_IN) |
| 190 | |
| 191 | defconfig: $(CONFIG)/conf |
| 192 | @$(CONFIG)/conf -d $(CONFIG_CONFIG_IN) |
| 193 | |
"Steven J. Hill" | 0c1e709 | 2006-06-22 02:24:08 +0000 | [diff] [blame] | 194 | %_defconfig: $(CONFIG)/conf |
| 195 | cp $(shell find . -name $@) .config |
| 196 | @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN) |
| 197 | |
Eric Andersen | 2d523c2 | 2004-10-09 01:06:03 +0000 | [diff] [blame] | 198 | ############################################################# |
| 199 | # |
| 200 | # Cleanup and misc junk |
| 201 | # |
| 202 | ############################################################# |
| 203 | clean: |
| 204 | rm -f .config .config.old .config.cmd .tmpconfig.h |
| 205 | - $(MAKE) -C $(CONFIG) clean |
| 206 | |
| 207 | distclean: clean |
| 208 | rm -rf sources/* |
| 209 | |
| 210 | endif # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y) |
| 211 | |
| 212 | .PHONY: dummy subdirs release distclean clean config oldconfig \ |
Eric Andersen | f3ccf31 | 2005-04-27 08:09:58 +0000 | [diff] [blame] | 213 | menuconfig tags check test depend defconfig |
Eric Andersen | 2d523c2 | 2004-10-09 01:06:03 +0000 | [diff] [blame] | 214 | |
| 215 | |