| 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.0.0 |
|---|
| 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 properly tested 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=-j5 |
|---|
| 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 | # If you want options to the module, put them in a () after the module. |
|---|
| 90 | NIC_MODULES=3c509 3c59x 8139cp 8139too pcnet32 r8169 e100 e1000 ne ne2k-pci forcedeth tulip |
|---|
| 91 | |
|---|
| 92 | ############################################################# |
|---|
| 93 | # |
|---|
| 94 | # The list of stuff to build for the target filesystem |
|---|
| 95 | # |
|---|
| 96 | ############################################################# |
|---|
| 97 | |
|---|
| 98 | TARGETS+=uclibc |
|---|
| 99 | |
|---|
| 100 | # Probably a good thing even if you choose not to patch anything. |
|---|
| 101 | # This target only unpacks. The linux target does the patching. |
|---|
| 102 | TARGETS+=patch-o-matic |
|---|
| 103 | |
|---|
| 104 | # POM-patches to add: |
|---|
| 105 | # I could have used base but some of the patches has a problem. |
|---|
| 106 | # It's alot here, probably not so smart, cut back later. |
|---|
| 107 | POM_PATCHES=h323-conntrack-nat quake3-conntrack-nat connlimit dstlimit 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 |
|---|
| 108 | |
|---|
| 109 | # After switching to a newer p-o-m; |
|---|
| 110 | # |
|---|
| 111 | # Did not apply cleanly: dropped-table tproxy |
|---|
| 112 | # |
|---|
| 113 | # Did not compile cleanly: |
|---|
| 114 | # policy: (ipt_policy.c:15:22: net/xfrm.h: No such file or directory) |
|---|
| 115 | # |
|---|
| 116 | # osf: (extensions/libipt_osf.c: In function `help': |
|---|
| 117 | # extensions/libipt_osf.c:46: warning: too many arguments for format |
|---|
| 118 | # extensions/libipt_osf.c: In function `parse': |
|---|
| 119 | # extensions/libipt_osf.c:107: error: `IPT_OSF_CONNECTOR' undeclared (first use in this function) |
|---|
| 120 | # extensions/libipt_osf.c:107: error: (Each undeclared identifier is reported only once |
|---|
| 121 | # ) |
|---|
| 122 | # |
|---|
| 123 | # Missing: string |
|---|
| 124 | |
|---|
| 125 | # IPTABLES_MODULES: this is a result of the patches you have chosen above and |
|---|
| 126 | # also the included modules in the kernel (also check the kernel config.) |
|---|
| 127 | # This works the same way as NIC_MODULES. |
|---|
| 128 | # If you want options to the module, put them in a () after the module. |
|---|
| 129 | IPTABLES_MODULES=arp_tables arptable_filter iptable_mangle ipt_DSCP ipt_ECN ipt_LOG ipt_MARK ipt_REDIRECT ipt_TCPMSS ipt_TOS ipt_ULOG ipt_conntrack ipt_connlimit ipt_dscp ipt_ecn ipt_helper ipt_length ipt_limit ipt_mac ipt_mark ipt_physdev ipt_pkttype ipt_tcpmss ipt_tos ipt_ttl ipt_unclean ip_conntrack_ftp ip_nat_ftp ip_conntrack_irc(ports=6666,6667,6668,7000) ip_nat_irc sch_htb ip_conntrack_h323 ip_conntrack_rtsp ip_conntrack_pptp ip_conntrack_quake3 ipt_iprange ipt_multiport |
|---|
| 130 | |
|---|
| 131 | #ipt_MIRROR |
|---|
| 132 | #ip_queue |
|---|
| 133 | #ipt_string |
|---|
| 134 | #ip_nat_tftp |
|---|
| 135 | #ip_conntrack_tftp |
|---|
| 136 | #ip_nat_amanda |
|---|
| 137 | #ip_conntrack_amanda |
|---|
| 138 | |
|---|
| 139 | TARGETS+=linux |
|---|
| 140 | |
|---|
| 141 | TARGETS+=busybox |
|---|
| 142 | USE_BUSYBOX_SNAPSHOT=false |
|---|
| 143 | |
|---|
| 144 | TARGETS+=iptables |
|---|
| 145 | |
|---|
| 146 | TARGETS+=ipset |
|---|
| 147 | |
|---|
| 148 | TARGETS+=iproute2 |
|---|
| 149 | |
|---|
| 150 | TARGETS+=dnsmasq |
|---|
| 151 | |
|---|
| 152 | TARGETS+=bridgeutils |
|---|
| 153 | |
|---|
| 154 | # TARGETS+=modutils |
|---|
| 155 | |
|---|
| 156 | TARGETS+=pppd |
|---|
| 157 | |
|---|
| 158 | TARGETS+=pppoe |
|---|
| 159 | |
|---|
| 160 | TARGETS+=pcmcia |
|---|
| 161 | |
|---|
| 162 | TARGETS+=wireless-tools |
|---|
| 163 | |
|---|
| 164 | TARGETS+=dropbear |
|---|
| 165 | |
|---|
| 166 | TARGETS+=ethtool |
|---|
| 167 | |
|---|
| 168 | # This one will be installed in add.ffw, alas, the floppy base itself and |
|---|
| 169 | # not it's own package. |
|---|
| 170 | #TARGETS+=mii-diag |
|---|
| 171 | |
|---|
| 172 | TARGETS+=e3 |
|---|
| 173 | |
|---|
| 174 | TARGETS+=noip2 |
|---|
| 175 | |
|---|
| 176 | TARGETS+=nanotop |
|---|
| 177 | |
|---|
| 178 | TARGETS+=wsmenu |
|---|
| 179 | |
|---|
| 180 | # These needs to be tested. |
|---|
| 181 | TARGETS+=siproxd |
|---|
| 182 | TARGETS+=ucarp |
|---|
| 183 | TARGETS+=lineserv |
|---|
| 184 | |
|---|
| 185 | # The hostap target will add patches to the kernel and build a hostap.ffw |
|---|
| 186 | # package with hostapd, hostap-driver and wpa_supplicant and hostap-utils |
|---|
| 187 | # if you set it here. |
|---|
| 188 | # TARGETS+=hostap |
|---|
| 189 | # TARGETS+=hostap-utils |
|---|
| 190 | |
|---|
| 191 | # Not yet |
|---|
| 192 | # TARGETS+=ebtables |
|---|
| 193 | |
|---|
| 194 | # And at last: |
|---|
| 195 | TARGETS+=module-packages |
|---|
| 196 | TARGETS+=floppy |
|---|
| 197 | |
|---|
| 198 | ############################################################# |
|---|
| 199 | # |
|---|
| 200 | # You should probably leave this stuff alone unless you know |
|---|
| 201 | # what you are doing. |
|---|
| 202 | # |
|---|
| 203 | ############################################################# |
|---|
| 204 | |
|---|
| 205 | TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) $(TARGET_SOFT_FLOAT) |
|---|
| 206 | # TARGET_CC=distcc gcc |
|---|
| 207 | TARGET_CC=gcc |
|---|
| 208 | TARGET_CX=g++ |
|---|
| 209 | |
|---|
| 210 | HOSTCC:=distcc gcc |
|---|
| 211 | BASE_DIR:=${shell pwd} |
|---|
| 212 | SOURCE_DIR:=$(BASE_DIR)/sources |
|---|
| 213 | SCRIPTS_DIR:=$(BASE_DIR)/scripts |
|---|
| 214 | CONFIG_DIR:=$(BASE_DIR)/configs |
|---|
| 215 | LICENSES_DIR:=$(BASE_DIR)/licenses |
|---|
| 216 | MODULES_BASE_DIR:=$(BASE_DIR)/modules |
|---|
| 217 | MODULES_DIR:=$(MODULES_BASE_DIR)/2.4-std |
|---|
| 218 | DL_DIR:=$(BASE_DIR)/downloads |
|---|
| 219 | PATCH_DIR=$(BASE_DIR)/patches |
|---|
| 220 | PACKAGES_DIR=$(BASE_DIR)/packages |
|---|
| 221 | PACKAGES_INI_DIR=$(PACKAGES_DIR)/scripts |
|---|
| 222 | PACKAGES_SKELETON_DIR=$(PACKAGES_DIR)/skeleton |
|---|
| 223 | INITRD_DIR=$(BASE_DIR)/initrd |
|---|
| 224 | INITRD_MASTER=$(INITRD_DIR)/master |
|---|
| 225 | ADD_DIR=$(BASE_DIR)/add |
|---|
| 226 | ADD_MASTER=$(ADD_DIR)/master |
|---|
| 227 | |
|---|
| 228 | TMP_DIR=$(BASE_DIR)/tmp |
|---|
| 229 | |
|---|
| 230 | # Need another name maybe? |
|---|
| 231 | BUILD_DIR:=$(BASE_DIR)/build_$(ARCH)$(ARCH_FPU_SUFFIX) |
|---|
| 232 | |
|---|
| 233 | TARFLAGS=--format oldgnu |
|---|
| 234 | |
|---|
| 235 | #TAR_VERBOSE=--verbose |
|---|
| 236 | RM=rm -f |
|---|
| 237 | |
|---|
| 238 | # This may be a problem to use but I'll try. |
|---|
| 239 | # --strip-unneeded |
|---|
| 240 | STRIP=strip --strip-unneeded -g --remove-section=.comment --remove-section=.note |
|---|
| 241 | STRIP_KMOD=strip --strip-debug --remove-section=.comment --remove-section=.note |
|---|
| 242 | STRIP=$(STRIP_KMOD) --strip-unneeded |
|---|
| 243 | |
|---|
| 244 | SSTRIP=$(shell command type sstrip >/dev/null 2>&1 && echo sstrip || echo $(STRIP)) |
|---|
| 245 | |
|---|
| 246 | DEPMOD=(cd $(LINUX_DIR); \ |
|---|
| 247 | /sbin/depmod -ae -F System.map -b $(MODULES_DIR) -r $(LINUX_VERSION)) |
|---|
| 248 | |
|---|
| 249 | # SED=/bin/sed -i -e |
|---|
| 250 | SED=/usr/bin/perl -p -i -e |
|---|
| 251 | LZMAD=lzmacat |
|---|
| 252 | LZMAC=lzmacomp |
|---|
| 253 | MAKE=/usr/bin/make $(JLEVEL) |
|---|
| 254 | HOST_ARCH:=$(shell $(HOSTCC) -dumpmachine | sed -e s'/-.*//' \ |
|---|
| 255 | -e 's/sparc.*/sparc/' \ |
|---|
| 256 | -e 's/arm.*/arm/g' \ |
|---|
| 257 | -e 's/m68k.*/m68k/' \ |
|---|
| 258 | -e 's/ppc/powerpc/g' \ |
|---|
| 259 | -e 's/v850.*/v850/g' \ |
|---|
| 260 | -e 's/sh[234]/sh/' \ |
|---|
| 261 | -e 's/mips-.*/mips/' \ |
|---|
| 262 | -e 's/mipsel-.*/mipsel/' \ |
|---|
| 263 | -e 's/cris.*/cris/' \ |
|---|
| 264 | -e 's/i[3-9]86/i386/' \ |
|---|
| 265 | ) |
|---|
| 266 | |
|---|
| 267 | GNU_HOST_NAME:=$(HOST_ARCH)-pc-linux-gnu |
|---|
| 268 | |
|---|
| 269 | all: world |
|---|
| 270 | |
|---|
| 271 | TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS)) |
|---|
| 272 | TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS)) |
|---|
| 273 | TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS)) |
|---|
| 274 | |
|---|
| 275 | world: $(ADD_MASTER) $(INITRD_MASTER) $(DL_DIR) $(TMP_DIR) $(BUILD_DIR) $(PACKAGES_DIR) $(TARGETS) |
|---|
| 276 | |
|---|
| 277 | .PHONY: all world clean dirclean distclean source $(TARGETS) \ |
|---|
| 278 | $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) |
|---|
| 279 | |
|---|
| 280 | include makefiles/*.mk |
|---|
| 281 | |
|---|
| 282 | ############################################################# |
|---|
| 283 | # |
|---|
| 284 | # staging and target directories do NOT list these as |
|---|
| 285 | # dependancies anywhere else |
|---|
| 286 | # |
|---|
| 287 | ############################################################# |
|---|
| 288 | $(TMP_DIR): |
|---|
| 289 | mkdir -p $(TMP_DIR) |
|---|
| 290 | |
|---|
| 291 | $(DL_DIR): |
|---|
| 292 | mkdir -p $(DL_DIR) |
|---|
| 293 | |
|---|
| 294 | $(BUILD_DIR): |
|---|
| 295 | mkdir -p $(BUILD_DIR) |
|---|
| 296 | |
|---|
| 297 | $(PACKAGES_DIR): |
|---|
| 298 | mkdir -p $(PACKAGES_DIR) |
|---|
| 299 | |
|---|
| 300 | $(MODULES_BASE_DIR): |
|---|
| 301 | mkdir -p $(MODULES_BASE_DIR) |
|---|
| 302 | |
|---|
| 303 | $(MODULES_DIR): |
|---|
| 304 | mkdir -p $(MODULES_DIR) |
|---|
| 305 | |
|---|
| 306 | $(ADD_MASTER): |
|---|
| 307 | cp -a $(ADD_DIR)/skeleton $(ADD_MASTER) |
|---|
| 308 | -find $(ADD_MASTER) -type d -name CVS -exec $(RM) -r {} \; > /dev/null 2>&1 |
|---|
| 309 | -find $(ADD_MASTER) -type d -name .svn -exec $(RM) -r {} \; > /dev/null 2>&1 |
|---|
| 310 | |
|---|
| 311 | $(INITRD_MASTER): |
|---|
| 312 | cp -a $(INITRD_DIR)/skeleton $(INITRD_MASTER) |
|---|
| 313 | -find $(INITRD_MASTER) -type d -name CVS -exec $(RM) -r {} \; > /dev/null 2>&1 |
|---|
| 314 | -find $(INITRD_MASTER) -type d -name .svn -exec $(RM) -r {} \; > /dev/null 2>&1 |
|---|
| 315 | |
|---|
| 316 | source: $(TARGETS_SOURCE) |
|---|
| 317 | |
|---|
| 318 | ############################################################# |
|---|
| 319 | # |
|---|
| 320 | # Cleanup and misc junk |
|---|
| 321 | # |
|---|
| 322 | # Fix later.. (yeah!) |
|---|
| 323 | # |
|---|
| 324 | ############################################################# |
|---|
| 325 | clean: $(TARGETS_CLEAN) |
|---|
| 326 | $(RM) -r $(INITRD_MASTER) $(ADD_MASTER) |
|---|
| 327 | |
|---|
| 328 | dirclean: $(TARGETS_DIRCLEAN) |
|---|
| 329 | $(RM) -r $(INITRD_MASTER) $(ADD_MASTER) |
|---|
| 330 | |
|---|
| 331 | distclean: |
|---|
| 332 | $(RM) -r $(DL_DIR) $(BUILD_DIR) |
|---|
| 333 | |
|---|
| 334 | veryclean: |
|---|
| 335 | $(RM) -r $(INITRD_MASTER) |
|---|
| 336 | $(RM) -r $(INITRD_DIR)/initrd.sq |
|---|
| 337 | $(RM) -r $(ADD_MASTER) |
|---|
| 338 | $(RM) $(ADD_DIR)/*.ffw $(ADD_DIR)/*.bz2 |
|---|
| 339 | $(RM) -r $(BUILD_DIR) |
|---|
| 340 | $(RM) -r $(MODULES_BASE_DIR) |
|---|
| 341 | # Should have the skeleton or packages somewhere else. |
|---|
| 342 | $(RM) $(PACKAGES_DIR)/*.ffw $(PACKAGES_DIR)/*.bz2 |
|---|
| 343 | $(RM) -r isoimage* |
|---|
| 344 | $(RM) -r soekris.tar.bz2 |
|---|
| 345 | $(RM) -r flash.tar.bz2 |
|---|
| 346 | # Dangerous.. |
|---|
| 347 | $(RM) -r floppy* |
|---|
| 348 | |
|---|
| 349 | sourceball: |
|---|
| 350 | $(RM) -r $(BUILD_DIR) |
|---|
| 351 | set -e; \ |
|---|
| 352 | cd ..; \ |
|---|
| 353 | $(RM) buildroot.tar.bz2; \ |
|---|
| 354 | tar -cvf buildroot.tar buildroot; \ |
|---|
| 355 | bzip2 -9 buildroot.tar |
|---|
| 356 | |
|---|
| 357 | list-targets: |
|---|
| 358 | @(echo "DIRS:"; \ |
|---|
| 359 | for t in $(TMP_DIR) $(DL_DIR) $(BUILD_DIR) \ |
|---|
| 360 | $(MODULES_BASE_DIR) $(MODULES_DIR) \ |
|---|
| 361 | $(ADD_MASTER) $(INITRD_MASTER) $(PACKAGES_DIR); do \ |
|---|
| 362 | echo -e "\t$$t"; \ |
|---|
| 363 | done \ |
|---|
| 364 | ) |
|---|
| 365 | @echo "TARGETS:" |
|---|
| 366 | @(for t in $(TARGETS); do \ |
|---|
| 367 | echo -e "\t$$t"; \ |
|---|
| 368 | done \ |
|---|
| 369 | ) |
|---|
| 370 | @echo "TARGETS_SOURCE:" |
|---|
| 371 | @(for t in $(TARGETS_SOURCE); do \ |
|---|
| 372 | echo -e "\t$$t"; \ |
|---|
| 373 | done \ |
|---|
| 374 | ) |
|---|
| 375 | @echo "TARGETS_CLEAN:" |
|---|
| 376 | @(for t in $(TARGETS_CLEAN); do \ |
|---|
| 377 | echo -e "\t$$t"; \ |
|---|
| 378 | done \ |
|---|
| 379 | ) |
|---|
| 380 | @echo "TARGETS_DIRCLEAN:" |
|---|
| 381 | @(for t in $(TARGETS_DIRCLEAN); do \ |
|---|
| 382 | echo -e "\t$$t"; \ |
|---|
| 383 | done \ |
|---|
| 384 | ) |
|---|