sstrip
[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 kernel-headers uclibc-configured binutils gcc uclibc-target-utils
52 TARGETS+=linux
53
54 include toolchain/Makefile.in
55 include package/Makefile.in
56
57 #############################################################
58 #
59 # You should probably leave this stuff alone unless you know
60 # what you are doing.
61 #
62 #############################################################
63
64
65
66 all: world
67
68 # In this section, we need .config
69 include .config.cmd
70
71 # We also need the various per-package makefiles, which also add
72 # each selected package to TARGETS if that package was selected
73 # in the .config file.
74 include toolchain/*/*.mk
75 include package/*/*.mk
76 include target/*/*.mk
77
78 # target stuff is last so it can override anything else
79 include target/Makefile.in
80
81 TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
82 TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS))
83 TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
84
85 world: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) $(TARGETS)
86
87 .PHONY: all world clean dirclean distclean source $(TARGETS) \
88 $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \
89 $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR)
90
91 #############################################################
92 #
93 # staging and target directories do NOT list these as
94 # dependancies anywhere else
95 #
96 #############################################################
97 $(DL_DIR):
98 @mkdir -p $(DL_DIR)
99
100 $(BUILD_DIR):
101 @mkdir -p $(BUILD_DIR)
102
103 $(TOOL_BUILD_DIR):
104 @mkdir -p $(TOOL_BUILD_DIR)
105
106 $(STAGING_DIR):
107 @mkdir -p $(STAGING_DIR)/lib
108 @mkdir -p $(STAGING_DIR)/include
109 @mkdir -p $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)
110 @ln -sf ../lib $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib
111
112 $(TARGET_DIR):
113 if [ -f "$(TARGET_SKELETON)" ] ; then \
114 zcat $(TARGET_SKELETON) | tar -C $(BUILD_DIR) -xf -; \
115 fi;
116 if [ -d "$(TARGET_SKEL_DIR)" ] ; then \
117 cp -a $(TARGET_SKEL_DIR)/* $(TARGET_DIR)/; \
118 fi;
119 -find $(TARGET_DIR) -type d -name CVS | xargs rm -rf
120 -find $(TARGET_DIR) -type d -name .svn | xargs rm -rf
121
122 source: $(TARGETS_SOURCE)
123
124 #############################################################
125 #
126 # Cleanup and misc junk
127 #
128 #############################################################
129 clean:
130 rm -rf $(TARGET_DIR) $(IMAGE).*
131 $(MAKE) openwrt-image-clean
132
133 dirclean: $(TARGETS_DIRCLEAN)
134 rm -rf $(TARGET_DIR) $(IMAGE).*
135 $(MAKE) openwrt-image-dirclean
136
137 distclean: clean
138 rm -rf $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR)
139 rm .config* .tmpconfig.h
140
141 sourceball:
142 rm -rf $(BUILD_DIR)
143 set -e; \
144 cd ..; \
145 rm -f buildroot.tar.bz2; \
146 tar -cvf buildroot.tar buildroot; \
147 bzip2 -9 buildroot.tar; \
148
149
150 else # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
151
152 all: menuconfig
153
154 # configuration
155 # ---------------------------------------------------------------------------
156
157 $(CONFIG)/conf:
158 $(MAKE) -C $(CONFIG) conf
159 -@if [ ! -f .config ] ; then \
160 cp $(CONFIG_DEFCONFIG) .config; \
161 fi
162 $(CONFIG)/mconf:
163 $(MAKE) -C $(CONFIG) ncurses conf mconf
164 -@if [ ! -f .config ] ; then \
165 cp $(CONFIG_DEFCONFIG) .config; \
166 fi
167
168 menuconfig: $(CONFIG)/mconf
169 @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
170
171 config: $(CONFIG)/conf
172 @$(CONFIG)/conf $(CONFIG_CONFIG_IN)
173
174 oldconfig: $(CONFIG)/conf
175 @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
176
177 randconfig: $(CONFIG)/conf
178 @$(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
179
180 allyesconfig: $(CONFIG)/conf
181 #@$(CONFIG)/conf -y $(CONFIG_CONFIG_IN)
182 #sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config
183 @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
184
185 allnoconfig: $(CONFIG)/conf
186 @$(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
187
188 defconfig: $(CONFIG)/conf
189 @$(CONFIG)/conf -d $(CONFIG_CONFIG_IN)
190
191 #############################################################
192 #
193 # Cleanup and misc junk
194 #
195 #############################################################
196 clean:
197 @$(MAKE) -C $(CONFIG) clean
198
199 distclean: clean
200
201 endif # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
202
203 .PHONY: dummy subdirs release distclean clean config oldconfig \
204 menuconfig tags check test depend
205
This page took 0.051968 seconds and 5 git commands to generate.