source: freewrt/Makefile@ df9a3e9

freewrt_2_0
Last change on this file since df9a3e9 was 18face91, checked in by Waldemar Brodkorb <wbx@…>, 4 months ago

gcc CFLAGS -fcommon no longer needed

  • Property mode set to 100644
File size: 4.1 KB
Line 
1# This file is part of the FreeWRT project. FreeWRT is copyrighted
2# material, please see the LICENCE file in the top-level directory
3
4GMAKE?= $(PWD)/lbin/gmake
5GMAKE_FMK= ${GMAKE} -f $(PWD)/mk/build.mk
6GMAKE_INV= ${GMAKE_FMK} --no-print-directory
7
8all: .prereq_done
9 @${GMAKE_INV} all
10
11v: .prereq_done
12 (echo; echo "Build started on $$(LC_ALL=C TZ=UTC date)"; set -x; \
13 ${GMAKE_FMK} all V=99) 2>&1 | tee -a make.log
14
15help:
16 @echo 'Cleaning targets:'
17 @echo ' clean - Remove bin and build_dir directories'
18 @echo ' cleandir - Same as "clean", but also remove built toolchain'
19 @echo ' distclean - Same as "cleandir", but also remove downloaded'
20 @echo ' distfiles and .config'
21 @echo ''
22 @echo 'Configuration targets:'
23 @echo ' config - Update current config utilising a line-oriented program'
24 @echo ' menuconfig - Update current config utilising a menu based program'
25 @echo ' (default when .config does not exist)'
26 @echo ' allmodconfig - New config selecting modules when possible'
27 @echo ' allnoconfig - New config where all options are answered with no'
28 @echo ''
29 @echo 'Other generic targets:'
30 @echo ' all - Build everything as specified in .config'
31 @echo ' (default if .config exists)'
32 @echo ' v - Same as "all" but with logging to make.log enabled'
33
34
35verbose: .prereq_done
36 @${GMAKE_FMK} all V=99
37
38clean: .prereq_done
39 @${GMAKE_INV} clean
40
41cleanbuild: .prereq_done
42 @${GMAKE_INV} cleanbuild
43
44
45config: .prereq_done
46 @${GMAKE_INV} config
47
48cleandir: .prereq_done
49 @${GMAKE_INV} cleandir
50 @-rm -rf lbin
51 @-rm -f make.log .prereq_done
52
53distclean: .prereq_done
54 @${GMAKE_INV} distclean
55 @-rm -rf lbin
56 @-rm -f make.log .prereq_done
57
58image_clean: .prereq_done
59 @${GMAKE_INV} image_clean
60
61menuconfig: .prereq_done
62 @${GMAKE_INV} menuconfig
63
64allnoconfig: .prereq_done
65 @${GMAKE_INV} allnoconfig
66
67allmodconfig: .prereq_done
68 @${GMAKE_INV} allmodconfig
69
70snapshotconfig: .prereq_done
71 @${GMAKE_INV} snapshotconfig
72
73package_index: .prereq_done
74 @${GMAKE_INV} package_index
75
76target_clean: .prereq_done
77 @${GMAKE_INV} target_clean
78
79world: .prereq_done
80 @${GMAKE_INV} world
81
82allpackages: .prereq_done
83 @${GMAKE_INV} allpackages
84
85prereq:
86 @rm -f .prereq_done
87 @${MAKE} .prereq_done
88
89prereq-noerror:
90 @rm -f .prereq_done
91 @${MAKE} .prereq_done NO_ERROR=1
92
93NO_ERROR=0
94.prereq_done:
95 @-rm -rf .prereq_done lbin
96 @if ! bash --version 2>&1 | fgrep 'GNU bash' >/dev/null 2>&1; then \
97 echo "FreeWRT requires GNU bash to be installed, sorry."; \
98 exit 1; \
99 fi
100 @mkdir lbin
101 @cp scripts/makeinfo lbin/makeinfo
102 @if which gmake >/dev/null 2>&1; then \
103 ln -s $$(which gmake) lbin/gmake; \
104 else \
105 ln -s $$(which make) lbin/gmake; \
106 fi
107 @echo "TOPDIR:=$$(readlink -nf .)" >lbin/prereq.mk
108 @echo "BASH:=$$(which bash)" >>lbin/prereq.mk
109 @echo 'GMAKE:=$${TOPDIR}/lbin/gmake' >>lbin/prereq.mk
110 @echo "GNU_HOST_NAME:=$$(${CC} -dumpmachine | sed \
111 -e 's!mirbsd!openbsd!g' \
112 )" >>lbin/prereq.mk
113 @echo "HOST_ARCH:=$$(${CC} -dumpmachine | sed -e s'/-.*//' \
114 -e 's/sparc.*/sparc/' \
115 -e 's/arm.*/arm/g' \
116 -e 's/m68k.*/m68k/' \
117 -e 's/ppc/powerpc/g' \
118 -e 's/sh[234]/sh/' \
119 -e 's/mips-.*/mips/' \
120 -e 's/mipsel-.*/mipsel/' \
121 -e 's/i[3-9]86/i386/' \
122 )" >>lbin/prereq.mk
123 @echo 'HOSTCC:=${CC}' >>lbin/prereq.mk
124 @x="$$(echo 'f:\n\techo P:$${CFLAGS}\n.include <bsd.prog.mk>' | \
125 ${MAKE} -f - f EXPERIMENTAL=yes 2>/dev/null | grep '^P:' \
126 2>/dev/null | sed 's/^P://')"; \
127 echo "HOSTCFLAGS:=$${x:--O2 ${CFLAGS}}" | sed 's/ *$$//' \
128 >>lbin/prereq.mk
129 @echo 'LC_ALL:=C' >>lbin/prereq.mk
130 @echo 'MAKE:=$${GMAKE}' >>lbin/prereq.mk
131 @echo "OStype:=$$(uname)" >>lbin/prereq.mk
132 @echo "_PATH:=$$PATH" >>lbin/prereq.mk
133 @echo "PATH:=\$${TOPDIR}/lbin:$$PATH" >>lbin/prereq.mk
134 @echo "SHELL:=$$(which bash)" >>lbin/prereq.mk
135 @TOPDIR=$$(readlink -nf .); \
136 printf '%s\n%s\nwq\n' ",g#$$TOPDIR#s##\$${TOPDIR}#g" \
137 "1s#^.*\$$#TOPDIR:=$$TOPDIR#" | ed -s lbin/prereq.mk
138 @env NO_ERROR=${NO_ERROR} bash scripts/scan-tools.sh
139 @ln -s $$(which ${CC}) lbin/gcc
140 @${GMAKE_INV} tools/install-lbin
141 @echo '===> Prerequisites checked successfully.'
142 @touch $@
143
144.PHONY: prereq prereq-noerror
Note: See TracBrowser for help on using the repository browser.