porting changes
[OpenFOAM-1.5.x.git] / wmake / wmakeDerivedFiles
blob9f2aa1543a9dda296dd3aa6fc49af1a67408ebf5
1 #!/bin/sh
2 #------------------------------------------------------------------------------
3 # ========= |
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / O peration |
6 # \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
7 # \\/ M anipulation |
8 #-------------------------------------------------------------------------------
9 # License
10 # This file is part of OpenFOAM.
12 # OpenFOAM is free software; you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by the
14 # Free Software Foundation; either version 2 of the License, or (at your
15 # option) any later version.
17 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
18 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 # for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with OpenFOAM; if not, write to the Free Software Foundation,
24 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 # Script
27 # wmakeDerivedFiles
29 # Description
30 # Constructs all the file list for make given the source file list
31 # (which written by hand or using makeFilesAndDirectories.)
33 #------------------------------------------------------------------------------
35 if [ ! -d "$WM_OPTIONS" ]
36 then
37 echo "The $WM_OPTIONS directory does not exist, exiting" 1>&2
38 exit 1
41 # change to the $WM_OPTIONS directory
42 cd $WM_OPTIONS 2>/dev/null || {
43 echo "Could not change to directory '$WM_OPTIONS'" 1>&2
44 exit 1
47 # Find and keep macro definitions in files list
48 grep "=" files > filesMacros
50 # Remove all macro definitions from the files list
51 grep -v "=" files > filesPlusBlank
53 # Add a newline to files to make sure the last line is followed by a newline
54 echo "" >> filesPlusBlank
56 # Search for java files in filesPlusBlank
57 nJava=`grep "\.java" filesPlusBlank | wc -l`
60 # Remove commented lines blank lines, and trailing blanks from files
61 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
62 sed -e '/^#/ d' \
63 -e '/^[ \t]*$/ d' \
64 -e 's/[ \t]*$//' \
65 filesPlusBlank > files.$$
67 rm filesPlusBlank
70 # make sourceFiles
71 # ~~~~~~~~~~~~~~~~
72 echo "SOURCE = " > tmpSourceFile
73 cat files.$$ >> tmpSourceFile
75 sed -e 's/$/\\/' \
76 -e '$s/\\//' \
77 tmpSourceFile > sourceFiles
79 rm tmpSourceFile
82 # make objectFiles
83 # ~~~~~~~~~~~~~~~~
84 if [ $nJava -ne 0 ]
85 then
86 sed -e 's%^%$(CLASSES_DIR)/%' \
87 -e 's%\.[a-zA-Z]*$%\.class%' \
88 files.$$ > tmpObjectFiles
89 else
90 sed -e 's%.*/%%' \
91 -e 's%^%$(OBJECTS_DIR)/%' \
92 -e 's%\.[a-zA-Z]*$%\.o%' \
93 files.$$ > tmpObjectFiles
96 echo "OBJECTS = " > tmpObjectFiles2
97 cat tmpObjectFiles >> tmpObjectFiles2
99 sed -e 's/$/\\/' \
100 -e '$s/\\//' \
101 tmpObjectFiles2 > objectFiles
103 rm tmpObjectFiles tmpObjectFiles2
106 # make localObjectFiles
107 # ~~~~~~~~~~~~~~~~~~~~~
108 sed -e 's%.*/%%' \
109 -e 's%\.[a-zA-Z]*$%\.o%' \
110 files.$$ > tmpLocalObjectFiles
112 echo "LOCAL_OBJECTS = " > tmpLocalObjectFiles2
113 cat tmpLocalObjectFiles >> tmpLocalObjectFiles2
115 sed -e 's/$/\\/' \
116 -e '$s/\\//' \
117 tmpLocalObjectFiles2 > localObjectFiles
119 rm tmpLocalObjectFiles tmpLocalObjectFiles2
122 # make dependencyFiles
123 # ~~~~~~~~~~~~~~~~~~~~
124 sed 's/\.[a-zA-Z]*$/\.dep/' \
125 files.$$ > tmpDependencyFiles
127 echo "DEPENDENCIES = " > tmpDependencyFiles2
128 cat tmpDependencyFiles >> tmpDependencyFiles2
130 sed -e 's/$/\\/' \
131 -e '$s/\\//' \
132 tmpDependencyFiles2 > dependencyFiles
134 rm tmpDependencyFiles tmpDependencyFiles2
137 # make includeDeps
138 # ~~~~~~~~~~~~~~~~
139 sed -e 's/\.[a-zA-Z]*$/.dep/' \
140 -e 's/^/include /' \
141 files.$$ > includeDeps
143 rm files.$$
145 cd ..
147 #------------------------------------------------------------------------------