source: freewrt/Makefile@ de3cb1f5

Last change on this file since de3cb1f5 was 22f6577, checked in by Thorsten Glaser <tg@…>, 19 years ago
  • '%' as line addressing is a BSD extension to the text editor, which GNU ed 0.3+ doesn't support, but isn't listed in the ChangeLog relative to GNU ed 0.2 - use ',' instead bug cought by n0-1@
  • correct line addressing of "TOPDIR:=..." line in prereq.mk

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

  • Property mode set to 100644
File size: 3.7 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
46allmodconfig: .prereq_done
47 @${GMAKE_INV} allmodconfig
48
49snapshotconfig: .prereq_done
50 @${GMAKE_INV} snapshotconfig
51
52package_index: .prereq_done
53 @${GMAKE_INV} package_index
54
55target_clean: .prereq_done
56 @${GMAKE_INV} target_clean
57
58world: .prereq_done
59 @${GMAKE_INV} world
60
61prereq:
62 @rm -f .prereq_done
63 @${MAKE} .prereq_done
64
65prereq-noerror:
66 @rm -f .prereq_done
67 @${MAKE} .prereq_done NO_ERROR=1
68
69NO_ERROR=0
70.prereq_done:
71 @-rm -rf .prereq_done lbin
72 @if ! bash --version 2>&1 | fgrep 'GNU bash' >/dev/null 2>&1; then \
73 echo "FreeWRT requires GNU bash to be installed, sorry."; \
74 exit 1; \
75 fi
76 @mkdir lbin
77 @if which nonexistent 2>&1 | grep -q '^no '; then \
78 cp scripts/which.mac lbin/which; \
79 chmod 555 lbin/which; \
80 else \
81 ln -s $$(which which) lbin/which; \
82 fi
83 @if lbin/which gmake >/dev/null 2>&1; then \
84 ln -s $$(lbin/which gmake) lbin/gmake; \
85 else \
86 ln -s $$(lbin/which make) lbin/gmake; \
87 fi
88 @if ! lbin/which md5sum >/dev/null 2>&1; then \
89 cp scripts/md5sum.bsd lbin/md5sum; \
90 chmod 555 lbin/md5sum; \
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 @cc='${CC}'; if test x"$$cc" = x"gcc"; then \
127 ln -s $$(lbin/which "$$cc") lbin/gcc; \
128 else \
129 ( echo "#!$$(lbin/which bash)"; \
130 echo "exec $$cc" '"$$@"' ) >lbin/gcc; \
131 chmod 555 lbin/gcc; \
132 fi
133 @${GMAKE_INV} tools/install-lbin
134 @echo '===> Prerequisites checked successfully.'
135 @touch $@
136
137.PHONY: prereq prereq-noerror
Note: See TracBrowser for help on using the repository browser.