source: freewrt/Makefile@ c64ea5f

Last change on this file since c64ea5f was c64ea5f, checked in by Phil Sutter <n0-1@…>, 19 years ago

some missing additions

git-svn-id: svn://www.freewrt.org/trunk/freewrt@2369 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 5.2 KB
Line 
1# $FreeWRT$
2#-
3# This file is part of the FreeWRT project. FreeWRT is copyrighted
4# material, please see the LICENCE file in the top-level directory
5# or at http://www.freewrt.org/licence for details.
6
7GMAKE?= $(PWD)/lbin/gmake
8GMAKE_FMK= ${GMAKE} -f $(PWD)/mk/build.mk
9GMAKE_INV= ${GMAKE_FMK} V=99
10
11all verbose: .prereq_done
12 @${GMAKE_INV} all
13
14v: .prereq_done
15 (echo; echo "Build started on $$(LC_ALL=C LANGUAGE=C TZ=UTC date)"; \
16 set -x; ${GMAKE_FMK} V=99 all) 2>&1 | tee -a make.log
17
18help:
19 @echo 'Cleaning targets:'
20 @echo ' clean - Remove bin and build_dir directories'
21 @echo ' cleandir - Same as "clean", but also remove built toolchain'
22 @echo ' distclean - Same as "cleandir", but also remove downloaded'
23 @echo ' distfiles and .config'
24 @echo ''
25 @echo 'Configuration targets:'
26 @echo ' config - Update current config utilising a line-oriented program'
27 @echo ' menuconfig - Update current config utilising a menu based program'
28 @echo ' (default when .config does not exist)'
29 @echo ' oldconfig - Update current config utilising a provided .configs base'
30 @echo ' allmodconfig - New config selecting modules when possible'
31 @echo ' allnoconfig - New config where all options are answered with no'
32 @echo ''
33 @echo 'Other generic targets:'
34 @echo ' all - Build everything as specified in .config'
35 @echo ' (default if .config exists)'
36 @echo ' v - Same as "all" but with logging to make.log enabled'
37 @echo ''
38 @echo 'Package specific targets (use with "package=<pkg-name>" parameter):'
39 @echo ' fetch - Download the necessary distfile'
40 @echo ' extract - Same as "fetch", but also extract the distfile'
41 @echo ' patch - Same as "extract", but also patch the source'
42 @echo ' build - Same as "patch", but also build the binaries'
43 @echo ' fake - Same as "build", but also install the binaries'
44 @echo ' package - Same as "fake", but also create the ipkg package'
45
46clean: .prereq_done
47 @${GMAKE_INV} clean
48
49config: .prereq_done
50 @${GMAKE_INV} config
51
52oldconfig: .prereq_done
53 @${GMAKE_INV} oldconfig
54
55cleandir: .prereq_done
56 @${GMAKE_INV} cleandir
57 @-rm -rf lbin
58 @-rm -f make.log .prereq_done
59
60distclean: .prereq_done
61 @${GMAKE_INV} distclean
62 @-rm -rf lbin
63 @-rm -f make.log .prereq_done
64
65image_clean: .prereq_done
66 @${GMAKE_INV} image_clean
67
68menuconfig: .prereq_done
69 @${GMAKE_INV} menuconfig
70
71allnoconfig: .prereq_done
72 @${GMAKE_INV} allnoconfig
73
74allmodconfig: .prereq_done
75 @${GMAKE_INV} allmodconfig
76
77snapshotconfig: .prereq_done
78 @${GMAKE_INV} snapshotconfig
79
80package_index: .prereq_done
81 @${GMAKE_INV} package_index
82
83target_clean: .prereq_done
84 @${GMAKE_INV} target_clean
85
86world: .prereq_done
87 @${GMAKE_INV} world
88
89prereq:
90 @rm -f .prereq_done
91 @${MAKE} .prereq_done
92
93prereq-noerror:
94 @rm -f .prereq_done
95 @${MAKE} .prereq_done NO_ERROR=1
96
97NO_ERROR=0
98.prereq_done:
99 @-rm -rf .prereq_done lbin
100 @if ! bash --version 2>&1 | fgrep 'GNU bash' >/dev/null 2>&1; then \
101 echo "FreeWRT requires GNU bash to be installed, sorry."; \
102 exit 1; \
103 fi
104 @mkdir lbin
105 @if which nonexistent 2>&1 | grep -q '^no '; then \
106 cp scripts/which.mac lbin/which; \
107 chmod 555 lbin/which; \
108 else \
109 ln -s $$(which which) lbin/which; \
110 fi
111 @if ! lbin/which md5sum >/dev/null 2>&1; then \
112 cp scripts/md5sum.bsd lbin/md5sum; \
113 chmod 555 lbin/md5sum; \
114 fi
115 @echo "TOPDIR:=$$(readlink -nf .)" >lbin/prereq.mk
116 @echo "BASH:=$$(lbin/which bash)" >>lbin/prereq.mk
117 @echo 'GMAKE:=$${TOPDIR}/lbin/gmake' >>lbin/prereq.mk
118 @echo "GNU_HOST_NAME:=$$(${CC} -dumpmachine | sed \
119 -e 's!mirbsd!openbsd!g' \
120 )" >>lbin/prereq.mk
121 @echo "HOST_ARCH:=$$(${CC} -dumpmachine | sed -e s'/-.*//' \
122 -e 's/sparc.*/sparc/' \
123 -e 's/arm.*/arm/g' \
124 -e 's/m68k.*/m68k/' \
125 -e 's/ppc/powerpc/g' \
126 -e 's/v850.*/v850/g' \
127 -e 's/sh[234]/sh/' \
128 -e 's/mips-.*/mips/' \
129 -e 's/mipsel-.*/mipsel/' \
130 -e 's/cris.*/cris/' \
131 -e 's/i[3-9]86/i386/' \
132 )" >>lbin/prereq.mk
133 @echo 'HOSTCC:=${CC}' >>lbin/prereq.mk
134 @x="$$(echo 'f:\n\techo P:$${CFLAGS}\n.include <bsd.prog.mk>' | \
135 ${MAKE} -f - f EXPERIMENTAL=yes 2>/dev/null | grep '^P:' \
136 2>/dev/null | sed 's/^P://')"; y='${CFLAGS}'; echo \
137 "HOSTCFLAGS:=$${x:-$${y:--O2}}" | sed 's/ *$$//' >>lbin/prereq.mk
138 @echo 'LANGUAGE:=C' >>lbin/prereq.mk
139 @echo 'LC_ALL:=C' >>lbin/prereq.mk
140 @echo 'MAKE:=$${GMAKE}' >>lbin/prereq.mk
141 @echo "OStype:=$$(env NOFAKE=yes uname)" >>lbin/prereq.mk
142 @echo "_PATH:=$$PATH" >>lbin/prereq.mk
143 @echo "PATH:=\$${TOPDIR}/lbin:$$PATH" >>lbin/prereq.mk
144 @echo "SHELL:=$$(lbin/which bash)" >>lbin/prereq.mk
145 @TOPDIR=$$(readlink -nf .); \
146 printf '%s\n%s\nwq\n' ",g#$$TOPDIR#s##\$${TOPDIR}#g" \
147 "1s#^.*\$$#TOPDIR:=$$TOPDIR#" | ed -s lbin/prereq.mk
148 @env NO_ERROR=${NO_ERROR} BASH="$$(lbin/which bash)" \
149 CC='${CC}' CPPFLAGS='${CPPFLAGS}' \
150 bash ${_PX} scripts/scan-tools.sh
151 @cc='${CC}'; if test x"$$cc" = x"gcc"; then \
152 ln -s $$(lbin/which "$$cc") lbin/gcc; \
153 else \
154 ( echo "#!$$(lbin/which bash)"; \
155 echo "export PATH=$$PATH"; \
156 echo "exec $$cc" '"$$@"' ) >lbin/gcc; \
157 chmod 555 lbin/gcc; \
158 fi
159 @${GMAKE_INV} tools/install-lbin
160 @echo '===> Prerequisites checked successfully.'
161 @touch $@
162
163.PHONY: prereq prereq-noerror
Note: See TracBrowser for help on using the repository browser.