source: freewrt/Makefile@ 87ff74b

Last change on this file since 87ff74b was 87ff74b, checked in by Thorsten Glaser <tg@…>, 19 years ago

try to work around hen-egg problem, sorry dnehring@, please continue to test this, I cannot

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

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