]>
Commit | Line | Data |
---|---|---|
2d523c23 | 1 | # Makefile for buildroot2 |
ffde94bd | 2 | # |
15b26aee | 3 | # Copyright (C) 1999-2005 by Erik Andersen <[email protected]> |
ffde94bd | 4 | # |
08782ae7 | 5 | # This program is free software; you can redistribute it and/or modify |
2d523c23 EA |
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. | |
ffde94bd | 9 | # |
2d523c23 EA |
10 | # This program is distributed in the hope that it will be useful, |
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
08782ae7 | 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2d523c23 | 13 | # General Public License for more details. |
ffde94bd | 14 | # |
2d523c23 EA |
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 | |
3ad3d8a1 | 18 | # |
02bf5816 | 19 | |
2d523c23 EA |
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 | |
a0aef7c4 | 28 | |
2d523c23 | 29 | noconfig_targets := menuconfig config oldconfig randconfig \ |
0c1e709e | 30 | defconfig allyesconfig allnoconfig release tags \ |
9e250356 BRF |
31 | |
32 | # $(shell find . -name *_defconfig |sed 's/.*\///') | |
cad58108 | 33 | |
2d523c23 EA |
34 | # Pull in the user's configuration file |
35 | ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) | |
36 | -include $(TOPDIR).config | |
37 | endif | |
9741a49e | 38 | |
2d523c23 | 39 | ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y) |
54e098e4 | 40 | |
99cf7293 BRF |
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 | ||
54e098e4 EA |
48 | ############################################################# |
49 | # | |
2d523c23 EA |
50 | # The list of stuff to build for the target toolchain |
51 | # along with the packages to build for the target. | |
54e098e4 | 52 | # |
2d523c23 | 53 | ############################################################## |
02f71aab | 54 | ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y) |
98bc6dac | 55 | TARGETS:=uclibc-configured binutils gcc uclibc-target-utils |
02f71aab SH |
56 | else |
57 | TARGETS:=uclibc | |
58 | endif | |
2d523c23 | 59 | include toolchain/Makefile.in |
2d523c23 | 60 | include package/Makefile.in |
27bc59d4 | 61 | |
08782ae7 EA |
62 | ############################################################# |
63 | # | |
ef407d3d | 64 | # You should probably leave this stuff alone unless you know |
08782ae7 EA |
65 | # what you are doing. |
66 | # | |
67 | ############################################################# | |
d632d42b | 68 | |
cb7d5b81 | 69 | |
ffde94bd | 70 | |
08782ae7 | 71 | all: world |
ffde94bd | 72 | |
2d523c23 EA |
73 | # In this section, we need .config |
74 | include .config.cmd | |
75 | ||
d06645d8 EA |
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 | |
d06645d8 | 81 | |
79f5f1e8 EA |
82 | # target stuff is last so it can override anything else |
83 | include target/Makefile.in | |
84 | ||
08782ae7 | 85 | TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS)) |
a5c23541 | 86 | TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS)) |
08782ae7 | 87 | TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS)) |
ffde94bd | 88 | |
6e2823c1 | 89 | world: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) $(TARGETS) |
870cb9e8 | 90 | dirs: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) |
ffde94bd | 91 | |
870cb9e8 | 92 | .PHONY: all world dirs clean dirclean distclean source $(TARGETS) \ |
747b16dd EA |
93 | $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \ |
94 | $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR) | |
ffde94bd | 95 | |
08782ae7 EA |
96 | ############################################################# |
97 | # | |
ef407d3d | 98 | # staging and target directories do NOT list these as |
d99c31c6 | 99 | # dependencies anywhere else |
08782ae7 EA |
100 | # |
101 | ############################################################# | |
8d583fc0 BRF |
102 | $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR): |
103 | @mkdir -p $@ | |
3ad3d8a1 | 104 | |
08782ae7 | 105 | $(STAGING_DIR): |
bf38723f EA |
106 | @mkdir -p $(STAGING_DIR)/lib |
107 | @mkdir -p $(STAGING_DIR)/include | |
3da708e4 | 108 | @mkdir -p $(STAGING_DIR)/usr |
bf38723f | 109 | @mkdir -p $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME) |
3da708e4 | 110 | @ln -snf ../lib $(STAGING_DIR)/usr/lib |
74ad4e12 | 111 | @ln -snf ../lib $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib |
ffde94bd | 112 | |
08782ae7 | 113 | $(TARGET_DIR): |
a4c685f1 | 114 | mkdir -p $(TARGET_DIR) |
ba70f94e EA |
115 | if [ -d "$(TARGET_SKELETON)" ] ; then \ |
116 | cp -fa $(TARGET_SKELETON)/* $(TARGET_DIR)/; \ | |
bb15c221 | 117 | fi; |
5418a923 | 118 | touch $(STAGING_DIR)/.fakeroot.00000 |
bb15c221 EA |
119 | -find $(TARGET_DIR) -type d -name CVS | xargs rm -rf |
120 | -find $(TARGET_DIR) -type d -name .svn | xargs rm -rf | |
08782ae7 | 121 | |
a5c23541 | 122 | source: $(TARGETS_SOURCE) |
08782ae7 EA |
123 | |
124 | ############################################################# | |
125 | # | |
126 | # Cleanup and misc junk | |
127 | # | |
128 | ############################################################# | |
129 | clean: $(TARGETS_CLEAN) | |
3ad3d8a1 | 130 | rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE) |
08782ae7 EA |
131 | |
132 | dirclean: $(TARGETS_DIRCLEAN) | |
3ad3d8a1 | 133 | rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE) |
08782ae7 EA |
134 | |
135 | distclean: | |
5bc1f0c3 MF |
136 | ifeq ($(DL_DIR),$(BASE_DIR)/dl) |
137 | rm -rf $(DL_DIR) | |
138 | endif | |
139 | rm -rf $(BUILD_DIR) $(LINUX_KERNEL) $(IMAGE) | |
b5136193 | 140 | $(MAKE) -C $(CONFIG) clean |
08782ae7 | 141 | |
3ad3d8a1 | 142 | sourceball: |
08782ae7 EA |
143 | rm -rf $(BUILD_DIR) |
144 | set -e; \ | |
145 | cd ..; \ | |
146 | rm -f buildroot.tar.bz2; \ | |
147 | tar -cvf buildroot.tar buildroot; \ | |
148 | bzip2 -9 buildroot.tar; \ | |
2d523c23 EA |
149 | |
150 | ||
151 | else # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y) | |
152 | ||
153 | all: menuconfig | |
154 | ||
155 | # configuration | |
156 | # --------------------------------------------------------------------------- | |
157 | ||
158 | $(CONFIG)/conf: | |
159 | $(MAKE) -C $(CONFIG) conf | |
160 | -@if [ ! -f .config ] ; then \ | |
161 | cp $(CONFIG_DEFCONFIG) .config; \ | |
162 | fi | |
163 | $(CONFIG)/mconf: | |
164 | $(MAKE) -C $(CONFIG) ncurses conf mconf | |
165 | -@if [ ! -f .config ] ; then \ | |
166 | cp $(CONFIG_DEFCONFIG) .config; \ | |
167 | fi | |
168 | ||
169 | menuconfig: $(CONFIG)/mconf | |
170 | @$(CONFIG)/mconf $(CONFIG_CONFIG_IN) | |
171 | ||
172 | config: $(CONFIG)/conf | |
173 | @$(CONFIG)/conf $(CONFIG_CONFIG_IN) | |
174 | ||
175 | oldconfig: $(CONFIG)/conf | |
176 | @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN) | |
177 | ||
178 | randconfig: $(CONFIG)/conf | |
179 | @$(CONFIG)/conf -r $(CONFIG_CONFIG_IN) | |
180 | ||
181 | allyesconfig: $(CONFIG)/conf | |
182 | #@$(CONFIG)/conf -y $(CONFIG_CONFIG_IN) | |
183 | #sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config | |
184 | @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN) | |
185 | ||
186 | allnoconfig: $(CONFIG)/conf | |
187 | @$(CONFIG)/conf -n $(CONFIG_CONFIG_IN) | |
188 | ||
189 | defconfig: $(CONFIG)/conf | |
190 | @$(CONFIG)/conf -d $(CONFIG_CONFIG_IN) | |
191 | ||
0c1e709e SH |
192 | %_defconfig: $(CONFIG)/conf |
193 | cp $(shell find . -name $@) .config | |
194 | @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN) | |
195 | ||
2d523c23 EA |
196 | ############################################################# |
197 | # | |
198 | # Cleanup and misc junk | |
199 | # | |
200 | ############################################################# | |
201 | clean: | |
202 | rm -f .config .config.old .config.cmd .tmpconfig.h | |
203 | - $(MAKE) -C $(CONFIG) clean | |
204 | ||
205 | distclean: clean | |
206 | rm -rf sources/* | |
207 | ||
208 | endif # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y) | |
209 | ||
210 | .PHONY: dummy subdirs release distclean clean config oldconfig \ | |
f3ccf319 | 211 | menuconfig tags check test depend defconfig |
2d523c23 EA |
212 | |
213 |