]>
git.ipfire.org Git - ipfire-3.x.git/blob - tools/make-constants
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2008 Michael Tremer & Christian Schmidt #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
21 ###############################################################################
25 ###############################################################################
29 POSSIBLE_TARGETS
="i586 i686 via-c3 via-c7 geodelx"
31 # Configuration rootdir
32 CONFIG_ROOT
=/etc
/$SNAME
37 # Read in kernel version
38 KVER
=$
(grep --max-count=1 VER lfs
/linux |
awk '{ print $3 }' |
tr -d '\n'; grep --max-count=1 LOCALVERSION lfs
/linux |
awk '{ print $3 }' |
tail -1)
40 # Read in machine type
41 MACHINE_REAL
=$
(uname
-m)
44 GIT_TAG
=$
(git tag |
tail -1)
46 # Default Security options
54 # Default building options
58 # Default parallelism options
59 PARALLELISMFLAGS
=-j$
(( $
(grep processor
< /proc
/cpuinfo |
wc -l) * 2 + 1 ))
61 # Default distcc options
62 DISTCC_HOSTS
=localhost
67 HOSTNAME
=${HOSTNAME-$(hostname -f || hostname)}
69 ###############################################################################
71 # Read the local configuration to override the environment variables
73 ###############################################################################
75 if ! [ -e .config
]; then
76 sed -e "s/@UUID@/$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid)/" \
77 -e "s/^#UUID=/UUID=/" < $BASEDIR/.config-default
> $BASEDIR/.config
82 ###############################################################################
84 # Variables that are not modifyable by .config
86 ###############################################################################
88 if [ 'i686' = $MACHINE_REAL \
89 -o 'i586' = $MACHINE_REAL \
90 -o 'i486' = $MACHINE_REAL \
91 -o 'x86_64' = $MACHINE_REAL ]; then
92 IFS_HOST
="$(echo $MACHTYPE | sed "s
/$
(echo $MACHTYPE | cut
-d- -f2)/cross
/")"
95 echo "Can't determine your architecture - $MACHINE_REAL"
99 if [ 'i686' = $TARGET -o 'i586' = $TARGET \
100 -o 'i486' = $TARGET ]; then
102 MACHINE_REAL
=${MACHINE_REAL}
103 LINKER
=/lib
/ld-linux.so
.2
104 IFS_TARGET
="${MACHINE}-pc-linux-gnu"
105 CFLAGS
="-march=${MACHINE} -O2 -pipe -fomit-frame-pointer"
107 elif [ 'via-c7' = $TARGET ]; then
109 MACHINE_REAL
=${MACHINE_REAL}
110 LINKER
=/lib
/ld-linux.so
.2
111 IFS_TARGET
="${MACHINE}-pc-linux-gnu"
112 CFLAGS
="-march=${MACHINE} -mmmx -msse -msse2 -msse3 -O2 -pipe"
114 elif [ 'via-c3' = $TARGET ]; then
116 MACHINE_REAL
=${MACHINE_REAL}
117 LINKER
=/lib
/ld-linux.so
.2
118 IFS_TARGET
="${MACHINE}-pc-linux-gnu"
119 CFLAGS
="-march=c3 -m3dnow -O2 -pipe -fomit-frame-pointer"
121 elif [ 'geodelx' = $TARGET ]; then
123 MACHINE_REAL
=${MACHINE_REAL}
124 LINKER
=/lib
/ld-linux.so
.2
125 IFS_TARGET
="${MACHINE}-pc-linux-gnu"
126 CFLAGS
="-march=geode -Os -pipe -fomit-frame-pointer"
129 beautify message FAIL
130 echo "Not a valid target arch (i686|i586|i486|via-c7|via-c3|geodelx) - $TARGET"
134 # Make debugging symbols
135 if [ "$BUILD_DEBUG" == "1" ]; then
136 CFLAGS
=$
(sed -e "s/-O[123s]/-O/g" <<< $CFLAGS)
138 CXXFLAGS
=$
(sed -e "s/-O[123s]/-O/g" <<< $CXXFLAGS)
139 CXXFLAGS
="$CXXFLAGS -g"
143 IMAGENAME
=${SNAME}-${VERSION}.${TARGET}
145 if [ "$BUILD_DEBUG" == "1" ]; then
146 # On debug build, append -debug
147 IMAGENAME
=${IMAGENAME}-debug
150 # Define TOOLCHAINNAME
151 TOOLCHAINNAME
=$SNAME-$TOOLCHAINVERSION-toolchain-t${TARGET}-m${MACHINE}
153 # Set up what used to be /tools
154 TOOLS_DIR
=/tools_
${MACHINE}
157 INSTALLER_DIR
=/pomona
159 # A place to build the iso
162 # A place to keep the images
165 # Files that indicates that we are running or failed
166 RUNNING
=$BASEDIR/.running
167 FAILED
=$BASEDIR/.failed