-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathMakefile
165 lines (144 loc) · 5.66 KB
/
Makefile
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
SHELL=/bin/sh
######################################################################
# GenOpt Makefile.
# This file is only needed by developers.
# It can be used to compile, document and run unit tests
# from a bash shell.
#
# [email protected] 2008-05-08
######################################################################
UNAME = $(shell uname)
# List of source code files
SRC=`find genopt -name '*.java'`
# List of class files
CLAFIL=`find src -name '*.class'`
CLAFILGO=`find genopt -name '*.class'`
# List of run time files
RUNFIL=`find example \( -name 'OutputListing*' -or -name 'GenOpt.log' \
-or -name 'eplusout.*' -or -name '*.eso' -or -name '*.audit' \
-or -name '*.err' -or -name '*.eio' -or -name '*.end' -or -name '*.csv' \
-or -name '*.svg' -or -name '*.bnd' -or -name '*.mtd' \
-or -name '*.audit' \)`
RUNDIR=`find example \( -name 'Output' -or -name 'tmp-genopt-run*' \)`
RUNDYMFIL=`find example/dymola \( -name 'dsres.mat' \
-or -name 'dslog.txt' -or -name 'dsmodel.c' -or -name 'dsfinal.txt' \
-or -name 'buildlog.txt' -or -name 'ObjectiveFunction.mat' \
-or -name 'request.' -or -name 'status' -or -name 'success' \)`
# Directory where distributable will be copied
DISDIR=dist
# List of directories with example files
EXADIR=$(shell find example/quad -maxdepth 1 \( -type d -not -name '.svn' \) )
EXADIRCON=$(shell find example/quad/constraints -maxdepth 1 \( -type d -not -name '.svn' \) )
# Root directory of GenOpt
ROODIR=$(shell pwd)
# Initialization file for examples
ifeq ($(UNAME), Darwin)
INIFIL=optMacOSX.ini
endif
ifeq ($(UNAME), Linux)
INIFIL=optLinux.ini
endif
ifeq ($(UNAME), CYGWIN_NT-5.1)
INIFIL=optWinXP.ini
endif
# Executable for izpack. IzPack is used
# to create the GenOpt installation software
ifeq ($(UNAME), Darwin)
IZPACK=/Applications/IzPack/bin/compile
else
IZPACK=izpack
endif
#export genopt-version-dot=3.0.0-beta2
export genopt-version-dot=3.1.1
export genopt-version-dash=$(shell echo $(genopt-version-dot) | sed -e 's/[.]/-/g')
### Targets of Makefile ###########################
### Compiles the GenOpt source code and the JavaDoc
all: doc jar
### Compiles the GenOpt source code
prog:
(cd src; javac -Xlint:unchecked $(SRC))
@echo "==== Made program"
### Makes the jar file
jar: prog
(cd src; jar cfm ../genopt.jar genopt/Manifest.txt $(CLAFILGO) genopt/img/* ../legal.html)
jar -i genopt.jar
@echo "==== Made jar file"
### Deletes autogenerated files
clean:
@if [ "$(CLAFIL)" != "" ]; then rm -v $(CLAFIL); fi
@if [ "$(RUNFIL)" != "" ]; then rm -v $(RUNFIL); fi
@if [ "$(RUNDIR)" != "" ]; then rm -r $(RUNDIR); fi
@if [ "$(RUNDYMFIL)" != "" ]; then rm -v $(RUNDYMFIL); fi
@echo "==== Deleted autogenerated files"
### Generate the docs
doc: doc-latex doc-java
### Generated the manual
doc-latex:
rm -f src/manual/manual.pdf
rm -f documentation/manual.pdf
(cd src/manual; ./run.sh)
cp -v src/manual/manual.pdf documentation
@echo "==== Generated manual documentation"
### generates JavaDoc html files
doc-java:
rm -f documentation/jdoc/*.html documentation/jdoc/package-list
rm -rf documentation/jdoc/genopt/*
(cd src; javadoc -Xdoclint:none -breakiterator -private -author -version \
-windowtitle "GenOpt Code Documentation" \
-bottom "<DIV CLASS="FOOTER"> <P> <CENTER> <A HREF="http://simulationresearch.lbl.gov/GO" \
TARGET=_top>GenOpt</A> | <A HREF="http://simulationresearch.lbl.gov" \
TARGET=_top>LBL SRG</A> | <A HREF="http://www.lbl.gov" \
TARGET=_top>LBL</A> </CENTER> <HR WIDTH="100%"> \
<BR> Contact: <A HREF="mailto:[email protected]">[email protected]</A> </DIV>" -d ../documentation/jdoc $(SRC))
@echo "==== Made Java documentation"
### Copies the files to the web directory
www:
cp documentation/manual.pdf ~/proj/www/genopt/GO/download/manual-$(genopt-version-dash).pdf
cp $(DISDIR)/genopt-install-$(genopt-version-dash).jar ~/proj/www/genopt/GO/download
rm -rf ~/proj/www/genopt/GO/jdoc
mkdir ~/proj/www/genopt/GO/jdoc
cp documentation/jdoc/*.html ~/proj/www/genopt/GO/jdoc/
cp documentation/jdoc/*.css ~/proj/www/genopt/GO/jdoc/
cp documentation/jdoc/package-list ~/proj/www/genopt/GO/jdoc/
cp -r documentation/jdoc/genopt ~/proj/www/genopt/GO/jdoc/
@echo "==== Copied files to web directory ~/proj/www/genopt/GO"
### unit tests
unitTest:
@if [ ! -d unitTestResults ]; then \
echo "Error. Directory unitTestResults does not exist."; \
echo "Check out directory from version control before"; \
echo "running 'make unitTest'"; \
exit 1;\
fi;
@for x in $(EXADIR) $(EXADIRCON); do \
cd "$(ROODIR)"; \
echo "++++ $$x"; \
if [ -f $$x/${INIFIL} ]; then \
if [ ${UNAME} != CYGWIN_NT-5.1 ]; then \
java -ea -classpath genopt.jar genopt.GenOpt $$x/${INIFIL}; \
else \
java -ea -classpath genopt.jar genopt.GenOpt `cygpath -w $$x/${INIFIL}`; \
fi;\
tesNam=`echo $$x | sed 's|/|-|g'`; \
sed 1,19d $$x/OutputListingAll.txt > unitTestResults/$$tesNam.txt; \
if [ "$$?" != "0" ]; then \
echo "*** Error: Unit test failed for $$x/${INIFIL}"; \
exit 1; fi; \
else \
echo "*** Nothing to run in $$x"; \
fi; \
done; \
git status unitTestResults
@echo "==== Finished unit tests";
### install program
inst:
mkdir -p $(DISDIR)
rm -f $(DISDIR)/genopt-install.jar
rm -f $(DISDIR)/genopt-install-$(genopt-version-dash).jar
cd install; \
$(IZPACK) install.xml -b . -o genopt-install-$(genopt-version-dash).jar -k standard; \
mv genopt-install-$(genopt-version-dash).jar ../$(DISDIR);
@echo "==== Made installation program in $(DISDIR)/genopt-install-$(genopt-version-dash).jar";
### distribution, including web pages
dist: clean prog doc jar inst www
@echo "==== Made distribution";