1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
#!/bin/sh
#
# here we try to figure out the best optimization flags for compiler
# I am quessing a lot here so comments are more than welcome.
#
# Antti Barck <proff@iki.fi> 12/1997
#
# Modified by Milan Zamazal <pdm@debian.org> on 1999-11-21 to allow compilation
# on m68k and to be built with `-g'.
#
# usage: cflags <cpu> <os>
# cflags --help
#
flaggies="(default)"
case $1 in
--help)
cat << __HELP__
usage: cflags <cpu> <os>
known combinations:
alpha linux
osf
ultrix
sparc sunos
i386 linux
i486
i586
__HELP__
;;
alpha)
case $2 in
linux*)
# gcc-2.7 for alpha compiles slower code
# with any optimization level over -O2
flaggies="-Wall -O2"
;;
osf*)
# (umm, you can run gcc on OSF as well?!)
flaggies="-O3"
;;
ultrix*)
# Does this happen?!
flaggies="-O2"
;;
esac
;;
sparc)
case $2 in
sunos*)
# what about gcc?!
flaggies="-O3 -s"
;;
esac
;;
i386)
case $2 in
linux*)
flaggies="-Wall -O3"
;;
esac
;;
i486)
case $2 in
linux*)
flaggies="-Wall -O4 -m486 -fomit-frame-pointer -funroll-loops"
;;
esac
;;
i586)
case $2 in
linux*)
flaggies="-Wall -O4 -m486 -fomit-frame-pointer -fforce-addr -fforce-mem -malign-loops=2 -malign-functions=2 -malign-jumps=2 -funroll-loops"
# this might work for pentium povered linux machines that have PGCC
# flaggies="-Wall -O6 -mpentium -frisc"
;;
esac
;;
i686)
case $2 in
linux*)
flaggies="-Wall -O4 -m486 -fomit-frame-pointer -fforce-addr -fforce-mem -malign-loops=2 -malign-functions=2 -malign-jumps=2 -funroll-loops"
# this might work for pentium povered linux machines that have PGCC
# flaggies="-Wall -O6 -mpentium -frisc"
;;
esac
;;
m68k)
case $2 in
linux*)
flaggies="-Wall -O3"
;;
esac
;;
esac
if test "$flaggies" != "(default)" -a \
-n `echo $DEB_BUILD_OPTIONS | fgrep debug`; then
flaggies="$flaggies -g"
fi
echo $flaggies
|