source: freewrt/rules.mk@ d3f9178

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

provide host CFLAGS, CPPFLAGS, LDFLAGS in more than one way to the
scripts etc. – assists in fixing nfs-utils

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

  • Property mode set to 100644
File size: 2.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
7include $(TOPDIR)/lbin/prereq.mk
8-include $(TOPDIR)/.config
9-include ${TOPDIR}/prefs.mk
10
11ifeq ($(V),)
12V= 5
13endif
14
15ifneq ($(V),0)
16TRACE:= echo "---> "
17START_TRACE:= echo -n "---> "
18END_TRACE:= echo
19else
20START_TRACE:= :
21END_TRACE:= :
22TRACE:= :
23endif
24
25ifeq (${shell [ "$(V)" -ge 5 ] && echo 1},)
26CMD_TRACE:= :
27PKG_TRACE:= :
28else
29CMD_TRACE:= echo -n
30PKG_TRACE:= echo "------> "
31endif
32
33ifeq (${shell [ "$(V)" -ge 10 ] && echo 1},)
34EXTRA_MAKEFLAGS:= -s
35MAKE_TRACE:= >/dev/null 2>&1 || { echo "Build failed. Please re-run make with V=99 to see what's going on"; false; }
36else
37MAKE_TRACE:=
38EXTRA_MAKEFLAGS:=
39TRACE:= :
40PKG_TRACE:= :
41CMD_TRACE:= :
42START_TRACE:= :
43END_TRACE:= :
44endif
45
46ifeq (${shell [ "$(V)" -ge 90 ] && echo 1},)
47SET_DASHX:= :
48else
49SET_DASHX:= set -x
50endif
51
52# Strip off the annoying quoting
53ARCH:= $(strip $(subst ",, $(FWRT_ARCH)))
54WGET:= $(strip $(subst ",, $(FWRT_WGET)))
55TARGET_OPTIMIZATION:= $(strip $(subst ",, $(FWRT_TARGET_OPTIMIZATION)))
56FWRT_PREFIX:= $(strip $(subst ",, $(FWRT_PREFIX)))
57#"))"))"))"))")) # for vim's broken syntax highlighting :)
58
59ifneq ($(FWRT_USE_CCACHE),)
60TARGET_COMPILER_PREFIX+= ccache
61endif
62
63include $(TOPDIR)/mk/vars.mk
64
65ifeq (${OStype},Linux)
66MKPASSWD:= $(STAGING_DIR)/bin/mkpasswd -H md5
67else
68MKPASSWD:= encrypt -m
69endif
70
71ifeq ($(strip ${FWRT_HAVE_DOT_CONFIG}),y)
72# XXX derive these from FWRT_* vars
73UNAME_S:= Linux
74
75ifeq ($(strip ${FWRT_LINUX_2_4_BRCM}),y)
76UNAME_R:= 2.4.34
77else ifeq ($(strip ${FWRT_LINUX_2_6_BRCM}),y)
78UNAME_R:= 2.6.19.1
79else ifeq ($(strip ${FWRT_LINUX_2_4_RB}),y)
80UNAME_R:= 2.4.34
81else ifeq ($(strip ${FWRT_LINUX_2_6_RB}),y)
82UNAME_R:= 2.6.19.1
83else ifeq ($(strip ${FWRT_LINUX_2_6_X86}),y)
84UNAME_R:= 2.6.19.1
85else
86$(error Cannot determine target "uname -r" output)
87endif
88
89ifeq ($(strip ${FWRT_mipsel}),y)
90UNAME_M:= mips
91else ifeq ($(strip ${FWRT_i386}),y)
92UNAME_M:= i386
93else
94$(error Cannot determine target "uname -m" output)
95endif
96
97export UNAME_S UNAME_R UNAME_M
98else # ! ifeq ($(strip ${FWRT_HAVE_DOT_CONFIG}),y)
99UNAME_S= $(error This variable cannot be used without .config)
100UNAME_R= $(error This variable cannot be used without .config)
101UNAME_M= $(error This variable cannot be used without .config)
102endif # ! ifeq ($(strip ${FWRT_HAVE_DOT_CONFIG}),y)
103
104export BASH HOSTCC HOSTCFLAGS MAKE LANGUAGE LC_ALL OStype PATH
105
106HOSTCPPFLAGS?=
107HOSTLDFLAGS?=
108
109HOST_CFLAGS:= ${HOSTCFLAGS}
110TARGET_CFLAGS:= $(strip -Os -fno-ident ${TARGET_CFLAGS} -fwrapv -fhonour-copts)
111
112ifneq (${show},)
113_show:
114 @echo '$($(show))'
115endif
Note: See TracBrowser for help on using the repository browser.