81ecc43f8aa248fca2551734ec8ffc1e1d41f1db
[openwrt.git] / Makefile
1 # Makefile for buildroot2
2 #
3 # Copyright (C) 1999-2004 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 = package/config
28
29 noconfig_targets := menuconfig config oldconfig randconfig \
30 defconfig allyesconfig allnoconfig release tags
31
32 # Pull in the user's configuration file
33 ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
34 -include $(TOPDIR).config
35 endif
36
37 ifeq ($(BR2_TAR_VERBOSITY),y)
38 TAR_OPTIONS=-xvf
39 else
40 TAR_OPTIONS=-xf
41 endif
42
43 ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
44
45 #############################################################
46 #
47 # The list of stuff to build for the target toolchain
48 # along with the packages to build for the target.
49 #
50 ##############################################################
51 TARGETS:=host-sed linux-headers uclibc-configured binutils gcc uclibc-target-utils
52 include toolchain/Makefile.in
53 include toolchain/*/Makefile.in
54 include package/Makefile.in
55 include package/*/Makefile.in
56 include target/Makefile.in
57 include target/*/Makefile.in
58
59 #############################################################
60 #
61 # You should probably leave this stuff alone unless you know
62 # what you are doing.
63 #
64 #############################################################
65
66
67
68 all: world
69
70 # In this section, we need .config
71 include .config.cmd
72
73 TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
74 TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS))
75
76 world: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) $(TARGETS)
77
78 .PHONY: all world clean distclean source $(TARGETS) \
79 $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \
80 $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR)
81
82 include toolchain/*/*.mk
83 include package/*/*.mk
84 include target/*/*.mk
85
86 #############################################################
87 #
88 # staging and target directories do NOT list these as
89 # dependancies anywhere else
90 #
91 #############################################################
92 $(DL_DIR):
93 @mkdir -p $(DL_DIR)
94
95 $(BUILD_DIR):
96 @mkdir -p $(BUILD_DIR)
97
98 $(TOOL_BUILD_DIR):
99 @mkdir -p $(TOOL_BUILD_DIR)
100
101 $(STAGING_DIR):
102 @mkdir -p $(STAGING_DIR)/lib
103 @mkdir -p $(STAGING_DIR)/include
104 @mkdir -p $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)
105 @ln -sf ../lib $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib
106
107 $(TARGET_DIR):
108 @mkdir -p $(TARGET_DIR)
109 cp -a target/default/target_skeleton/* $(TARGET_DIR)/
110 mkdir $(TARGET_DIR)/{proc,dev,jffs,tmp,usr/sbin}
111 chmod 1777 $(TARGET_DIR)/tmp
112 -find $(TARGET_DIR) -type d -name CVS -exec rm -rf {} \; > /dev/null 2>&1
113
114 source: $(TARGETS_SOURCE)
115
116 #############################################################
117 #
118 # Cleanup and misc junk
119 #
120 #############################################################
121 clean:
122 rm -rf $(BUILD_DIR) $(IMAGE).*
123 @$(MAKE) -C $(CONFIG) clean
124
125 distclean: clean
126 rm -rf $(DL_DIR) $(TOOL_BUILD_DIR) .config
127
128 sourceball:
129 rm -rf $(BUILD_DIR)
130 set -e; \
131 cd ..; \
132 rm -f buildroot.tar.bz2; \
133 tar -cvf buildroot.tar buildroot; \
134 bzip2 -9 buildroot.tar; \
135
136
137 else # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
138
139 all: menuconfig
140
141 # configuration
142 # ---------------------------------------------------------------------------
143
144 $(CONFIG)/conf:
145 $(MAKE) -C $(CONFIG) conf
146 -@if [ ! -f .config ] ; then \
147 cp $(CONFIG_DEFCONFIG) .config; \
148 fi
149 $(CONFIG)/mconf:
150 $(MAKE) -C $(CONFIG) ncurses conf mconf
151 -@if [ ! -f .config ] ; then \
152 cp $(CONFIG_DEFCONFIG) .config; \
153 fi
154
155 menuconfig: $(CONFIG)/mconf
156 @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
157
158 config: $(CONFIG)/conf
159 @$(CONFIG)/conf $(CONFIG_CONFIG_IN)
160
161 oldconfig: $(CONFIG)/conf
162 @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
163
164 randconfig: $(CONFIG)/conf
165 @$(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
166
167 allyesconfig: $(CONFIG)/conf
168 #@$(CONFIG)/conf -y $(CONFIG_CONFIG_IN)
169 #sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config
170 @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
171
172 allnoconfig: $(CONFIG)/conf
173 @$(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
174
175 defconfig: $(CONFIG)/conf
176 @$(CONFIG)/conf -d $(CONFIG_CONFIG_IN)
177
178 #############################################################
179 #
180 # Cleanup and misc junk
181 #
182 #############################################################
183 clean:
184 @$(MAKE) -C $(CONFIG) clean
185
186 distclean: clean
187
188 endif # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
189
190 .PHONY: dummy subdirs release distclean clean config oldconfig \
191 menuconfig tags check test depend
192
193
This page took 0.043546 seconds and 3 git commands to generate.