File: rtl-config

package info (click to toggle)
rtlinux 3.1pre3-3
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 4,896 kB
  • ctags: 4,228
  • sloc: ansic: 26,204; sh: 2,069; makefile: 1,414; perl: 855; tcl: 489; asm: 380; cpp: 42
file content (255 lines) | stat: -rwxr-xr-x 6,329 bytes parent folder | download | duplicates (2)
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
#!/bin/sh
# RTLinux Configuration script file. 
# Type:
# 	rtl-config --help
# for information on how to use this script file
#
# Copyright 2000, Finite State Machines Laboratory
# Written by Edgar F. Hilton, efhilton@fsmlabs.com

# file from which to derive our information
MK_FILE=/usr/include/rtlinux/rtl.config

# the rtl-config version
VERSION=1.16

# Help message
usage ()
{
  echo
  echo "USAGE: "
  echo "	rtl-config [OPTIONS]"
  echo ""
  echo "General options:"
  echo "        --config=<path> set the path+filename to the config file to parse"
  echo "	--modules       returns the list of RTLinux modules"
  echo "        --module_dir    returns the path to where the RTLinux modules reside"
  echo "        --docs          returns path to the RTLinux docs"
  echo "	--linux	        returns the path to the linux kernel source tree"
  echo "	--prefix        returns the path to the rtlinux installation tree"
  echo "	--arch          returns the architecture for the compiled RTLinux kernel"
  echo "	--version       returns the rtl-config version"
  echo "	--rtlVersion    returns the RTLinux kernel version"
  echo "	--linuxVersion  returns the linux kernel version"
  echo "	--cc	        returns the name for the compiler"
  echo ""
  echo "Compiling options for RT development:"
  echo "	--rtinclude     paths to include files for RT programs"
  echo "	--cflags        returns the necessary C flags to compile "
  echo "	--cppflags      returns the necessary C++ flags to compile "
  echo "        --mk            returns Makefile-compatible output (rtl.mk)"
  echo ""
  echo "Compiling options for non RT development:"
  echo "	--include       returns paths to include files for nonRT programs"
  echo "	--libs          returns libraries and paths"
  echo ""
  echo "Copyright 2000, Finite State Machine Labs, Inc."
  echo "Questions? Contact Edgar F. Hilton, efhilton@fsmlabs.com"
  echo
}

clean_list ()
{
    LIST=`echo $LIST | sed -e s/"\/\/"/"\/"/g `
}

rtl_parse_list ()
{
    if [ $LIST ]; then
	clean_list
	STRING=$SEPARATOR
	TEMP_PARSE=`echo $LIST | \
		    sed -e s/:/\ $SEPARATOR/g`
	STRING=$STRING$TEMP_PARSE
    else
	STRING=""
    fi
}

