source: freewrt/Makefile@ da78ea0

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

new target: allnoconfig - creates a config with everything disabled

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

  • Property mode set to 100644
File size: 3.6 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} --no-print-directory
10
11all: .prereq_done
12 @${GMAKE_INV} all
13
14v: .prereq_done
15 (echo; echo "Build started on $$(LC_ALL=C TZ=UTC date)"; set -x; \
16 ${GMAKE_FMK} all V=99) 2>&1 | tee -a make.log
17
18verbose: .prereq_done
19 @${GMAKE_FMK} all V=99
20
21clean: .prereq_done
22 @${GMAKE_INV} clean
23
24config: .prereq_done
25 @${GMAKE_INV} config
26
27cleandir: .prereq_done
28 @${GMAKE_INV} cleandir
29 @-rm -rf lbin
30 @-rm -f make.log .prereq_done
31
32distclean: .prereq_done
33 @${GMAKE_INV} distclean
34 @-rm -rf lbin
35 @-rm -f make.log .prereq_done
36
37image_clean: .prereq_done
38 @${GMAKE_INV} image_clean
39
40menuconfig: .prereq_done
41 @${GMAKE_INV} menuconfig
42
43allnoconfig: .prereq_done
44 @${GMAKE_INV} allnoconfig
45
46package_index: .prereq_done
47 @${GMAKE_INV} package_index
48
49target_clean: .prereq_done
50 @${GMAKE_INV} target_clean
51
52world: .prereq_done
53 @${GMAKE_INV} world
54
55prereq:
56 @rm -f .prereq_done
57 @${MAKE} .prereq_done
58
59prereq-noerror:
60 @rm -f .prereq_done
61 @${MAKE} .prereq_done NO_ERROR=1
62
63NO_ERROR=0
64.prereq_done:
65 @-rm -rf .prereq_done lbin
66 @if ! bash --version 2>&1 | fgrep 'GNU bash' >/dev/null 2>&1; then \
67 echo "FreeWRT requires GNU bash to be installed, sorry."; \
68 exit 1; \
69 fi
70 @mkdir lbin
71 @if which nonexistent 2>&1 | grep -q '^no '; then \
72 cp scripts/which.mac lbin/which; \
73 chmod 555 lbin/which; \
74 else \
75 ln -s $$(which which) lbin/which; \
76 fi
77 @if lbin/which gmake >/dev/null 2>&1; then \
78 ln -s $$(lbin/which gmake) lbin/gmake; \
79 else \
80 ln -s $$(lbin/which make) lbin/gmake; \
81 fi
82 @if ! lbin/which md5sum >/dev/null 2>&1; then \
83 cp scripts/md5sum.bsd lbin/md5sum; \
84 chmod 555 lbin/md5sum; \
85 fi
86 @if test x"$$(uname)" = x"MirBSD"; then \
87 sed -e 's!@@FromOS@@!MirBSD!g' -e 's!@@ToOS@@!OpenBSD!g' \
88 -e "s!@@PROG@@!$$(lbin/which uname)!g" \
89 <scripts/uname.fake >lbin/uname; \
90 chmod 555 lbin/uname; \
91 fi
92 @echo "TOPDIR:=$$(readlink -nf .)" >lbin/prereq.mk
93 @echo "BASH:=$$(lbin/which bash)" >>lbin/prereq.mk
94 @echo 'GMAKE:=$${TOPDIR}/lbin/gmake' >>lbin/prereq.mk
95 @echo "GNU_HOST_NAME:=$$(${CC} -dumpmachine | sed \
96 -e 's!mirbsd!openbsd!g' \
97 )" >>lbin/prereq.mk
98 @echo "HOST_ARCH:=$$(${CC} -dumpmachine | sed -e s'/-.*//' \
99 -e 's/sparc.*/sparc/' \
100 -e 's/arm.*/arm/g' \
101 -e 's/m68k.*/m68k/' \
102 -e 's/ppc/powerpc/g' \
103 -e 's/v850.*/v850/g' \
104 -e 's/sh[234]/sh/' \
105 -e 's/mips-.*/mips/' \
106 -e 's/mipsel-.*/mipsel/' \
107 -e 's/cris.*/cris/' \
108 -e 's/i[3-9]86/i386/' \
109 )" >>lbin/prereq.mk
110 @echo 'HOSTCC:=${CC}' >>lbin/prereq.mk
111 @x="$$(echo 'f:\n\techo P:$${CFLAGS}\n.include <bsd.prog.mk>' | \
112 ${MAKE} -f - f EXPERIMENTAL=yes 2>/dev/null | grep '^P:' \
113 2>/dev/null | sed 's/^P://')"; \
114 echo "HOSTCFLAGS:=$${x:--O2 ${CFLAGS}}" | sed 's/ *$$//' \
115 >>lbin/prereq.mk
116 @echo 'LC_ALL:=C' >>lbin/prereq.mk
117 @echo 'MAKE:=$${GMAKE}' >>lbin/prereq.mk
118 @echo "OStype:=$$(env NOFAKE=yes uname)" >>lbin/prereq.mk
119 @echo "_PATH:=$$PATH" >>lbin/prereq.mk
120 @echo "PATH:=\$${TOPDIR}/lbin:$$PATH" >>lbin/prereq.mk
121 @echo "SHELL:=$$(lbin/which bash)" >>lbin/prereq.mk
122 @TOPDIR=$$(readlink -nf .); \
123 printf '%s\n%s\nwq\n' "%g#$$TOPDIR#s##\$${TOPDIR}#g" \
124 "1s#^.*\$$#TOPDIR:=$$TOPDIR#" | ed -s lbin/prereq.mk
125 @env NO_ERROR=${NO_ERROR} bash scripts/scan-tools.sh
126 @ln -s $$(lbin/which ${CC}) lbin/gcc
127 @${GMAKE_INV} tools/install-lbin
128 @echo '===> Prerequisites checked successfully.'
129 @touch $@
130
131.PHONY: prereq prereq-noerror
Note: See TracBrowser for help on using the repository browser.