source: freewrt/Makefile@ 6fc4520e

freewrt_1_0 freewrt_2_0
Last change on this file since 6fc4520e was 93f20e7, checked in by Thorsten Glaser <tg@…>, 19 years ago

we use the httpd redirect here, my bad, this is by design
and actually makes sense

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

  • Property mode set to 100644
File size: 4.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} --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
43oldconfig: .prereq_done
44 @${GMAKE_INV} oldconfig
45
46autobuild: .prereq_done
47 @${GMAKE_INV} autobuild
48
49snapshot: snapshots/.snapshot_done
50
51snapshots/.snapshot_done: .prereq_done .defconfig
52 -rm -rf snapshots
53 mkdir snapshots
54 ${GMAKE_INV} clean
55 for target in $$(awk '/^config FWRT_LINUX/ { print $$2 }' \
56 target/Config.in); do \
57 for filesystem in JFFS2 SQUASHFS_LZMA; do \
58 sed -e "s!FWRT_LINUX_MODEL!$$target!g" \
59 -e "s!FWRT_TARGET_ROOTFS!&_$$filesystem!g" \
60 <.defconfig >.config; \
61 ${GMAKE_INV} all; \
62 cp bin/freewrt-* snapshots/; \
63 ${GMAKE_INV} clean; \
64 done; \
65 done
66
67package_index: .prereq_done
68 @${GMAKE_INV} package_index
69
70target_clean: .prereq_done
71 @${GMAKE_INV} target_clean
72
73world: .prereq_done
74 @${GMAKE_INV} world
75
76prereq:
77 @rm -f .prereq_done
78 @${MAKE} .prereq_done
79
80prereq-noerror:
81 @rm -f .prereq_done
82 @${MAKE} .prereq_done NO_ERROR=1
83
84NO_ERROR=0
85.prereq_done:
86 @-rm -rf .prereq_done lbin
87 @if ! bash --version 2>&1 | fgrep 'GNU bash' >/dev/null 2>&1; then \
88 echo "FreeWRT requires GNU bash to be installed, sorry."; \
89 exit 1; \
90 fi
91 @mkdir lbin
92 @if which nonexistent 2>&1 | grep -q '^no '; then \
93 cp scripts/which.mac lbin/which; \
94 chmod 555 lbin/which; \
95 else \
96 ln -s $$(which which) lbin/which; \
97 fi
98 @if lbin/which gmake >/dev/null 2>&1; then \
99 ln -s $$(lbin/which gmake) lbin/gmake; \
100 else \
101 ln -s $$(lbin/which make) lbin/gmake; \
102 fi
103 @if ! lbin/which md5sum >/dev/null 2>&1; then \
104 cp scripts/md5sum.bsd lbin/md5sum; \
105 chmod 555 lbin/md5sum; \
106 fi
107 @if test x"$$(uname)" = x"MirBSD"; then \
108 sed -e 's!@@FromOS@@!MirBSD!g' -e 's!@@ToOS@@!OpenBSD!g' \
109 -e "s!@@PROG@@!$$(lbin/which uname)!g" \
110 <scripts/uname.fake >lbin/uname; \
111 chmod 555 lbin/uname; \
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://')"; \
135 echo "HOSTCFLAGS:=$${x:--O2 ${CFLAGS}}" | sed 's/ *$$//' \
136 >>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 scripts/scan-tools.sh
147 @ln -s $$(lbin/which ${CC}) lbin/gcc
148 @${GMAKE_INV} tools/install-lbin
149 @echo '===> Prerequisites checked successfully.'
150 @touch $@
151
152.PHONY: prereq prereq-noerror
Note: See TracBrowser for help on using the repository browser.