b6b2e572c205f0655d9d4fc307cb8863262442b5
[fw/altos] / ao-tools / altosui / Makefile.am
1 JAVAROOT=classes
2 AM_JAVACFLAGS=-encoding UTF-8
3
4 man_MANS=altosui.1
5
6 altoslibdir=$(libdir)/altos
7
8 CLASSPATH_ENV=mkdir -p $(JAVAROOT); CLASSPATH=".:classes:../libaltos:$(FREETTS)/*:/usr/share/java/*"
9
10 bin_SCRIPTS=altosui
11
12 altosui_JAVA = \
13         AltosAscent.java \
14         AltosChannelMenu.java \
15         AltosConfig.java \
16         AltosConfigUI.java \
17         AltosConfigureUI.java \
18         AltosConvert.java \
19         AltosCRCException.java \
20         AltosCSV.java \
21         AltosCSVUI.java \
22         AltosDebug.java \
23         AltosDescent.java \
24         AltosDeviceDialog.java \
25         AltosDevice.java \
26         AltosDisplayThread.java \
27         AltosEepromDownload.java \
28         AltosEepromMonitor.java \
29         AltosEepromIterable.java \
30         AltosEepromRecord.java \
31         AltosFile.java \
32         AltosFlash.java \
33         AltosFlashUI.java \
34         AltosFlightDisplay.java \
35         AltosFlightInfoTableModel.java \
36         AltosFlightReader.java \
37         AltosFlightStatus.java \
38         AltosFlightUI.java \
39         AltosGPS.java \
40         AltosGreatCircle.java \
41         AltosHexfile.java \
42         Altos.java \
43         AltosInfoTable.java \
44         AltosKML.java \
45         AltosLanded.java \
46         AltosLed.java \
47         AltosLights.java \
48         AltosLine.java \
49         AltosLogfileChooser.java \
50         AltosLog.java \
51         AltosPad.java \
52         AltosParse.java \
53         AltosPreferences.java \
54         AltosReader.java \
55         AltosRecord.java \
56         AltosRecordIterable.java \
57         AltosTelemetryReader.java \
58         AltosReplayReader.java \
59         AltosRomconfig.java \
60         AltosRomconfigUI.java \
61         AltosSerial.java \
62         AltosSerialInUseException.java \
63         AltosSerialMonitor.java \
64         AltosSiteMap.java \
65         AltosSiteMapTile.java \
66         AltosState.java \
67         AltosTelemetry.java \
68         AltosTelemetryIterable.java \
69         AltosUI.java \
70         AltosWriter.java \
71         AltosDataPointReader.java \
72         AltosDataPoint.java \
73         AltosGraph.java \
74         AltosGraphTime.java \
75         AltosGraphUI.java \
76         AltosGraphDataChooser.java \
77         AltosVoice.java
78
79 JFREECHART_CLASS= \
80     jfreechart.jar
81
82 JCOMMON_CLASS=\
83     jcommon.jar
84
85 FREETTS_CLASS= \
86         cmudict04.jar \
87         cmulex.jar \
88         cmu_time_awb.jar \
89         cmutimelex.jar \
90         cmu_us_kal.jar \
91         en_us.jar \
92         freetts.jar
93
94 LIBALTOS= \
95         libaltos.so \
96         libaltos.dylib \
97         altos.dll
98
99 JAR=altosui.jar
100
101 FATJAR=altosui-fat.jar
102
103 # Icons
104 ICONDIR=$(top_srcdir)/icon
105
106 JAVA_ICON=$(ICONDIR)/altus-metrum-16x16.jpg
107
108 ICONS=  $(ICONDIR)/redled.png $(ICONDIR)/redoff.png \
109         $(ICONDIR)/greenled.png $(ICONDIR)/greenoff.png \
110         $(ICONDIR)/grayled.png $(ICONDIR)/grayoff.png
111
112 # icon base names for jar
113 ICONJAR= -C $(ICONDIR) altus-metrum-16x16.jpg \
114         -C $(ICONDIR) redled.png -C $(ICONDIR) redoff.png \
115         -C $(ICONDIR) greenled.png -C $(ICONDIR) greenoff.png \
116         -C $(ICONDIR) grayon.png -C $(ICONDIR) grayled.png
117
118 WINDOWS_ICON=$(ICONDIR)/altus-metrum.ico
119
120 # Firmware
121 FIRMWARE_TD=$(top_srcdir)/src/teledongle-v0.2-$(VERSION).ihx
122 FIRMWARE_TM=$(top_srcdir)/src/telemetrum-v1.0-$(VERSION).ihx
123 FIRMWARE=$(FIRMWARE_TM) $(FIRMWARE_TD)
124
125 # Distribution targets
126 LINUX_DIST=Altos-Linux-$(VERSION).tar.bz2
127 MACOSX_DIST=Altos-Mac-$(VERSION).zip
128 WINDOWS_DIST=Altos-Windows-$(VERSION_DASH).exe
129
130 FAT_FILES=$(FATJAR) $(FREETTS_CLASS) $(JFREECHART_CLASS) $(JCOMMON_CLASS)
131
132 LINUX_FILES=$(FAT_FILES) libaltos.so $(FIRMWARE)
133 LINUX_EXTRA=altosui-fat
134
135 MACOSX_FILES=$(FAT_FILES) libaltos.dylib
136 MACOSX_EXTRA=$(FIRMWARE)
137
138 WINDOWS_FILES=$(FAT_FILES) altos.dll $(top_srcdir)/telemetrum.inf $(WINDOWS_ICON)
139
140 all-local: classes/altosui $(JAR) altosui altosui-test altosui-jdb
141
142 clean-local:
143         -rm -rf classes $(JAR) $(FATJAR) \
144                 $(LINUX_DIST) $(MACOSX_DIST) windows $(WINDOWS_DIST) $(FREETTS_CLASS) \
145                 $(JFREECHART_CLASS) $(JCOMMON_CLASS) $(LIBALTOS) Manifest.txt Manifest-fat.txt altos-windows.log \
146                 altosui altosui-test altosui-jdb macosx linux
147
148 if FATINSTALL
149
150 FATTARGET=$(FATDIR)/$(VERSION)
151
152 LINUX_DIST_TARGET=$(FATTARGET)/$(LINUX_DIST)
153 MACOSX_DIST_TARGET=$(FATTARGET)/$(MACOSX_DIST)
154 WINDOWS_DIST_TARGET=$(FATTARGET)/$(WINDOWS_DIST)
155
156 fat: $(LINUX_DIST_TARGET) $(MACOSX_DIST_TARGET) $(WINDOWS_DIST_TARGET)
157
158 $(LINUX_DIST_TARGET): $(LINUX_DIST)
159         mkdir -p $(FATTARGET)
160         cp -p $< $@
161
162 $(MACOSX_DIST_TARGET): $(MACOSX_DIST)
163         mkdir -p $(FATTARGET)
164         cp -p $< $@
165
166 $(WINDOWS_DIST_TARGET): $(WINDOWS_DIST)
167         mkdir -p $(FATTARGET)
168         cp -p $< $@
169
170 else
171 fat: $(LINUX_DIST) $(MACOSX_DIST) $(WINDOWS_DIST)
172 endif
173
174
175 altosuidir=$(datadir)/java
176
177 install-altosuiJAVA: altosui.jar
178         @$(NORMAL_INSTALL)
179         test -z "$(altosuidir)" || $(MKDIR_P) "$(DESTDIR)$(altosuidir)"
180         echo " $(INSTALL_DATA)" "$<" "'$(DESTDIR)$(altosuidir)/altosui.jar'"; \
181         $(INSTALL_DATA) "$<" "$(DESTDIR)$(altosuidir)"
182
183 classes/altosui:
184         mkdir -p classes/altosui
185
186 $(JAR): classaltosui.stamp Manifest.txt $(JAVA_ICON)
187         jar cfm $@ Manifest.txt \
188                 $(ICONJAR) \
189                 -C classes altosui \
190                 -C ../libaltos libaltosJNI
191
192 $(FATJAR): classaltosui.stamp Manifest-fat.txt $(FREETTS_CLASS) $(JFREECHART_CLASS) $(JCOMMON_CLASS) $(LIBALTOS) $(JAVA_ICON)
193         jar cfm $@ Manifest-fat.txt \
194                 $(ICONJAR) \
195                 -C classes altosui \
196                 -C ../libaltos libaltosJNI
197
198 Manifest.txt: Makefile
199         echo 'Main-Class: altosui.AltosUI' > $@
200         echo "Class-Path: $(FREETTS)/freetts.jar $(JFREECHART)/jfreechart.jar $(JCOMMON)/jcommon.jar" >> $@
201
202 Manifest-fat.txt:
203         echo 'Main-Class: altosui.AltosUI' > $@
204         echo "Class-Path: freetts.jar jfreechart.jar jcommon.jar" >> $@
205
206 altosui: Makefile
207         echo "#!/bin/sh" > $@
208         echo 'exec java  -cp "$(FREETTS)/*:$(JFREECHART)/*:$(JCOMMON)/*" -Djava.library.path="$(altoslibdir)" -jar "$(altosuidir)/altosui.jar" "$$@"' >> $@
209         chmod +x $@
210
211 altosui-test: Makefile
212         echo "#!/bin/sh" > $@
213         echo 'exec java -cp "$(FREETTS)/*:$(JFREECHART)/*:$(JCOMMON)/*" -Djava.library.path="../libaltos/.libs" -jar altosui.jar "$$@"' >> $@
214         chmod +x $@
215
216 altosui-jdb: Makefile
217         echo "#!/bin/sh" > $@
218         echo 'exec jdb -classpath "classes:../libaltos:$(FREETTS)/*:$(JFREECHART)/*:$(JCOMMON)/*" -Djava.library.path="../libaltos/.libs" altosui/AltosUI "$$@"' >> $@
219         chmod +x $@
220
221 libaltos.so:
222         -rm -f "$@"
223         $(LN_S) ../libaltos/.libs/"$@" .
224
225 libaltos.dylib:
226         -rm -f "$@"
227         $(LN_S) ../libaltos/"$@" .
228
229 altos.dll:
230         -rm -f "$@"
231         $(LN_S) ../libaltos/"$@" .
232
233 $(FREETTS_CLASS):
234         -rm -f "$@"
235         $(LN_S) "$(FREETTS)"/"$@" .
236
237 $(JFREECHART_CLASS):
238         -rm -f "$@"
239         $(LN_S) "$(JFREECHART)"/"$@" .
240
241 $(JCOMMON_CLASS):
242         -rm -f "$@"
243         $(LN_S) "$(JCOMMON)"/"$@" .
244
245 $(LINUX_DIST): $(LINUX_FILES) $(LINUX_EXTRA)
246         -rm -f $@
247         -rm -rf linux
248         mkdir -p linux/AltOS
249         cp -p $(LINUX_FILES) linux/AltOS
250         cp -p altosui-fat linux/AltOS/altosui
251         chmod +x linux/AltOS/altosui
252         tar cjf $@ -C linux AltOS
253
254 $(MACOSX_DIST): $(MACOSX_FILES) $(MACOSX_EXTRA)
255         -rm -f $@
256         -rm -rf macosx
257         mkdir macosx
258         cp -a AltosUI.app macosx/
259         mkdir -p macosx/AltOS macosx/AltosUI.app/Contents/Resources/Java
260         cp -p $(FATJAR) macosx/AltosUI.app/Contents/Resources/Java/altosui.jar
261         cp -p $(FREETTS_CLASS) libaltos.dylib macosx/AltosUI.app/Contents/Resources/Java
262         cp -p $(JFREECHART_CLASS) libaltos.dylib macosx/AltosUI.app/Contents/Resources/Java
263         cp -p $(MACOSX_EXTRA) macosx/AltOS
264         cd macosx && zip -r ../$@ AltosUI.app AltOS
265
266 $(WINDOWS_DIST): $(WINDOWS_FILES) altos-windows.nsi
267         -rm -f $@
268         makensis -Oaltos-windows.log "-XOutFile $@" "-DVERSION=$(VERSION)" altos-windows.nsi