-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMake.sh
122 lines (106 loc) · 3.83 KB
/
Make.sh
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
# Make.sh = update Makefile.lib, Makefile.shlib, Makefile.list
# or style_*.h files
# Syntax: sh Make.sh style
# sh Make.sh Makefile.lib
# sh Make.sh Makefile.shlib
# sh Make.sh Makefile.list
# turn off enforced customizations
GREP_OPTIONS=
# enforce using portable C locale
LC_ALL=C
export LC_ALL GREP_OPTIONS
# function to create one style_*.h file
# must whack *.d files that depend on style_*.h file,
# else Make will not recreate them
style () {
list=`grep -sl $1 $2*.h`
if (test -e style_$3.tmp) then
rm -f style_$3.tmp
fi
for file in $list; do
qfile="\"$file\""
echo "#include $qfile" >> style_$3.tmp
done
if (test ! -e style_$3.tmp) then
if (test ! -e style_$3.h) then
touch style_$3.h
elif (test "`cat style_$3.h`" != "") then
rm -f style_$3.h
touch style_$3.h
rm -f Obj_*/$4.d
if (test $5) then
rm -f Obj_*/$5.d
fi
rm -f Obj_*/lammps.d
fi
elif (test ! -e style_$3.h) then
mv style_$3.tmp style_$3.h
rm -f Obj_*/$4.d
if (test $5) then
rm -f Obj_*/$5.d
fi
rm -f Obj_*/lammps.d
elif (test "`diff --brief style_$3.h style_$3.tmp`" != "") then
mv style_$3.tmp style_$3.h
rm -f Obj_*/$4.d
if (test $5) then
rm -f Obj_*/$5.d
fi
rm -f Obj_*/lammps.d
else
rm -f style_$3.tmp
fi
}
# create individual style files
# called by "make machine"
# col 1 = string to search for
# col 2 = search in *.h files starting with this name
# col 3 = name of style file
# col 4 = file that includes the style file
# col 5 = optional 2nd file that includes the style file
if (test $1 = "style") then
style ANGLE_CLASS angle_ angle force
style ATOM_CLASS atom_vec_ atom atom atom_vec_hybrid
style BODY_CLASS body_ body atom_vec_body
style BOND_CLASS bond_ bond force
style COMMAND_CLASS "" command input
style COMPUTE_CLASS compute_ compute modify
style DIHEDRAL_CLASS dihedral_ dihedral force
style DUMP_CLASS dump_ dump output write_dump
style FIX_CLASS fix_ fix modify
style IMPROPER_CLASS improper_ improper force
style INTEGRATE_CLASS "" integrate update
style KSPACE_CLASS "" kspace force
style MINIMIZE_CLASS min_ minimize update
style NBIN_CLASS nbin_ nbin neighbor
style NPAIR_CLASS npair_ npair neighbor
style NSTENCIL_CLASS nstencil_ nstencil neighbor
style NTOPO_CLASS ntopo_ ntopo neighbor
style PAIR_CLASS pair_ pair force
style READER_CLASS reader_ reader read_dump
style REGION_CLASS region_ region domain
# edit Makefile.lib, for creating non-shared lib
# called by "make makelib"
# use current list of *.cpp and *.h files in src dir w/out main.cpp
elif (test $1 = "Makefile.lib") then
list=`ls -1 *.cpp | sed s/^main\.cpp// | tr "[:cntrl:]" " "`
sed -i -e "s/SRC = .*/SRC = $list/" Makefile.lib
list=`ls -1 *.h | tr "[:cntrl:]" " "`
sed -i -e "s/INC = .*/INC = $list/" Makefile.lib
# edit Makefile.shlib, for creating shared lib
# called by "make makeshlib"
# use current list of *.cpp and *.h files in src dir w/out main.cpp
elif (test $1 = "Makefile.shlib") then
list=`ls -1 *.cpp | sed s/^main\.cpp// | tr "[:cntrl:]" " "`
sed -i -e "s/SRC = .*/SRC = $list/" Makefile.shlib
list=`ls -1 *.h | tr "[:cntrl:]" " "`
sed -i -e "s/INC = .*/INC = $list/" Makefile.shlib
# edit Makefile.list
# called by "make makelist"
# use current list of *.cpp and *.h files in src dir
elif (test $1 = "Makefile.list") then
list=`ls -1 *.cpp | tr "[:cntrl:]" " "`
sed -i -e "s/SRC = .*/SRC = $list/" Makefile.list
list=`ls -1 *.h | tr "[:cntrl:]" " "`
sed -i -e "s/INC = .*/INC = $list/" Makefile.list
fi