Commit | Line | Data |
---|---|---|
8ed6d636 VK |
1 | #!/bin/sh |
2 | ||
3 | # Extra warnings, used e.g. for gcc. | |
0c7be120 | 4 | warn="-Wall -W -Wextra -Wendif-labels -Wc++-compat" |
8ed6d636 | 5 | # Extra standardness. |
0c7be120 | 6 | stdflags=" -std=c99" |
8ed6d636 VK |
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) ;; | |
a55c5245 | 76 | dquote) ;; |
8ed6d636 VK |
77 | dump) ;; |
78 | globals) ;; | |
79 | gv) ;; | |
80 | hv) ;; | |
81 | locale) ;; | |
8ed6d636 VK |
82 | main) ;; |
83 | malloc) ;; | |
84 | mg) ;; | |
85 | miniperlmain) ;; | |
86 | numeric) ;; | |
87 | op) ;; | |
88 | opmini) ;; | |
89 | pad) ;; | |
90 | perl) ;; | |
8ed6d636 VK |
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) ;; | |
f832b29a | 105 | time64) ;; |
8ed6d636 VK |
106 | toke) ;; |
107 | universal) ;; | |
108 | usersub) ;; | |
109 | utf8) ;; | |
110 | util) ;; | |
8ed6d636 VK |
111 | *) ;; |
112 | esac | |
113 | ||
114 | case "$cc" in | |
115 | *g++*) | |
8ed6d636 VK |
116 | # Without -Wno-unused-variable g++ 4.x compiles are rather unwatchable |
117 | # because of all the warnings about Perl___notused, and g++ doesn't do | |
118 | # __attribute__((unused)) (and even if at some stage it may, people do | |
119 | # have older gcc installations), and ((void)x) isn't enough to silence | |
120 | # the noises about XS functions not using their cv parameter, so we need | |
121 | # the -Wno-unused-parameter too. | |
122 | # Yes, we lose some valid warnings, but hopefully other compilers | |
123 | # (like gcc) will still pick up those warnings. | |
124 | for o in -Wno-unused-variable -Wno-unused-parameter | |
125 | do | |
126 | case "$warn" in | |
127 | *$o*) ;; | |
128 | *) warn="$warn $o" ;; | |
129 | esac | |
130 | done | |
131 | ;; | |
132 | esac | |
133 | ||
134 | if test -f .patch; then | |
135 | ccflags="-DPERL_PATCHNUM=`cat .patch` $ccflags" | |
136 | fi | |
137 | ||
5a20539c | 138 | echo "$CROSSCC -c -DUSE_CROSS_COMPILE -DPERL_CORE $ccflags $stdflags $optimize $warn $extra" |
8ed6d636 VK |
139 | eval "$also "'"$CROSSCC -DUSE_CROSS_COMPILE -DPERL_CORE -c $ccflags $stdflags $optimize $warn $extra"' |
140 | ||
141 | . $TOP/Cross/config-arm.sh | |
142 | ||
143 | done |