source: freewrt/Makefile@ 29b8d3d

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

integrate a 'help' target

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

  • Property mode set to 100644
File size: 5.1 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 ' package - Same as "patch", but also compile and build the package'
43
44clean: .prereq_done
45 @${GMAKE_INV} clean
46
47config: .prereq_done
48 @${GMAKE_INV} config
49
50oldconfig: .prereq_done
51 @${GMAKE_INV} oldconfig
52
53cleandir: .prereq_done
54 @${GMAKE_INV} cleandir
55 @-rm -rf lbin
56 @-rm -f make.log .prereq_done
57
58distclean: .prereq_done
59 @${GMAKE_INV} distclean
60 @-rm -rf lbin
61 @-rm -f make.log .prereq_done
62
63image_clean: .prereq_done
64 @${GMAKE_INV} image_clean
65
66menuconfig: .prereq_done
67 @${GMAKE_INV} menuconfig
68
69allnoconfig: .prereq_done
70 @${GMAKE_INV} allnoconfig
71
72allmodconfig: .prereq_done
73 @${GMAKE_INV} allmodconfig
74
75snapshotconfig: .prereq_done
76 @${GMAKE_INV} snapshotconfig
77
78package_index: .prereq_done
79 @${GMAKE_INV} package_index
80
81target_clean: .prereq_done
82 @${GMAKE_INV} target_clean
83
84world: .prereq_done
85 @${GMAKE_INV} world
86
87prereq:
88 @rm -f .prereq_done
89 @${MAKE} .prereq_done
90
91prereq-noerror:
92 @rm -f .prereq_done
93 @${MAKE} .prereq_done NO_ERROR=1
94
95NO_ERROR=0
96.prereq_done:
97 @-rm -rf .prereq_done lbin
98 @if ! bash --version 2>&1 | fgrep 'GNU bash' >/dev/null 2>&1; then \
99 echo "FreeWRT requires GNU bash to be installed, sorry."; \
100 exit 1; \
101 fi
102 @mkdir lbin
103 @if which nonexistent 2>&1 | grep -q '^no '; then \
104 cp scripts/which.mac lbin/which; \
105 chmod 555 lbin/which; \
106 else \
107 ln -s $$(which which) lbin/which; \
108 fi
109 @if ! lbin/which md5sum >/dev/null 2>&1; then \
110 cp scripts/md5sum.bsd lbin/md5sum; \
111 chmod 555 lbin/md5sum; \
112 fi
113 @echo "TOPDIR:=$$(readlink -nf .)" >lbin/prereq.mk
114 @echo "BASH:=$$(lbin/which bash)" >>lbin/prereq.mk
115 @echo 'GMAKE:=$${TOPDIR}/lbin/gmake' >>lbin/prereq.mk
116 @echo "GNU_HOST_NAME:=$$(${CC} -dumpmachine | sed \
117 -e 's!mirbsd!openbsd!g' \
118 )" >>lbin/prereq.mk
119 @echo "HOST_ARCH:=$$(${CC} -dumpmachine | sed -e s'/-.*//' \
120 -e 's/sparc.*/sparc/' \
121 -e 's/arm.*/arm/g' \
122 -e 's/m68k.*/m68k/' \
123 -e 's/ppc/powerpc/g' \
124 -e 's/v850.*/v850/g' \
125 -e 's/sh[234]/sh/' \
126 -e 's/mips-.*/mips/' \
127 -e 's/mipsel-.*/mipsel/' \
128 -e 's/cris.*/cris/' \
129 -e 's/i[3-9]86/i386/' \
130 )" >>lbin/prereq.mk
131 @echo 'HOSTCC:=${CC}' >>lbin/prereq.mk
132 @x="$$(echo 'f:\n\techo P:$${CFLAGS}\n.include <bsd.prog.mk>' | \
133 ${MAKE} -f - f EXPERIMENTAL=yes 2>/dev/null | grep '^P:' \
134 2>/dev/null | sed 's/^P://')"; y='${CFLAGS}'; echo \
135 "HOSTCFLAGS:=$${x:-$${y:--O2}}" | sed 's/ *$$//' >>lbin/prereq.mk
136 @echo 'LANGUAGE:=C' >>lbin/prereq.mk
137 @echo 'LC_ALL:=C' >>lbin/prereq.mk
138 @echo 'MAKE:=$${GMAKE}' >>lbin/prereq.mk
139 @echo "OStype:=$$(env NOFAKE=yes uname)" >>lbin/prereq.mk
140 @echo "_PATH:=$$PATH" >>lbin/prereq.mk
141 @echo "PATH:=\$${TOPDIR}/lbin:$$PATH" >>lbin/prereq.mk
142 @echo "SHELL:=$$(lbin/which bash)" >>lbin/prereq.mk
143 @TOPDIR=$$(readlink -nf .); \
144 printf '%s\n%s\nwq\n' ",g#$$TOPDIR#s##\$${TOPDIR}#g" \
145 "1s#^.*\$$#TOPDIR:=$$TOPDIR#" | ed -s lbin/prereq.mk
146 @env NO_ERROR=${NO_ERROR} BASH="$$(lbin/which bash)" \
147 CC='${CC}' CPPFLAGS='${CPPFLAGS}' \
148 bash ${_PX} scripts/scan-tools.sh
149 @cc='${CC}'; if test x"$$cc" = x"gcc"; then \
150 ln -s $$(lbin/which "$$cc") lbin/gcc; \
151 else \
152 ( echo "#!$$(lbin/which bash)"; \
153 echo "export PATH=$$PATH"; \
154 echo "exec $$cc" '"$$@"' ) >lbin/gcc; \
155 chmod 555 lbin/gcc; \
156 fi
157 @${GMAKE_INV} tools/install-lbin
158 @echo '===> Prerequisites checked successfully.'
159 @touch $@
160
161.PHONY: prereq prereq-noerror
Note: See TracBrowser for help on using the repository browser.