]>
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
="i686 i586 i486 via-c7 via-c3 geodelx atom330 core2duo"
31 # Configuration rootdir
32 CONFIG_ROOT
=/etc
/$SNAME
37 # Read in kernel version
38 KVER
=$
(grep --max-count=1 PKG_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)
43 # Read in information from git
44 GIT_REV
=$
(git rev-list HEAD |
head -n 1)
45 GIT_TAG
=$
(git tag
2>/dev
/null |
tail -n 1)
50 # Default building options
54 # Default parallelism options
55 PARALLELISMFLAGS
=-j$
(( $
(grep processor
< /proc
/cpuinfo |
wc -l) * 2 + 1 ))
57 # Default distcc options
62 HOSTNAME
=$
(hostname
-f || hostname
)
64 ###############################################################################
66 # Read the local configuration to override the environment variables
68 ###############################################################################
70 if ! [ -e .config
]; then
71 sed -e "s/@UUID@/$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid)/" \
72 -e "s/^#UUID=/UUID=/" < $BASEDIR/.config-default
> $BASEDIR/.config
77 ###############################################################################
79 # Variables that are not modifyable by .config
81 ###############################################################################
83 if [ 'i686' = $MACHINE_REAL \
84 -o 'i586' = $MACHINE_REAL \
85 -o 'i486' = $MACHINE_REAL \
86 -o 'x86_64' = $MACHINE_REAL ]; then
87 IFS_HOST
="$(echo $MACHTYPE | sed "s
/$
(echo $MACHTYPE | cut
-d- -f2)/cross
/")"
90 echo "Can't determine your architecture - $MACHINE_REAL"
94 LINKER
=/lib
/ld-linux.so
.2
95 if [ 'i686' = $TARGET -o 'i586' = $TARGET \
96 -o 'i486' = $TARGET ]; then
98 IFS_TARGET
="${MACHINE}-pc-linux-gnu"
99 CFLAGS
="-O2 -march=${MACHINE} -pipe -fomit-frame-pointer"
101 elif [ 'atom330' = $TARGET ]; then
103 IFS_TARGET
="${MACHINE}-atom-linux-gnu"
104 CFLAGS
="-O2 -march=${MACHINE} -mmmx -msse -msse2 -msse3 -mssse3 -pipe -fomit-frame-pointer"
106 elif [ 'core2duo' = $TARGET ]; then
108 IFS_TARGET
="${MACHINE}-c2d-linux-gnu"
109 CFLAGS
="-O2 -march=pentium-m -msse2 -pipe"
111 elif [ 'via-c7' = $TARGET ]; then
113 IFS_TARGET
="${MACHINE}-via-linux-gnu"
114 CFLAGS
="-O2 -march=${MACHINE} -mmmx -msse -msse2 -msse3 -pipe"
116 elif [ 'via-c3' = $TARGET ]; then
118 IFS_TARGET
="${MACHINE}-via-linux-gnu"
119 CFLAGS
="-O2 -march=c3 -m3dnow -pipe -fomit-frame-pointer"
121 elif [ 'geodelx' = $TARGET ]; then
123 IFS_TARGET
="${MACHINE}-geode-linux-gnu"
124 CFLAGS
="-Os -march=geode -pipe -fomit-frame-pointer"
127 beautify message FAIL
128 echo "Not a valid target arch (i686|i586|i486|via-c7|via-c3|geodelx) - $TARGET"
132 # Make debugging symbols
133 if [ "$BUILD_DEBUG" == "1" ]; then
134 CFLAGS
=$
(sed -e "s/-O[123s]/-O/g" <<< $CFLAGS)
136 CXXFLAGS
=$
(sed -e "s/-O[123s]/-O/g" <<< $CXXFLAGS)
137 CXXFLAGS
="$CXXFLAGS -g"
141 IMAGENAME
=${SNAME}-${VERSION}.${TARGET}
143 if [ "$BUILD_DEBUG" == "1" ]; then
144 # On debug build, append -debug
145 IMAGENAME
=${IMAGENAME}-debug
148 # Define TOOLCHAINNAME
149 TOOLCHAINNAME
=$SNAME-$TOOLCHAINVERSION-toolchain-${TARGET}
151 # Set up what used to be /tools
152 TOOLS_DIR
=/tools_
${TARGET}
155 INSTALLER_DIR
=/pomona
157 # A place to build the iso
160 # A place to keep the images
163 # Files that indicates that we are running or failed
164 RUNNING
=$BASEDIR/.running
165 FAILED
=$BASEDIR/.failed