9bc107403654f689fba369edb097d7dd2f3825c6
[fw/altos] / altosui / Makefile.am
1
2 JAVAROOT=classes
3 AM_JAVACFLAGS=-target 1.6 -encoding UTF-8 -Xlint:deprecation -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_BT = \
14         AltosBTDevice.java \
15         AltosBTDeviceIterator.java \
16         AltosBTManage.java \
17         AltosBTKnown.java
18
19 altosui_JAVA = \
20         GrabNDrag.java \
21         AltosAscent.java \
22         AltosChannelMenu.java \
23         AltosCompanionInfo.java \
24         AltosConfig.java \
25         AltosConfigFreqUI.java \
26         AltosConfigUI.java \
27         AltosConfigPyroUI.java \
28         AltosConfigureUI.java \
29         AltosConfigTD.java \
30         AltosConfigTDUI.java \
31         AltosCSV.java \
32         AltosCSVUI.java \
33         AltosDescent.java \
34         AltosDeviceUIDialog.java \
35         AltosDisplayThread.java \
36         AltosEepromDelete.java \
37         AltosEepromManage.java \
38         AltosEepromMonitorUI.java \
39         AltosEepromSelect.java \
40         AltosFlashUI.java \
41         AltosFlightDisplay.java \
42         AltosFlightInfoTableModel.java \
43         AltosFlightStats.java \
44         AltosFlightStatsTable.java \
45         AltosFlightStatus.java \
46         AltosFlightStatusUpdate.java \
47         AltosFlightUI.java \
48         AltosFreqList.java \
49         Altos.java \
50         AltosIdleMonitorUI.java \
51         AltosIgniteUI.java \
52         AltosLaunch.java \
53         AltosLaunchUI.java \
54         AltosInfoTable.java \
55         AltosKML.java \
56         AltosLanded.java \
57         AltosLed.java \
58         AltosLights.java \
59         AltosPad.java \
60         AltosUIPreferencesBackend.java \
61         AltosRomconfigUI.java \
62         AltosScanUI.java \
63         AltosSerial.java \
64         AltosSerialInUseException.java \
65         AltosSiteMap.java \
66         AltosSiteMapPreload.java \
67         AltosSiteMapCache.java \
68         AltosSiteMapTile.java \
69         AltosUI.java \
70         AltosWriter.java \
71         AltosGraph.java \
72         AltosGraphDataPoint.java \
73         AltosGraphDataSet.java \
74         AltosGraphUI.java \
75         AltosDataChooser.java \
76         AltosVoice.java \
77         $(altosui_BT)
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 ALTOSLIB_CLASS=\
95         altoslib_$(ALTOSLIB_VERSION).jar
96
97 ALTOSUILIB_CLASS=\
98         altosuilib_$(ALTOSUILIB_VERSION).jar
99
100 LIBALTOS= \
101         libaltos32.so \
102         libaltos64.so \
103         libaltos.dylib \
104         altos.dll
105
106 JAR=altosui.jar
107
108 FATJAR=altosui-fat.jar
109
110 # Icons
111 ICONDIR=$(top_srcdir)/icon
112
113 JAVA_ICONS=\
114         $(ICONDIR)/altus-metrum-16.png \
115         $(ICONDIR)/altus-metrum-32.png \
116         $(ICONDIR)/altus-metrum-48.png \
117         $(ICONDIR)/altus-metrum-64.png \
118         $(ICONDIR)/altus-metrum-128.png \
119         $(ICONDIR)/altus-metrum-256.png
120
121 ICONS=  $(ICONDIR)/redled.png $(ICONDIR)/redoff.png \
122         $(ICONDIR)/greenled.png $(ICONDIR)/greenoff.png \
123         $(ICONDIR)/grayled.png $(ICONDIR)/grayoff.png
124
125 # icon base names for jar
126 ICONJAR= -C $(ICONDIR) altus-metrum-16.png \
127         -C $(ICONDIR) altus-metrum-32.png \
128         -C $(ICONDIR) altus-metrum-48.png \
129         -C $(ICONDIR) altus-metrum-64.png \
130         -C $(ICONDIR) altus-metrum-128.png \
131         -C $(ICONDIR) altus-metrum-256.png \
132         -C $(ICONDIR) redled.png -C $(ICONDIR) redoff.png \
133         -C $(ICONDIR) greenled.png -C $(ICONDIR) greenoff.png \
134         -C $(ICONDIR) grayon.png -C $(ICONDIR) grayled.png
135
136 WINDOWS_ICON=$(ICONDIR)/altus-metrum.ico
137
138 # Firmware
139 FIRMWARE_TD_0_2=$(top_srcdir)/src/teledongle-v0.2/teledongle-v0.2-$(VERSION).ihx
140 FIRMWARE_TD=$(FIRMWARE_TD_0_2)
141
142 FIRMWARE_TM_1_0=$(top_srcdir)/src/telemetrum-v1.0/telemetrum-v1.0-$(VERSION).ihx
143 FIRMWARE_TM_1_1=$(top_srcdir)/src/telemetrum-v1.1/telemetrum-v1.1-$(VERSION).ihx
144 FIRMWARE_TM_1_2=$(top_srcdir)/src/telemetrum-v1.2/telemetrum-v1.2-$(VERSION).ihx
145 FIRMWARE_TM=$(FIRMWARE_TM_1_0) $(FIRMWARE_TM_1_1) $(FIRMWARE_TM_1_2)
146
147 FIRMWARE_TELEMINI_1_0=$(top_srcdir)/src/telemini-v1.0/telemini-v1.0-$(VERSION).ihx
148 FIRMWARE_TELEMINI=$(FIRMWARE_TELEMINI_1_0)
149
150 FIRMWARE_TBT_1_0=$(top_srcdir)/src/telebt-v1.0/telebt-v1.0-$(VERSION).ihx
151 FIRMWARE_TBT=$(FIRMWARE_TBT_1_0)
152
153 FIRMWARE_TMEGA_1_0=$(top_srcdir)/src/telemega-v1.0/telemega-v1.0-$(VERSION).ihx
154 FIRMWARE_TMEGA=$(FIRMWARE_TMEGA_1_0)
155
156 FIRMWARE_EMINI_1_0=$(top_srcdir)/src/easymini-v1.0/easymini-v1.0-$(VERSION).ihx
157 FIRMWARE_EMINI=$(FIRMWARE_EMINI_1_0)
158
159 FIRMWARE=$(FIRMWARE_TM) $(FIRMWARE_TELEMINI) $(FIRMWARE_TD) $(FIRMWARE_TBT) $(FIRMWARE_TMEGA) $(FIRMWARE_EMINI)
160
161 ALTUSMETRUM_DOC=$(top_srcdir)/doc/altusmetrum.pdf
162 ALTOS_DOC=$(top_srcdir)/doc/altos.pdf
163 TELEMETRY_DOC=$(top_srcdir)/doc/telemetry.pdf
164 TEMPLATE_DOC=\
165         $(top_srcdir)/doc/telemetrum-outline.pdf \
166         $(top_srcdir)/doc/easymini-outline.pdf \
167         $(top_srcdir)/doc/telemega-outline.pdf \
168         $(top_srcdir)/doc/easymini-outline.pdf
169
170 DOC=$(ALTUSMETRUM_DOC) $(ALTOS_DOC) $(TELEMETRY_DOC) $(TEMPLATE_DOC)
171
172 # Distribution targets
173 LINUX_DIST=Altos-Linux-$(VERSION).tar.bz2
174 MACOSX_DIST=Altos-Mac-$(VERSION).dmg
175 WINDOWS_DIST=Altos-Windows-$(VERSION_DASH).exe
176
177 FAT_FILES=$(FATJAR) $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS_CLASS) $(JFREECHART_CLASS) $(JCOMMON_CLASS)
178
179 LINUX_LIBS=libaltos32.so libaltos64.so
180
181 LINUX_FILES=$(FAT_FILES) $(LINUX_LIBS) $(FIRMWARE) $(DOC)
182 LINUX_EXTRA=altosui-fat
183
184 MACOSX_INFO_PLIST=Info.plist
185 MACOSX_FILES=$(FAT_FILES) libaltos.dylib $(MACOSX_INFO_PLIST) $(DOC) ReadMe-Mac.rtf
186 MACOSX_EXTRA=$(FIRMWARE)
187
188 WINDOWS_FILES=$(FAT_FILES) altos.dll altos64.dll $(top_srcdir)/telemetrum.inf $(WINDOWS_ICON)
189
190 all-local: classes/altosui $(JAR) altosui altosui-test altosui-jdb
191
192 clean-local:
193         -rm -rf classes $(JAR) $(FATJAR) \
194                 $(LINUX_DIST) $(MACOSX_DIST) windows $(WINDOWS_DIST) $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS_CLASS) \
195                 $(JFREECHART_CLASS) $(JCOMMON_CLASS) $(LIBALTOS) Manifest.txt Manifest-fat.txt altos-windows.log altos-windows.nsi \
196                 altosui altosui-test altosui-jdb macosx linux
197
198 if FATINSTALL
199
200 FATTARGET=$(FATDIR)/$(VERSION)
201
202 LINUX_DIST_TARGET=$(FATTARGET)/$(LINUX_DIST)
203 MACOSX_DIST_TARGET=$(FATTARGET)/$(MACOSX_DIST)
204 WINDOWS_DIST_TARGET=$(FATTARGET)/$(WINDOWS_DIST)
205
206 fat: $(LINUX_DIST_TARGET) $(MACOSX_DIST_TARGET) $(WINDOWS_DIST_TARGET)
207
208 $(LINUX_DIST_TARGET): $(LINUX_DIST)
209         mkdir -p $(FATTARGET)
210         cp -p $< $@
211
212 $(MACOSX_DIST_TARGET): $(MACOSX_DIST)
213         mkdir -p $(FATTARGET)
214         cp -p $< $@
215
216 $(WINDOWS_DIST_TARGET): $(WINDOWS_DIST)
217         mkdir -p $(FATTARGET)
218         cp -p $< $@
219
220 else
221 fat: $(LINUX_DIST) $(MACOSX_DIST) $(WINDOWS_DIST)
222 endif
223
224
225 altosuidir=$(datadir)/java
226
227 install-altosuiJAVA: altosui.jar
228         @$(NORMAL_INSTALL)
229         test -z "$(altosuidir)" || $(MKDIR_P) "$(DESTDIR)$(altosuidir)"
230         echo " $(INSTALL_DATA)" "$<" "'$(DESTDIR)$(altosuidir)/altosui.jar'"; \
231         $(INSTALL_DATA) "$<" "$(DESTDIR)$(altosuidir)"
232
233 classes/altosui:
234         mkdir -p classes/altosui
235
236 $(JAR): classaltosui.stamp Manifest.txt $(JAVA_ICONS) $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS)
237         jar cfm $@ Manifest.txt \
238                 $(ICONJAR) \
239                 -C classes altosui \
240                 -C ../libaltos libaltosJNI
241
242 $(FATJAR): classaltosui.stamp Manifest-fat.txt $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS_CLASS) $(JFREECHART_CLASS) $(JCOMMON_CLASS) $(LIBALTOS) $(JAVA_ICONS)
243         jar cfm $@ Manifest-fat.txt \
244                 $(ICONJAR) \
245                 -C classes altosui \
246                 -C ../libaltos libaltosJNI
247
248 Manifest.txt: Makefile
249         echo 'Main-Class: altosui.AltosUI' > $@
250         echo "Class-Path: $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS)/freetts.jar $(JCOMMON)/jcommon.jar $(JFREECHART)/jfreechart.jar" >> $@
251
252 Manifest-fat.txt:
253         echo 'Main-Class: altosui.AltosUI' > $@
254         echo "Class-Path: $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) freetts.jar jcommon.jar jfreechart.jar" >> $@
255
256 altosui: Makefile
257         echo "#!/bin/sh" > $@
258         echo 'exec java -Djava.library.path="$(altoslibdir)" -jar "$(altosuidir)/altosui.jar" "$$@"' >> $@
259         chmod +x $@
260
261 altosui-test: Makefile
262         echo "#!/bin/sh" > $@
263         echo 'exec java -Djava.library.path="../libaltos/.libs" -jar altosui.jar "$$@"' >> $@
264         chmod +x $@
265
266 altosui-jdb: Makefile
267         echo "#!/bin/sh" > $@
268         echo 'exec jdb -classpath "classes:./*:../libaltos:$(FREETTS)/freetts.jar:$(JCOMMON)/jcommon.jar:$(JFREECHART)/jfreechart.jar" -Djava.library.path="../libaltos/.libs" altosui/AltosUI "$$@"' >> $@
269         chmod +x $@
270
271 libaltos32.so: build-libaltos
272         -rm -f "$@"
273         $(LN_S) ../libaltos/.libs/"$@" .
274
275 libaltos64.so: build-libaltos
276         -rm -f "$@"
277         $(LN_S) ../libaltos/.libs/"$@" .
278
279 libaltos.dylib:
280         -rm -f "$@"
281         $(LN_S) ../libaltos/"$@" .
282
283 altos.dll: ../libaltos/altos.dll
284         -rm -f "$@"
285         $(LN_S) ../libaltos/"$@" .
286
287 altos64.dll: ../libaltos/altos64.dll
288         -rm -f "$@"
289         $(LN_S) ../libaltos/"$@" .
290
291 ../libaltos/.libs/libaltos64.so: ../libaltos/.libs/libaltos32.so
292
293 ../libaltos/.libs/libaltos32.so: build-libaltos
294
295 ../libaltos/altos.dll: build-altos-dll
296
297 ../libaltos/altos64.dll: build-altos64-dll
298
299 build-libaltos:
300         +cd ../libaltos && make libaltos.la
301 build-altos-dll:
302         +cd ../libaltos && make altos.dll
303
304 build-altos64-dll:
305         +cd ../libaltos && make altos64.dll
306
307 $(ALTOSLIB_CLASS):
308         -rm -f "$@"
309         $(LN_S) ../altoslib/"$@" .
310
311 $(ALTOSUILIB_CLASS):
312         -rm -f "$@"
313         $(LN_S) ../altosuilib/"$@" .
314
315 $(FREETTS_CLASS):
316         -rm -f "$@"
317         $(LN_S) "$(FREETTS)"/"$@" .
318
319 $(JFREECHART_CLASS):
320         -rm -f "$@"
321         $(LN_S) "$(JFREECHART)"/"$@" .
322
323 $(JCOMMON_CLASS):
324         -rm -f "$@"
325         $(LN_S) "$(JCOMMON)"/"$@" .
326
327 $(LINUX_DIST): $(LINUX_FILES) $(LINUX_EXTRA)
328         -rm -f $@
329         -rm -rf linux
330         mkdir -p linux/AltOS
331         cp -p $(LINUX_FILES) linux/AltOS
332         cp -p altosui-fat linux/AltOS/altosui
333         chmod +x linux/AltOS/altosui
334         tar cjf $@ -C linux AltOS
335
336 $(MACOSX_DIST): $(MACOSX_FILES) $(MACOSX_EXTRA) Makefile
337         -rm -f $@
338         -rm -rf macosx
339         mkdir macosx
340         cp -a AltosUI.app macosx/
341         cp -a ReadMe-Mac.rtf macosx/ReadMe.rtf
342         mkdir -p macosx/Doc
343         cp -a $(DOC) macosx/Doc
344         cp -p Info.plist macosx/AltosUI.app/Contents
345         mkdir -p macosx/AltOS-$(VERSION) macosx/AltosUI.app/Contents/Resources/Java
346         cp -p $(FATJAR) macosx/AltosUI.app/Contents/Resources/Java/altosui.jar
347         cp -p libaltos.dylib macosx/AltosUI.app/Contents/Resources/Java
348         cp -p $(ALTOSLIB_CLASS) macosx/AltosUI.app/Contents/Resources/Java
349         cp -p $(ALTOSUILIB_CLASS) macosx/AltosUI.app/Contents/Resources/Java
350         cp -p $(FREETTS_CLASS) macosx/AltosUI.app/Contents/Resources/Java
351         cp -p $(JFREECHART_CLASS) macosx/AltosUI.app/Contents/Resources/Java
352         cp -p $(JCOMMON_CLASS) macosx/AltosUI.app/Contents/Resources/Java
353         cp -p $(MACOSX_EXTRA) macosx/AltOS-$(VERSION)
354         genisoimage -D -V AltOS-$(VERSION) -no-pad -r -apple -o $@ macosx
355
356 $(WINDOWS_DIST): $(WINDOWS_FILES) altos-windows.nsi
357         -rm -f $@
358         makensis -Oaltos-windows.log "-XOutFile $@" "-DVERSION=$(VERSION)" altos-windows.nsi
359