This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Lose the loose. Fix documentation typo.
[perl5.git] / x2p / cflags.SH
CommitLineData
1f00b0d6
S
1#!/bin/sh
2
aa275be2 3case $PERL_CONFIG_SH in
2b317908 4'')
a0d0e21e
LW
5 if test -f config.sh; then TOP=.;
6 elif test -f ../config.sh; then TOP=..;
7 elif test -f ../../config.sh; then TOP=../..;
8 elif test -f ../../../config.sh; then TOP=../../..;
9 elif test -f ../../../../config.sh; then TOP=../../../..;
10 else
11 echo "Can't find config.sh."; exit 1
12 fi
13 . $TOP/config.sh
14 ;;
2b317908
LW
15esac
16: This forces SH files to create target in same directory as SH file.
17: This is so that make depend always knows where to find SH derivatives.
18case "$0" in
beb210ef
NA
19*/cflags.SH) cd `expr X$0 : 'X\(.*\)/'` ;;
20cflags.SH) ;;
21*) case `pwd` in
22 */x2p) ;;
23 *) if test -d x2p; then cd x2p
24 else echo "Can't figure out where to write output."; exit 1
25 fi;;
26 esac;;
2b317908 27esac
a0d0e21e 28echo "Extracting x2p/cflags (with variable substitutions)"
2b317908
LW
29: This section of the file will have variable substitutions done on it.
30: Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
31: Protect any dollar signs and backticks that you do not want interpreted
32: by putting a backslash in front. You may delete these comments.
14ee6a0a 33rm -f cflags
2b317908
LW
34$spitshell >cflags <<!GROK!THIS!
35!GROK!THIS!
36
37: In the following dollars and backticks do not need the extra backslash.
38$spitshell >>cflags <<'!NO!SUBS!'
aa275be2 39case $PERL_CONFIG_SH in
2b317908 40'')
a0d0e21e
LW
41 if test -f config.sh; then TOP=.;
42 elif test -f ../config.sh; then TOP=..;
43 elif test -f ../../config.sh; then TOP=../..;
44 elif test -f ../../../config.sh; then TOP=../../..;
45 elif test -f ../../../../config.sh; then TOP=../../../..;
46 else
47 echo "Can't find config.sh."; exit 1
48 fi
49 . $TOP/config.sh
50 ;;
2b317908
LW
51esac
52
40fee945
RB
53case "X$1" in
54Xoptimize=*|X"optimize=*")
55 eval "$1"
56 shift
57 ;;
58esac
59
2b317908
LW
60also=': '
61case $# in
621) also='echo 1>&2 " CCCMD = "'
63esac
64
65case $# in
660) set *.c; echo "The current C flags are:" ;;
67esac
68
578789a7 69set `echo "$* " | sed -e 's/\.[oc] / /g' -e 's/\.obj / /g' -e "s/\\$obj_ext / /g"`
2b317908
LW
70
71for file do
72
73 case "$#" in
74 1) ;;
75 *) echo $n " $file.c $c" ;;
76 esac
77
78 : allow variables like str_cflags to be evaluated
79
80 eval 'eval ${'"${file}_cflags"'-""}'
81
82 : or customize here
83
84 case "$file" in
85 a2p) ;;
86 a2py) ;;
87 hash) ;;
88 str) ;;
89 util) ;;
90 walk) ;;
91 *) ;;
92 esac
93
760ac839 94 ccflags="`echo $ccflags | sed -e 's/-DMULTIPLICITY//'`"
a0d0e21e 95
5869b1f1
JH
96 echo "$cc -c $ccflags $optimize"
97 eval "$also "'"$cc -c $ccflags $optimize"'
2b317908 98
a0d0e21e 99 . $TOP/config.sh
2b317908
LW
100
101done
102!NO!SUBS!
a0d0e21e 103chmod 755 cflags
2b317908 104$eunicefix cflags