altoslib: Switch distance from m/ft to km/miles for large values
[fw/altos] / altosui / Makefile.am
1
2 JAVAROOT=classes
3 AM_JAVACFLAGS=-target 1.6 -encoding UTF-8 -Xlint:deprecation -Xlint:unchecked -source 6
4
5 man_MANS=altosui.1
6
7 altoslibdir=$(libdir)/altos
8
9 CLASSPATH_ENV=mkdir -p $(JAVAROOT); CLASSPATH="$(JAVAROOT):../altoslib/*:../altosuilib/*:../libaltos:$(JCOMMON)/jcommon.jar:$(JFREECHART)/jfreechart.jar:$(FREETTS)/freetts.jar"
10
11 bin_SCRIPTS=altosui
12
13 altosui_JAVA = \
14         AltosAscent.java \
15         AltosChannelMenu.java \
16         AltosCompanionInfo.java \
17         AltosConfig.java \
18         AltosConfigUI.java \
19         AltosConfigPyroUI.java \
20         AltosConfigureUI.java \
21         AltosConfigTD.java \
22         AltosConfigTDUI.java \
23         AltosDescent.java \
24         AltosFlightStatus.java \
25         AltosFlightStatusUpdate.java \
26         AltosFlightUI.java \
27         Altos.java \
28         AltosIdleMonitorUI.java \
29         AltosIgniteUI.java \
30         AltosIgnitor.java \
31         AltosLaunch.java \
32         AltosLaunchUI.java \
33         AltosLanded.java \
34         AltosPad.java \
35         AltosUI.java \
36         AltosGraphUI.java
37
38 JFREECHART_CLASS= \
39     jfreechart.jar
40
41 JCOMMON_CLASS=\
42     jcommon.jar
43
44 FREETTS_CLASS= \
45         cmudict04.jar \
46         cmulex.jar \
47         cmu_time_awb.jar \
48         cmutimelex.jar \
49         cmu_us_kal.jar \
50         en_us.jar \
51         freetts.jar
52
53 ALTOSLIB_CLASS=\
54         altoslib_$(ALTOSLIB_VERSION).jar
55
56 ALTOSUILIB_CLASS=\
57         altosuilib_$(ALTOSUILIB_VERSION).jar
58
59 LIBALTOS= \
60         libaltos32.so \
61         libaltos64.so \
62         libaltos.dylib \
63         altos.dll
64
65 desktopdir = $(datadir)/applications
66 desktop_file = altusmetrum-altosui.desktop
67 desktop_SCRIPTS = $(desktop_file)
68
69 JAR=altosui.jar
70
71 FATJAR=altosui-fat.jar
72
73 # Icons
74 ICONDIR=../icon
75
76 JAVA_ICONS=\
77         $(ICONDIR)/altusmetrum-altosui-16.png \
78         $(ICONDIR)/altusmetrum-altosui-32.png \
79         $(ICONDIR)/altusmetrum-altosui-48.png \
80         $(ICONDIR)/altusmetrum-altosui-64.png \
81         $(ICONDIR)/altusmetrum-altosui-128.png\
82         $(ICONDIR)/altusmetrum-altosui-256.png
83
84 # icon base names for jar
85 ICONJAR= \
86         -C $(ICONDIR) altusmetrum-altosui-16.png \
87         -C $(ICONDIR) altusmetrum-altosui-32.png \
88         -C $(ICONDIR) altusmetrum-altosui-48.png \
89         -C $(ICONDIR) altusmetrum-altosui-64.png \
90         -C $(ICONDIR) altusmetrum-altosui-128.png\
91         -C $(ICONDIR) altusmetrum-altosui-256.png
92
93 WINDOWS_ICONS   =\
94         $(ICONDIR)/altusmetrum-altosui.ico \
95         $(ICONDIR)/altusmetrum-altosui.exe
96         $(ICONDIR)/application-vnd.altusmetrum.eeprom.ico \
97         $(ICONDIR)/application-vnd.altusmetrum.eeprom.exe \
98         $(ICONDIR)/application-vnd.altusmetrum.telemetry.ico \
99         $(ICONDIR)/application-vnd.altusmetrum.telemetry.exe
100
101 MACOSX_ICONS    =\
102         $(ICONDIR)/altusmetrum-altosui.icns \
103         $(ICONDIR)/application-vnd.altusmetrum.eeprom.icns \
104         $(ICONDIR)/application-vnd.altusmetrum.telemetry.icns
105
106 LINUX_ICONS     =\
107         $(ICONDIR)/altusmetrum-altosui.svg \
108         $(ICONDIR)/application-vnd.altusmetrum.eeprom.svg \
109         $(ICONDIR)/application-vnd.altusmetrum.telemetry.svg
110
111 LINUX_MIMETYPE  =\
112         $(ICONDIR)/org-altusmetrum-mimetypes.xml
113
114 # Firmware
115 FIRMWARE_TD_0_2=$(top_srcdir)/src/teledongle-v0.2/teledongle-v0.2-$(VERSION).ihx
116 FIRMWARE_TD_3_0=$(top_srcdir)/src/teledongle-v3.0/teledongle-v3.0-$(VERSION).ihx
117 FIRMWARE_TD=$(FIRMWARE_TD_0_2) $(FIRMWARE_TD_3_0)
118
119 FIRMWARE_TM_1_0=$(top_srcdir)/src/telemetrum-v1.0/telemetrum-v1.0-$(VERSION).ihx
120 FIRMWARE_TM_1_1=$(top_srcdir)/src/telemetrum-v1.1/telemetrum-v1.1-$(VERSION).ihx
121 FIRMWARE_TM_1_2=$(top_srcdir)/src/telemetrum-v1.2/telemetrum-v1.2-$(VERSION).ihx
122 FIRMWARE_TM_2_0=$(top_srcdir)/src/telemetrum-v2.0/telemetrum-v2.0-$(VERSION).ihx
123 FIRMWARE_TM=$(FIRMWARE_TM_1_0) $(FIRMWARE_TM_1_1) $(FIRMWARE_TM_1_2) $(FIRMWARE_TM_2_0)
124
125 FIRMWARE_TELEMINI_1_0=$(top_srcdir)/src/telemini-v1.0/telemini-v1.0-$(VERSION).ihx
126 FIRMWARE_TELEMINI=$(FIRMWARE_TELEMINI_1_0)
127
128 FIRMWARE_TBT_1_0=$(top_srcdir)/src/telebt-v1.0/telebt-v1.0-$(VERSION).ihx
129 FIRMWARE_TBT_3_0=$(top_srcdir)/src/telebt-v3.0/telebt-v3.0-$(VERSION).ihx
130 FIRMWARE_TBT=$(FIRMWARE_TBT_1_0) $(FIRMWARE_TBT_3_0)
131
132 FIRMWARE_TMEGA_1_0=$(top_srcdir)/src/telemega-v1.0/telemega-v1.0-$(VERSION).ihx
133 FIRMWARE_TMEGA_2_0=$(top_srcdir)/src/telemega-v2.0/telemega-v2.0-$(VERSION).ihx
134 FIRMWARE_TMEGA=$(FIRMWARE_TMEGA_1_0) $(FIRMWARE_TMEGA_2_0)
135
136 FIRMWARE_EMINI_1_0=$(top_srcdir)/src/easymini-v1.0/easymini-v1.0-$(VERSION).ihx
137 FIRMWARE_EMINI=$(FIRMWARE_EMINI_1_0)
138
139 FIRMWARE_EMEGA_1_0=$(top_srcdir)/src/easymega-v1.0/easymega-v1.0-$(VERSION).ihx
140 FIRMWARE_EMEGA=$(FIRMWARE_EMEGA_1_0)
141
142 FIRMWARE_TGPS_1_0=$(top_srcdir)/src/telegps-v1.0/telegps-v1.0-$(VERSION).ihx
143 FIRMWARE_TGPS=$(FIRMWARE_TGPS_1_0)
144
145 FIRMWARE=$(FIRMWARE_TM) $(FIRMWARE_TELEMINI) $(FIRMWARE_TD) $(FIRMWARE_TBT) $(FIRMWARE_TMEGA) $(FIRMWARE_EMINI) $(FIRMWARE_TGPS) $(FIRMWARE_EMEGA)
146
147 ALTUSMETRUM_DOC=$(top_srcdir)/doc/altusmetrum.pdf
148 ALTOS_DOC=$(top_srcdir)/doc/altos.pdf
149 TELEMETRY_DOC=$(top_srcdir)/doc/telemetry.pdf
150 TEMPLATE_DOC=\
151         $(top_srcdir)/doc/telemetrum-outline.pdf \
152         $(top_srcdir)/doc/easymini-outline.pdf \
153         $(top_srcdir)/doc/telemega-outline.pdf \
154         $(top_srcdir)/doc/telemini-outline.pdf
155
156 DOC=$(ALTUSMETRUM_DOC) $(ALTOS_DOC) $(TELEMETRY_DOC) $(TEMPLATE_DOC)
157
158 # Distribution targets
159 LINUX_DIST=Altos-Linux-$(VERSION).tar.bz2
160 LINUX_SH=Altos-Linux-$(VERSION).sh
161 MACOSX_DIST=Altos-Mac-$(VERSION).dmg
162 WINDOWS_DIST=Altos-Windows-$(VERSION_DASH).exe
163
164 FAT_FILES=$(FATJAR) $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS_CLASS) $(JFREECHART_CLASS) $(JCOMMON_CLASS)
165
166 LINUX_LIBS=libaltos32.so libaltos64.so
167
168 LINUX_FILES=$(FAT_FILES) $(LINUX_LIBS) $(FIRMWARE) $(DOC) $(desktop_file).in $(LINUX_ICONS) $(LINUX_MIMETYPE)
169 LINUX_EXTRA=altosui-fat
170
171 MACOSX_INFO_PLIST=Info.plist
172 MACOSX_FILES=$(FAT_FILES) libaltos.dylib $(MACOSX_INFO_PLIST) $(DOC) ReadMe-Mac.rtf $(MACOSX_ICONS)
173 MACOSX_EXTRA=$(FIRMWARE)
174
175 WINDOWS_FILES=$(FAT_FILES) $(FIRMWARE) altos.dll altos64.dll $(top_srcdir)/altusmetrum.inf $(top_srcdir)/altusmetrum.cat $(WINDOWS_ICONS)
176
177 all-local: classes/altosui $(JAR) altosui altosui-test altosui-jdb
178
179 clean-local:
180         -rm -rf classes $(JAR) $(FATJAR) \
181                 $(LINUX_DIST) $(LINUX_SH) $(MACOSX_DIST) windows $(WINDOWS_DIST) $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS_CLASS) \
182                 $(JFREECHART_CLASS) $(JCOMMON_CLASS) $(LIBALTOS) Manifest.txt Manifest-fat.txt altos-windows.log altos-windows.nsi \
183                 altosui altosui-test altosui-jdb macosx linux *.desktop
184
185 EXTRA_DIST = $(desktop_file).in
186
187 $(desktop_file): $(desktop_file).in
188         sed -e 's#%bindir%#@bindir@#' -e 's#%icondir%#$(datadir)/icons/hicolor/scalable/apps#' ${srcdir}/$(desktop_file).in > $@
189         chmod +x $@
190
191 if FATINSTALL
192
193 FATTARGET=$(FATDIR)/$(VERSION)
194
195 LINUX_DIST_TARGET=$(FATTARGET)/$(LINUX_DIST)
196 LINUX_SH_TARGET=$(FATTARGET)/$(LINUX_SH)
197 MACOSX_DIST_TARGET=$(FATTARGET)/$(MACOSX_DIST)
198 WINDOWS_DIST_TARGET=$(FATTARGET)/$(WINDOWS_DIST)
199
200 fat: $(LINUX_DIST_TARGET) $(LINUX_SH_TARGET) $(MACOSX_DIST_TARGET) $(WINDOWS_DIST_TARGET)
201
202 $(LINUX_DIST_TARGET): $(LINUX_DIST)
203         mkdir -p $(FATTARGET)
204         cp -p $< $@
205
206 $(LINUX_SH_TARGET): $(LINUX_SH)
207         mkdir -p $(FATTARGET)
208         cp -p $< $@
209
210 $(MACOSX_DIST_TARGET): $(MACOSX_DIST)
211         mkdir -p $(FATTARGET)
212         cp -p $< $@
213
214 $(WINDOWS_DIST_TARGET): $(WINDOWS_DIST)
215         mkdir -p $(FATTARGET)
216         cp -p $< $@
217
218 else
219 fat: $(LINUX_DIST) $(LINUX_SH) $(MACOSX_DIST) $(WINDOWS_DIST)
220 endif
221
222 altosuidir=$(datadir)/java
223
224 install-altosuiJAVA: altosui.jar
225         @$(NORMAL_INSTALL)
226         test -z "$(altosuidir)" || $(MKDIR_P) "$(DESTDIR)$(altosuidir)"
227         echo " $(INSTALL_DATA)" "$<" "'$(DESTDIR)$(altosuidir)/altosui.jar'"; \
228         $(INSTALL_DATA) "$<" "$(DESTDIR)$(altosuidir)"
229
230 classes/altosui:
231         mkdir -p classes/altosui
232
233 $(JAR): classaltosui.stamp Manifest.txt $(JAVA_ICONS) $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS)
234         jar cfm $@ Manifest.txt \
235                 $(ICONJAR) \
236                 -C classes altosui \
237                 -C ../libaltos libaltosJNI
238
239 $(FATJAR): classaltosui.stamp Manifest-fat.txt $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS_CLASS) $(JFREECHART_CLASS) $(JCOMMON_CLASS) $(LIBALTOS) $(JAVA_ICONS)
240         jar cfm $@ Manifest-fat.txt \
241                 $(ICONJAR) \
242                 -C classes altosui \
243                 -C ../libaltos libaltosJNI
244
245 Manifest.txt: Makefile
246         echo 'Main-Class: altosui.AltosUI' > $@
247         echo "Class-Path: $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS)/freetts.jar $(JCOMMON)/jcommon.jar $(JFREECHART)/jfreechart.jar" >> $@
248
249 Manifest-fat.txt:
250         echo 'Main-Class: altosui.AltosUI' > $@
251         echo "Class-Path: $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) freetts.jar jcommon.jar jfreechart.jar" >> $@
252
253 altosui: Makefile
254         echo "#!/bin/sh" > $@
255         echo 'exec java -Djava.library.path="$(altoslibdir)" -jar "$(altosuidir)/altosui.jar" "$$@"' >> $@
256         chmod +x $@
257
258 altosui-test: Makefile
259         echo '#!/bin/sh' > $@
260         echo 'dir="$$(dirname $$0)"' >> $@
261         echo 'cd "$$dir"' >> $@
262         echo 'altosui="$$(pwd -P)"' >> $@
263         echo 'altos="$$(dirname $$altosui)"' >> $@
264         echo 'exec java -Djava.library.path="$$altos/libaltos/.libs" -jar "$$altosui/altosui.jar" "$$@"' >> $@
265         chmod +x $@
266
267 altosui-jdb: Makefile
268         echo "#!/bin/sh" > $@
269         echo 'exec jdb -classpath "classes:./*:../libaltos:$(FREETTS)/freetts.jar:$(JCOMMON)/jcommon.jar:$(JFREECHART)/jfreechart.jar" -Djava.library.path="../libaltos/.libs" altosui/AltosUI "$$@"' >> $@
270         chmod +x $@
271
272 libaltos32.so: build-libaltos
273         -rm -f "$@"
274         $(LN_S) ../libaltos/.libs/"$@" .
275
276 libaltos64.so: build-libaltos
277         -rm -f "$@"
278         $(LN_S) ../libaltos/.libs/"$@" .
279
280 libaltos.dylib:
281         -rm -f "$@"
282         $(LN_S) ../libaltos/"$@" .
283
284 altos.dll: ../libaltos/altos.dll
285         -rm -f "$@"
286         $(LN_S) ../libaltos/"$@" .
287
288 altos64.dll: ../libaltos/altos64.dll
289         -rm -f "$@"
290         $(LN_S) ../libaltos/"$@" .
291
292 ../libaltos/.libs/libaltos64.so: ../libaltos/.libs/libaltos32.so
293
294 ../libaltos/.libs/libaltos32.so: build-libaltos
295
296 ../libaltos/altos.dll: build-altos-dll
297
298 ../libaltos/altos64.dll: build-altos64-dll
299
300 build-libaltos:
301         +cd ../libaltos && make libaltos.la
302 build-altos-dll:
303         +cd ../libaltos && make altos.dll
304
305 build-altos64-dll:
306         +cd ../libaltos && make altos64.dll
307
308 $(ALTOSLIB_CLASS):
309         -rm -f "$@"
310         $(LN_S) ../altoslib/"$@" .
311
312 $(ALTOSUILIB_CLASS):
313         -rm -f "$@"
314         $(LN_S) ../altosuilib/"$@" .
315
316 $(FREETTS_CLASS):
317         -rm -f "$@"
318         $(LN_S) "$(FREETTS)"/"$@" .
319
320 $(JFREECHART_CLASS):
321         -rm -f "$@"
322         $(LN_S) "$(JFREECHART)"/"$@" .
323
324 $(JCOMMON_CLASS):
325         -rm -f "$@"
326         $(LN_S) "$(JCOMMON)"/"$@" .
327
328 $(LINUX_DIST): $(LINUX_FILES) $(LINUX_EXTRA)
329         -rm -f $@
330         -rm -rf linux
331         mkdir -p linux/AltOS
332         cp -p $(LINUX_FILES) linux/AltOS
333         cp -p altosui-fat linux/AltOS/altosui
334         chmod +x linux/AltOS/altosui
335         tar cjf $@ -C linux AltOS
336
337 $(LINUX_SH): $(LINUX_DIST) linux-install.sh
338         cat linux-install.sh $(LINUX_DIST) > $@
339         chmod +x $@
340
341 $(MACOSX_DIST): $(MACOSX_FILES) $(MACOSX_EXTRA) Makefile
342         -rm -f $@
343         -rm -rf macosx
344         mkdir macosx
345         cp -a AltosUI.app macosx/
346         cp -a ReadMe-Mac.rtf macosx/ReadMe.rtf
347         mkdir -p macosx/Doc
348         cp -a $(DOC) macosx/Doc
349         cp -p Info.plist macosx/AltosUI.app/Contents
350         mkdir -p macosx/AltOS-$(VERSION) macosx/AltosUI.app/Contents/Resources/Java
351         cp -p $(MACOSX_ICONS) macosx/AltosUI.app/Contents/Resources
352         cp -p $(FATJAR) macosx/AltosUI.app/Contents/Resources/Java/altosui.jar
353         cp -p libaltos.dylib macosx/AltosUI.app/Contents/Resources/Java
354         cp -p $(ALTOSLIB_CLASS) macosx/AltosUI.app/Contents/Resources/Java
355         cp -p $(ALTOSUILIB_CLASS) macosx/AltosUI.app/Contents/Resources/Java
356         cp -p $(FREETTS_CLASS) macosx/AltosUI.app/Contents/Resources/Java
357         cp -p $(JFREECHART_CLASS) macosx/AltosUI.app/Contents/Resources/Java
358         cp -p $(JCOMMON_CLASS) macosx/AltosUI.app/Contents/Resources/Java
359         cp -p $(MACOSX_EXTRA) macosx/AltOS-$(VERSION)
360         genisoimage -D -V AltOS-$(VERSION) -no-pad -r -apple -o $@ macosx
361
362 $(WINDOWS_DIST): $(WINDOWS_FILES) altos-windows.nsi Instdrv/NSIS/Includes/java.nsh
363         -rm -f $@
364         makensis -Oaltos-windows.log "-XOutFile $@" "-DVERSION=$(VERSION)" altos-windows.nsi || (cat altos-windows.log && exit 1)