*** empty log message ***
[h316.git] / lib / fortran / buildlib.sh
CommitLineData
e7180669 1#!/bin/bash
2
3# Here we find the recipes for the libraries.
4RECIPE_DIR=recipe
5
6# And their file suffix
7RECIPE_SUFFIX=.recipe
8
9# Here go the new libraries
10OUTPUT_DIR=./lib
11
12# This is needed as end-of-tape block for the loader
13ENDBLOCK=$H316/snippets/endseq
14
15# Where to get the original libraries:
16ORG_LIBDIR=original
17
18# And where to store the original objects
19ORG_OBJDIR=org
20
21# The suffix for library files (in and out)
22LIB_SUFFIX=.lib
23#######################################################################
24
25
26# Clean everything up
27clean() {
28 rm -rf $OUTPUT_DIR $ORG_OBJDIR
29}
30
31# Generate org directory containing the original library objects
32make_org() {
33 if [ ! -d "$ORG_OBJDIR" ]; then
34 mkdir $ORG_OBJDIR
35 fi
36 tdir=$PWD
37 cd $ORG_OBJDIR
38627116 38 cat $tdir/$ORG_LIBDIR/*$LIB_SUFFIX | ldc -s -l
e7180669 39 cd $tdir
40}
41
42genlib(){
43 echo "Library Builder start."
44 if [ ! -d "$OUTPUT_DIR" ]; then
45 echo -n "Creating $OUTPUT_DIR:"
46 mkdir $OUTPUT_DIR && echo "Ok." || echo "FAILED!"
47 fi
48
49
50
51 RECIPE_LIST=`ls $RECIPE_DIR/*$RECIPE_SUFFIX`
52 for recipe in $RECIPE_LIST; do
53 lib=$OUTPUT_DIR/`basename $recipe $RECIPE_SUFFIX`$LIB_SUFFIX
54 echo "Building $lib:"
55 rm -f $lib
325547c4 56 export IFS="
57"
e7180669 58 for item in `cat $recipe`; do
325547c4 59 if echo $item| egrep -vq '^[[:space:]\t]*([#;])|(//).*'; then
60 item=`echo $item | egrep -o '[^[:space:]].*$'`
61 echo "appending $item."
62 cat $item >> $lib || (echo "Error! could not find:$item")
63 else
64 echo Ignoriere $item
65 fi
e7180669 66 done
67 cat $ENDBLOCK >> $lib
68 done
69}
70
71
72case $1 in
73 clean)
74 echo "Clean!"
75 clean
76 ;;
77 makeorg)
78 echo "Make org!"
79 make_org
80 ;;
81 lib)
82 echo "Build Lib!"
83 genlib
84 ;;
85 *)
86 clean
87 make_org
88 genlib
89 ;;
90esac
91