*** 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
38 cat $tdir/$ORG_LIBDIR/*$LIB_SUFFIX | ldc -s
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
56 for item in `cat $recipe`; do
57 echo "appending $item."
58 cat $item >> $lib || (echo "Error! could not find:$item")
59 done
60 cat $ENDBLOCK >> $lib
61 done
62}
63
64
65case $1 in
66 clean)
67 echo "Clean!"
68 clean
69 ;;
70 makeorg)
71 echo "Make org!"
72 make_org
73 ;;
74 lib)
75 echo "Build Lib!"
76 genlib
77 ;;
78 *)
79 clean
80 make_org
81 genlib
82 ;;
83esac
84