File: subdirs

package info (click to toggle)
icmake 13.05.01-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,132 kB
  • sloc: cpp: 11,595; fortran: 883; makefile: 853; sh: 546; pascal: 342
file content (49 lines) | stat: -rw-r--r-- 1,260 bytes parent folder | download
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
# sourced by the various shell scripts

subdirs()
{
    echo Compiling in `pwd`

    [ "`find ./  -mindepth 1 -maxdepth 1 -type d -name ORG`" != "" ] && return

    count=0     # use o-file numbers to avoid name collisions

    for subdir in \ `find ./  -mindepth 1 -maxdepth 1 -type d |sort` ; do

        [ $subdir == "./xerr" ] && continue

        try cd $subdir
        srclist=`find -mindepth 1 -maxdepth 1 -type f -name '*.cc' \
                                  -exec basename '{}' ';' | sort`

        if [ "$srclist" != "" ]
        then
            for src in `find -mindepth 1 -maxdepth 1 -type f -name '*.cc' \
                                    -exec basename '{}' ';' | sort` ; do
                obj=../${count}${src%%.*}.o
                if [ $src -nt ${obj} ] ; then 
                    try ${CXX} ${CXXFLAGS} -o${obj} -c $src
                fi
            done
        fi
        try cd ..
        let count=$count+1          # next directory nr.

    done

    for src in `find -mindepth 1 -maxdepth 1 -type f -name '*.cc' \
                            -exec basename '{}' ';' | sort` ; do
        obj=${src%%.*}.o
        if [ $src -nt ${obj} ] ; then 
            try ${CXX} ${CXXFLAGS} -o${obj} -c $src
        fi
    done
}