| 1 | |
|---|
| 2 | # Makefile for floppyfw. |
|---|
| 3 | # As you can see, this is based on the buildroot/busybox/uClibc Make system. |
|---|
| 4 | # |
|---|
| 5 | # Changes are Copyright (C) 2003-2004 Thomas Lundquist <thomasez@zelow.no> |
|---|
| 6 | # |
|---|
| 7 | |
|---|
| 8 | # Makefile for a simple busybox/uClibc root filesystem |
|---|
| 9 | # |
|---|
| 10 | # Copyright (C) 2001-2003 Erik Andersen <andersen@codepoet.org> |
|---|
| 11 | # Copyright (C) 2002 by Tim Riker <Tim@Rikers.org> |
|---|
| 12 | # |
|---|
| 13 | # This program is free software; you can redistribute it and/or modify |
|---|
| 14 | # it under the terms of the GNU Library General Public License as |
|---|
| 15 | # published by the Free Software Foundation; either version 2 of the |
|---|
| 16 | # License, or (at your option) any later version. |
|---|
| 17 | # |
|---|
| 18 | # This program is distributed in the hope that it will be useful, but |
|---|
| 19 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 21 | # Library General Public License for more details. |
|---|
| 22 | # |
|---|
| 23 | # You should have received a copy of the GNU Library General Public |
|---|
| 24 | # License along with this program; if not, write to the Free Software |
|---|
| 25 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
|---|
| 26 | # USA |
|---|
| 27 | |
|---|
| 28 | # $Id: Makefile,v 1.31 2005/12/07 19:50:42 thomasez Exp $ |
|---|
| 29 | |
|---|
| 30 | ############################################################# |
|---|
| 31 | # |
|---|
| 32 | # EDIT this stuff to suit your system and preferences |
|---|
| 33 | # |
|---|
| 34 | # Use := when possible to get precomputation, thereby |
|---|
| 35 | # speeding up the build process. |
|---|
| 36 | # |
|---|
| 37 | ############################################################# |
|---|
| 38 | |
|---|
| 39 | # Which version of floppyfw is this? |
|---|
| 40 | FLOPPYFW_VERSION=3.0rc1 |
|---|
| 41 | |
|---|
| 42 | # What sortof target system shall we compile this for? |
|---|
| 43 | ARCH:=i386 |
|---|
| 44 | #ARCH:=arm |
|---|
| 45 | #ARCH:=mips |
|---|
| 46 | #ARCH:=mipsel |
|---|
| 47 | #ARCH:=powerpc |
|---|
| 48 | #ARCH:=sh4 |
|---|
| 49 | #ARCH:=cris |
|---|
| 50 | #ARCH:=m68k |
|---|
| 51 | #ARCH:=v850 |
|---|
| 52 | #ARCH:=sparc |
|---|
| 53 | #ARCH:=sh64 |
|---|
| 54 | #ARCH:=whatever |
|---|
| 55 | |
|---|
| 56 | # If you want to add FPU/MATH emulation, set this to true; |
|---|
| 57 | # (Not implemented yet.) |
|---|
| 58 | EMULATE_FPU=false |
|---|
| 59 | |
|---|
| 60 | # Command used to download source code |
|---|
| 61 | WGET:=wget --passive-ftp |
|---|
| 62 | |
|---|
| 63 | # Optimize toolchain for which type of CPU? |
|---|
| 64 | # WARNING!!! CURRENTLY BROKEN!!! LEAVE IT AS $(ARCH)!!! |
|---|
| 65 | OPTIMIZE_FOR_CPU=$(ARCH) |
|---|
| 66 | # WARNING!!! CURRENTLY BROKEN!!! LEAVE IT AS $(ARCH)!!! |
|---|
| 67 | #OPTIMIZE_FOR_CPU=i486 |
|---|
| 68 | #OPTIMIZE_FOR_CPU=strongarm |
|---|
| 69 | #OPTIMIZE_FOR_CPU=whatever |
|---|
| 70 | |
|---|
| 71 | TARGET_OPTIMIZATION=-Os |
|---|
| 72 | TARGET_DEBUGGING= #-g |
|---|
| 73 | |
|---|
| 74 | # Any additional gcc options you may want to include.... |
|---|
| 75 | EXTRA_GCC_CONFIG_OPTIONS= |
|---|
| 76 | |
|---|
| 77 | # For SMP machines some stuff can be run in parallel |
|---|
| 78 | # This one sets j<amount of CPUs> but it may be just as good or even better |
|---|
| 79 | # with amount +1 |
|---|
| 80 | JLEVEL=-j$(shell expr $(shell grep -i -c '^processor[[:space:]]*:[[:space:]]*[0-9]\+' /proc/cpuinfo) \+ 1) |
|---|
| 81 | # Or if running distcc: |
|---|
| 82 | # JLEVEL=-j3 |
|---|
| 83 | |
|---|
| 84 | # Sourceforge-mirror: |
|---|
| 85 | SF_HOST=superb-east |
|---|
| 86 | SF_MIRROR=http://$(SF_HOST).dl.sourceforge.net |
|---|
| 87 | |
|---|
| 88 | # NICs you want in the nics.ffw module package separated by a space. |
|---|
| 89 | NICS=3c509 3c59x 8139cp 8139too pcnet32 r8169 e100 e1000 ne ne2k-pci forcedeth |
|---|
| 90 | |
|---|
| 91 | ############################################################# |
|---|
| 92 | # |
|---|
| 93 | # The list of stuff to build for the target filesystem |
|---|
| 94 | # |
|---|
| 95 | ############################################################# |
|---|
| 96 | |
|---|
| 97 | TARGETS+=uclibc |
|---|
| 98 | |
|---|
| 99 | # Probably a good thing even if you choose not to patch anything. |
|---|
| 100 | # This target only unpacks. The linux target does the patching. |
|---|
| 101 | TARGETS+=patch-o-matic |
|---|
| 102 | |
|---|
| 103 | # POM-patches to add: |
|---|
| 104 | # I could have used base but some of the patches has a problem. |
|---|
| 105 | # It's alot here, probably not so smart, cut back later. |
|---|
| 106 | POM_PATCHES=h323-conntrack-nat quake3-conntrack-nat connlimit dstlimit mport pptp-conntrack-nat directx8-conntrack-nat time cuseeme-nat rtsp-conntrack iprange random ipp2p mms-conntrack-nat connrate msnp-conntrack-nat nth sip-conntrack-nat set expire psd time TARPIT |
|---|
| 107 | |
|---|
| 108 | # After switching to a newer p-o-m; |
|---|
| 109 | # |
|---|
| 110 | # Did not apply cleanly: dropped-table tproxy |
|---|
| 111 | # |
|---|
| 112 | # Did not compile cleanly: |
|---|
| 113 | # policy: (ipt_policy.c:15:22: net/xfrm.h: No such file or directory) |
|---|
| 114 | # |
|---|
| 115 | # osf: (extensions/libipt_osf.c: In function `help': |
|---|
| 116 | # extensions/libipt_osf.c:46: warning: too many arguments for format |
|---|
| 117 | # extensions/libipt_osf.c: In function `parse': |
|---|
| 118 | # extensions/libipt_osf.c:107: error: `IPT_OSF_CONNECTOR' undeclared (first use in this function) |
|---|
| 119 | # extensions/libipt_osf.c:107: error: (Each undeclared identifier is reported only once |
|---|
| 120 | # ) |
|---|
| 121 | # |
|---|
| 122 | # Missing: string |
|---|
| 123 | |
|---|
| 124 | TARGETS+=linux |
|---|
| 125 | |
|---|
| 126 | TARGETS+=busybox |
|---|
| 127 | USE_BUSYBOX_SNAPSHOT=false |
|---|
| 128 | |
|---|
| 129 | TARGETS+=iptables |
|---|
| 130 | |
|---|
| 131 | TARGETS+=ipset |
|---|
| 132 | |
|---|
| 133 | TARGETS+=iproute2 |
|---|
| 134 | |
|---|
| 135 | TARGETS+=dnsmasq |
|---|
| 136 | |
|---|
| 137 | TARGETS+=bridgeutils |
|---|
| 138 | |
|---|
| 139 | # TARGETS+=modutils |
|---|
| 140 | |
|---|
| 141 | TARGETS+=pppd |
|---|
| 142 | |
|---|
| 143 | TARGETS+=pppoe |
|---|
| 144 | |
|---|
| 145 | TARGETS+=pcmcia |
|---|
| 146 | |
|---|
| 147 | TARGETS+=wireless-tools |
|---|
| 148 | |
|---|
| 149 | TARGETS+=dropbear |
|---|
| 150 | |
|---|
| 151 | TARGETS+=ethtool |
|---|
| 152 | |
|---|
| 153 | TARGETS+=e3 |
|---|
| 154 | |
|---|
| 155 | # This won't work, yet. It awaits a newer uClibc version. |
|---|
| 156 | # TARGETS+=noip2 |
|---|
| 157 | |
|---|
| 158 | TARGETS+=nanotop |
|---|
| 159 | |
|---|
| 160 | #TARGETS+=siproxd |
|---|
| 161 | |
|---|
| 162 | # The hostap target will add patches to the kernel and build a hostap.ffw |
|---|
| 163 | # package with hostapd, hostap-driver and wpa_supplicant and hostap-utils |
|---|
| 164 | # if you set it here. |
|---|
| 165 | # TARGETS+=hostap |
|---|
| 166 | # TARGETS+=hostap-utils |
|---|
| 167 | |
|---|
| 168 | # Not yet |
|---|
| 169 | # TARGETS+=ebtables |
|---|
| 170 | |
|---|
| 171 | # And at last: |
|---|
| 172 | TARGETS+=module-packages |
|---|
| 173 | TARGETS+=floppy |
|---|
| 174 | |
|---|
| 175 | ############################################################# |
|---|
| 176 | # |
|---|
| 177 | # You should probably leave this stuff alone unless you know |
|---|
| 178 | # what you are doing. |
|---|
| 179 | # |
|---|
| 180 | ############################################################# |
|---|
| 181 | |
|---|
| 182 | TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) $(TARGET_SOFT_FLOAT) |
|---|
| 183 | TARGET_CC=distcc gcc |
|---|
| 184 | # TARGET_CC=gcc |
|---|
| 185 | TARGET_CX=g++ |
|---|
| 186 | |
|---|
| 187 | HOSTCC:=distcc gcc |
|---|
| 188 | BASE_DIR:=${shell pwd} |
|---|
| 189 | SOURCE_DIR:=$(BASE_DIR)/sources |
|---|
| 190 | SCRIPTS_DIR:=$(BASE_DIR)/scripts |
|---|
| 191 | CONFIG_DIR:=$(BASE_DIR)/configs |
|---|
| 192 | LICENSES_DIR:=$(BASE_DIR)/licenses |
|---|
| 193 | MODULES_BASE_DIR:=$(BASE_DIR)/modules |
|---|
| 194 | MODULES_DIR:=$(MODULES_BASE_DIR)/2.4-std |
|---|
| 195 | DL_DIR:=$(BASE_DIR)/downloads |
|---|
| 196 | PATCH_DIR=$(BASE_DIR)/patches |
|---|
| 197 | PACKAGES_DIR=$(BASE_DIR)/packages |
|---|
| 198 | PACKAGES_INI_DIR=$(PACKAGES_DIR)/scripts |
|---|
| 199 | PACKAGES_SKELETON_DIR=$(PACKAGES_DIR)/skeleton |
|---|
| 200 | INITRD_DIR=$(BASE_DIR)/initrd |
|---|
| 201 | INITRD_MASTER=$(INITRD_DIR)/master |
|---|
| 202 | ADD_DIR=$(BASE_DIR)/add |
|---|
| 203 | ADD_MASTER=$(ADD_DIR)/master |
|---|
| 204 | |
|---|
| 205 | TMP_DIR=$(BASE_DIR)/tmp |
|---|
| 206 | |
|---|
| 207 | # Need another name maybe? |
|---|
| 208 | BUILD_DIR:=$(BASE_DIR)/build_$(ARCH)$(ARCH_FPU_SUFFIX) |
|---|
| 209 | |
|---|
| 210 | TARFLAGS=--format oldgnu |
|---|
| 211 | |
|---|
| 212 | #TAR_VERBOSE=--verbose |
|---|
| 213 | RM=rm -f |
|---|
| 214 | |
|---|
| 215 | # This may be a problem to use but I'll try. |
|---|
| 216 | # --strip-unneeded |
|---|
| 217 | STRIP=strip --strip-unneeded -g --remove-section=.comment --remove-section=.note |
|---|
| 218 | STRIP_KMOD=strip --strip-debug --remove-section=.comment --remove-section=.note |
|---|
| 219 | STRIP=$(STRIP_KMOD) --strip-unneeded |
|---|
| 220 | |
|---|
| 221 | SSTRIP=$(shell command type sstrip >/dev/null 2>&1 && echo sstrip || echo $(STRIP)) |
|---|
| 222 | |
|---|
| 223 | DEPMOD=(cd $(LINUX_DIR); \ |
|---|
| 224 | /sbin/depmod -ae -F System.map -b $(MODULES_DIR) -r $(LINUX_VERSION)) |
|---|
| 225 | |
|---|
| 226 | # SED=/bin/sed -i -e |
|---|
| 227 | SED=/usr/bin/perl -p -i -e |
|---|
| 228 | LZMAD=lzmacat |
|---|
| 229 | LZMAC=lzmacomp |
|---|
| 230 | MAKE=/usr/bin/make $(JLEVEL) |
|---|
| 231 | HOST_ARCH:=$(shell $(HOSTCC) -dumpmachine | sed -e s'/-.*//' \ |
|---|
| 232 | -e 's/sparc.*/sparc/' \ |
|---|
| 233 | -e 's/arm.*/arm/g' \ |
|---|
| 234 | -e 's/m68k.*/m68k/' \ |
|---|
| 235 | -e 's/ppc/powerpc/g' \ |
|---|
| 236 | -e 's/v850.*/v850/g' \ |
|---|
| 237 | -e 's/sh[234]/sh/' \ |
|---|
| 238 | -e 's/mips-.*/mips/' \ |
|---|
| 239 | -e 's/mipsel-.*/mipsel/' \ |
|---|
| 240 | -e 's/cris.*/cris/' \ |
|---|
| 241 | -e 's/i[3-9]86/i386/' \ |
|---|
| 242 | ) |
|---|
| 243 | |
|---|
| 244 | GNU_HOST_NAME:=$(HOST_ARCH)-pc-linux-gnu |
|---|
| 245 | |
|---|
| 246 | all: world |
|---|
| 247 | |
|---|
| 248 | TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS)) |
|---|
| 249 | TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS)) |
|---|
| 250 | TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS)) |
|---|
| 251 | |
|---|
| 252 | world: $(ADD_MASTER) $(INITRD_MASTER) $(DL_DIR) $(TMP_DIR) $(BUILD_DIR) $(PACKAGES_DIR) $(TARGETS) |
|---|
| 253 | |
|---|
| 254 | .PHONY: all world clean dirclean distclean source $(TARGETS) \ |
|---|
| 255 | $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) |
|---|
| 256 | |
|---|
| 257 | include makefiles/*.mk |
|---|
| 258 | |
|---|
| 259 | ############################################################# |
|---|
| 260 | # |
|---|
| 261 | # staging and target directories do NOT list these as |
|---|
| 262 | # dependancies anywhere else |
|---|
| 263 | # |
|---|
| 264 | ############################################################# |
|---|
| 265 | $(TMP_DIR): |
|---|
| 266 | mkdir -p $(TMP_DIR) |
|---|
| 267 | |
|---|
| 268 | $(DL_DIR): |
|---|
| 269 | mkdir -p $(DL_DIR) |
|---|
| 270 | |
|---|
| 271 | $(BUILD_DIR): |
|---|
| 272 | mkdir -p $(BUILD_DIR) |
|---|
| 273 | |
|---|
| 274 | $(PACKAGES_DIR): |
|---|
| 275 | mkdir -p $(PACKAGES_DIR) |
|---|
| 276 | |
|---|
| 277 | $(MODULES_BASE_DIR): |
|---|
| 278 | mkdir -p $(MODULES_BASE_DIR) |
|---|
| 279 | |
|---|
| 280 | $(MODULES_DIR): |
|---|
| 281 | mkdir -p $(MODULES_DIR) |
|---|
| 282 | |
|---|
| 283 | $(ADD_MASTER): |
|---|
| 284 | cp -a $(ADD_DIR)/skeleton $(ADD_MASTER) |
|---|
| 285 | -find $(ADD_MASTER) -type d -name CVS -exec $(RM) -r {} \; > /dev/null 2>&1 |
|---|
| 286 | -find $(ADD_MASTER) -type d -name .svn -exec $(RM) -r {} \; > /dev/null 2>&1 |
|---|
| 287 | |
|---|
| 288 | $(INITRD_MASTER): |
|---|
| 289 | cp -a $(INITRD_DIR)/skeleton $(INITRD_MASTER) |
|---|
| 290 | -find $(INITRD_MASTER) -type d -name CVS -exec $(RM) -r {} \; > /dev/null 2>&1 |
|---|
| 291 | -find $(INITRD_MASTER) -type d -name .svn -exec $(RM) -r {} \; > /dev/null 2>&1 |
|---|
| 292 | |
|---|
| 293 | source: $(TARGETS_SOURCE) |
|---|
| 294 | |
|---|
| 295 | ############################################################# |
|---|
| 296 | # |
|---|
| 297 | # Cleanup and misc junk |
|---|
| 298 | # |
|---|
| 299 | # Fix later.. (yeah!) |
|---|
| 300 | # |
|---|
| 301 | ############################################################# |
|---|
| 302 | clean: $(TARGETS_CLEAN) |
|---|
| 303 | $(RM) -r $(INITRD_MASTER) $(ADD_MASTER) |
|---|
| 304 | |
|---|
| 305 | dirclean: $(TARGETS_DIRCLEAN) |
|---|
| 306 | $(RM) -r $(INITRD_MASTER) $(ADD_MASTER) |
|---|
| 307 | |
|---|
| 308 | distclean: |
|---|
| 309 | $(RM) -r $(DL_DIR) $(BUILD_DIR) |
|---|
| 310 | |
|---|
| 311 | sourceball: |
|---|
| 312 | $(RM) -r $(BUILD_DIR) |
|---|
| 313 | set -e; \ |
|---|
| 314 | cd ..; \ |
|---|
| 315 | $(RM) buildroot.tar.bz2; \ |
|---|
| 316 | tar -cvf buildroot.tar buildroot; \ |
|---|
| 317 | bzip2 -9 buildroot.tar |
|---|
| 318 | |
|---|
| 319 | list-targets: |
|---|
| 320 | @(echo "DIRS:"; \ |
|---|
| 321 | for t in $(TMP_DIR) $(DL_DIR) $(BUILD_DIR) \ |
|---|
| 322 | $(MODULES_BASE_DIR) $(MODULES_DIR) \ |
|---|
| 323 | $(ADD_MASTER) $(INITRD_MASTER) $(PACKAGES_DIR); do \ |
|---|
| 324 | echo -e "\t$$t"; \ |
|---|
| 325 | done \ |
|---|
| 326 | ) |
|---|
| 327 | @echo "TARGETS:" |
|---|
| 328 | @(for t in $(TARGETS); do \ |
|---|
| 329 | echo -e "\t$$t"; \ |
|---|
| 330 | done \ |
|---|
| 331 | ) |
|---|
| 332 | @echo "TARGETS_SOURCE:" |
|---|
| 333 | @(for t in $(TARGETS_SOURCE); do \ |
|---|
| 334 | echo -e "\t$$t"; \ |
|---|
| 335 | done \ |
|---|
| 336 | ) |
|---|
| 337 | @echo "TARGETS_CLEAN:" |
|---|
| 338 | @(for t in $(TARGETS_CLEAN); do \ |
|---|
| 339 | echo -e "\t$$t"; \ |
|---|
| 340 | done \ |
|---|
| 341 | ) |
|---|
| 342 | @echo "TARGETS_DIRCLEAN:" |
|---|
| 343 | @(for t in $(TARGETS_DIRCLEAN); do \ |
|---|
| 344 | echo -e "\t$$t"; \ |
|---|
| 345 | done \ |
|---|
| 346 | ) |
|---|