This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
use re 'strict' doc changes
[perl5.git] / Cross / cflags-cross-arm
1 #!/bin/sh
2
3 # Extra warnings, used e.g. for gcc.
4 warn="-Wall -ansi   -W -Wextra -Wdeclaration-after-statement -Wendif-labels -Wc++-compat"
5 # Extra standardness.
6 stdflags=" -std=c89"
7 # Extra extra.
8 extra=""
9
10 # TODO - remove this Cross-config-xxx stuff
11
12 case $PERL_CONFIG_SH in
13 '')
14         if test -f Cross/config-arm.sh; then TOP=.;
15         elif test -f ../Cross/config-arm.sh; then TOP=..;
16         elif test -f ../../Cross/config-arm.sh; then TOP=../..;
17         elif test -f ../../../Cross/config-arm.sh; then TOP=../../..;
18         elif test -f ../../../../Cross/config-arm.sh; then TOP=../../../..;
19         else
20                 echo "Can't find config-arm.sh."; exit 1
21         fi
22         . $TOP/Cross/config-arm.sh
23         ;;
24 esac
25
26 : syntax: cflags [optimize=XXX] [file[.suffix]]
27 : displays the compiler command line for file
28
29 case "X$1" in
30 Xoptimize=*|X"optimize=*")
31         eval "$1"
32         shift
33         ;;
34 esac
35
36 also=': '
37 case $# in
38 1) also='echo 1>&2 "      CCCMD = "'
39 esac
40
41 case $# in
42 0) set *.c; echo "The current C flags are:" ;;
43 esac
44
45 set `echo "$* " | sed -e 's/\.[oc] / /g' -e "s/\.${CROSS_NAME}o / /g" -e 's/\.obj / /g' -e "s/\\$obj_ext / /g"`
46
47 for file do
48
49     case "$#" in
50     1) extra="-o $file.${CROSS_NAME}o $extra";;
51     *) echo $n "    $file.c     $c" ;;
52     esac
53
54     : allow variables like toke_cflags to be evaluated
55
56     if echo $file | grep -v / >/dev/null
57     then
58       eval 'eval ${'"${file}_cflags"'-""}'
59     fi
60
61     : or customize here
62
63     case "$file" in
64     DB_File) ;;
65     GDBM_File) ;;
66     NDBM_File) ;;
67     ODBM_File) ;;
68     POSIX) ;;
69     SDBM_File) ;;
70     av) ;;
71     byterun) ;;
72     deb) ;;
73     dl) ;;
74     doio) ;;
75     doop) ;;
76     dump) ;;
77     globals) ;;
78     gv) ;;
79     hv) ;;
80     locale) ;;
81     main) ;;
82     malloc) ;;
83     mg) ;;
84     miniperlmain) ;;
85     numeric) ;;
86     op) ;;
87     opmini) ;;
88     pad) ;;
89     perl) ;;
90     perlapi) ;;
91     perlmain) ;;
92     perly) ;;
93     pp) ;;
94     pp_ctl) ;;
95     pp_hot) ;;
96     pp_pack) ;;
97     pp_sort) ;;
98     pp_sys) ;;
99     regcomp) ;;
100     regexec) ;;
101     run) ;;
102     scope) ;;
103     sv) ;;
104     taint) ;;
105     toke) ;;
106     universal) ;;
107     usersub) ;;
108     utf8) ;;
109     util) ;;
110     *) ;;
111     esac
112
113 case "$cc" in
114 *g++*)
115   # Extra paranoia in case people have bad canned ccflags:
116   # bad in the sense that the flags are accepted by g++,
117   # but then whined about.
118   for f in -Wdeclaration-after-statement -std=c89
119   do
120     ccflags=`echo $ccflags|sed 's/$f/ /'`
121   done
122   ;;
123 esac
124
125 case "$cc" in
126 *g++*)
127   # Without -Wno-unused-variable g++ 4.x compiles are rather unwatchable
128   # because of all the warnings about Perl___notused, and g++ doesn't do
129   # __attribute__((unused)) (and even if at some stage it may, people do
130   # have older gcc installations), and ((void)x) isn't enough to silence
131   # the noises about XS functions not using their cv parameter, so we need
132   # the -Wno-unused-parameter too.
133   # Yes, we lose some valid warnings, but hopefully other compilers
134   # (like gcc) will still pick up those warnings.
135   for o in -Wno-unused-variable -Wno-unused-parameter
136   do
137     case "$warn" in
138     *$o*) ;;
139     *) warn="$warn $o" ;;
140     esac
141   done
142   ;;
143 esac
144
145 if test -f .patch; then
146   ccflags="-DPERL_PATCHNUM=`cat .patch` $ccflags"
147 fi
148
149     : Can we perhaps use $ansi2knr here
150     echo "$CROSSCC -c -DUSE_CROSS_COMPILE -DPERL_CORE $ccflags $stdflags $optimize $warn $extra"
151     eval "$also "'"$CROSSCC -DUSE_CROSS_COMPILE -DPERL_CORE -c $ccflags $stdflags $optimize $warn $extra"'
152
153     . $TOP/Cross/config-arm.sh
154
155 done