# check that enough arguments were passed
if [ $# -eq 0 ]; then
    usage 1 1 
    exit 1;
fi

# Capture special options:
# 1. configure the path to the parse file
# 2. break out on special options
MY_ARGS=""
for args in $*; do
    if [ `echo $args | grep -c -e '--config='` -gt 0 ] ; then
	TEMP=`echo $@ | sed s/^.*--config\=// | sed s/\ .*$//`
	if [ ! -z "$TEMP" ] ; then
	    MK_FILE=$TEMP
	fi
    else
        if [ `echo $args | grep -c -e '--mk'` -eq 1 ] || 
           [ `echo $args | grep -c -e '--version'` -eq 1 ] || 
           [ `echo $args | grep -c -e '--help'` -eq 1 ]; then
	    MY_ARGS=$args
	    break
	else
	    MY_ARGS="$MY_ARGS $args"
	fi
    fi
done

# check to make sure that the file exists
if [ ! -f "$MK_FILE" ]; then
    echo                                       
    echo "ERROR:"
    echo "  The parse file:"
    echo "          $MK_FILE"
    echo "  was not found."
    echo 
    echo "  Is RTLinux installed?"
    echo
    exit 1
else
. $MK_FILE
fi

# Our actual engine
CALL_MYSELF_W="$0 --config=$MK_FILE"
OUTPUT_STRING=""
for ARGUMENT in $MY_ARGS; do
    STRING=""
    case "$ARGUMENT" in
	--version)
	    echo
	    echo "RTL-CONFIG version: $VERSION"
	    echo "   RTLINUX version: `$CALL_MYSELF_W --rtlVersion`"
	    echo "     LINUX version: `$CALL_MYSELF_W --linuxVersion`"
	    echo 
	    echo " Copyright (C) 2000, Finite State Machine Labs, Inc."
	    echo " Problems with script? Please contact:"
            echo "     Edgar F. Hilton <efhilton@fsmlabs.com>"
	    echo
	    exit 0
	    ;;
	--mk)
	    echo "# Generated automatically by rtl-config"
	    echo "#   RTL-CONFIG version: $VERSION"
	    echo "#      RTLINUX version: `$CALL_MYSELF_W --rtlVersion`"
	    echo "#        LINUX version: `$CALL_MYSELF_W --linuxVersion`"
	    echo "#"
	    echo "# Copyright (C) 2000, Finite State Machine Labs, Inc."
	    echo
	    echo CC = `$CALL_MYSELF_W --cc`
	    echo ARCH = `$CALL_MYSELF_W --arch`
	    echo RTL_DIR = `$CALL_MYSELF_W --prefix`
	    echo RTLINUX_DIR = `$CALL_MYSELF_W --linux`
	    echo INCLUDE = `$CALL_MYSELF_W --rtinclude`
	    echo CXXFLAGS = `$CALL_MYSELF_W --cppflags`
	    echo CFLAGS = `$CALL_MYSELF_W --cflags`
	    exit 0
	    ;;
	--help|-h)
	    usage 1 1
	    exit 0
	    ;;
	--docs)
	    LIST=$DOC_DIRS
	    SEPARATOR=""
	    rtl_parse_list
	    ;;
	--module_dir)
	    LIST=$MODULES_DIR
	    SEPARATOR=""
	    rtl_parse_list
	    ;;
	--modules)
	    TMP_DIR=`pwd`
	    LIST=$MODULES_DIR
	    clean_list
	    cd $LIST
    	    for modules in *.o
	    do
		if [ ! $modules = "lib*.a" ]; then
		    TEMP=`echo $modules | sed -e s/"\.o"$//`
		    STRING="$STRING $TEMP"
		fi
	    done
	    cd $TMP_DIR
	    ;;
	--linux)
	    LIST=$RTLINUX_DIR
	    clean_list
	    STRING=$LIST
	    ;;	
	--prefix)
	    LIST=$RTL_DIR
	    clean_list
	    STRING=$LIST
	    ;;
	--arch)
	    STRING=$ARCH
	    ;;
	--cc)
	    STRING=$CC
	    ;;
	--cflags)
	    STRING="$CFLAGS"
	    ;;
	--cppflags)
	    STRING="$CXXFLAGS"
	    ;;
	--rtinclude)
	    LIST=$INCLUDE_DIR
	    SEPARATOR="-I"
	    rtl_parse_list
	    ;;
	--include)
	    LIST=$USER_INC_DIR
	    SEPARATOR="-I"
	    rtl_parse_list
	    ;;
	--libs)
	    TMP_DIR=`pwd`
	    LIST=$LIBS_DIR         
	    SEPARATOR="-L"
	    rtl_parse_list      # parse list of directories, append -L's
	    # find all libraries within these directories
	    for libdirs in $STRING
	    do
		TEMP_LIBS_DIR=`echo $libdirs | sed -e s/^-L//`
		cd $TEMP_LIBS_DIR
		for libs in lib*.a
		do
		    if [ ! $libs = "lib*.a" ]; then
			TEMP=`echo $libs | sed -e s/^lib/-l/ -e s/"\.a"//`
			STRING="$STRING $TEMP"
		    fi
		done
	    done
	    cd $TMP_DIR
	    ;;
	--rtlVersion)
	    STRING="$RTL_VERSION_MAJOR.$RTL_VERSION_MINOR"
	    if [ $RTL_VERSION_EXTRA ]; then
	       STRING="$STRING-$RTL_VERSION_EXTRA"
	    fi
	    ;;
	--linuxVersion)
	    STRING="$LINUX_VERSION.$LINUX_PATCHLEVEL.$LINUX_SUBLEVEL"
	    if [ $LINUX_EXTRAVERSION ]; then
	       STRING="$STRING-$LINUX_EXTRAVERSION"
	    fi
	    ;;
	*)
	    usage 1 1
	    exit 1
	    ;;
    esac
    OUTPUT_STRING="$OUTPUT_STRING $STRING"
done

# Print  our necessary information
echo $OUTPUT_STRING

# Exit gracefully
exit 0