]> git.gag.com Git - fw/altos/blob - altosui/Makefile-standalone
altos: Don't include ao_pyro.h into telelco code
[fw/altos] / altosui / Makefile-standalone
1 .SUFFIXES: .java .class
2
3 CLASSPATH=classes:./*:/usr/share/java/*
4 CLASSFILES=\
5         Altos.class \
6         AltosChannelMenu.class \
7         AltosConfigFC.class \
8         AltosConfigFCUI.class \
9         AltosConvert.class \
10         AltosCRCException.class \
11         AltosCSV.class \
12         AltosCSVUI.class \
13         AltosDebug.class \
14         AltosEepromDownload.class \
15         AltosEepromMonitor.class \
16         AltosEepromReader.class \
17         AltosEepromRecord.class \
18         AltosFile.class \
19         AltosFlash.class \
20         AltosFlashUI.class \
21         AltosFlightInfoTableModel.class \
22         AltosFlightStatusTableModel.class \
23         AltosGPS.class \
24         AltosGreatCircle.class \
25         AltosHexfile.class \
26         AltosLine.class \
27         AltosInfoTable.class \
28         AltosLog.class \
29         AltosLogfileChooser.class \
30         AltosParse.class \
31         AltosPreferences.class \
32         AltosReader.class \
33         AltosRecord.class \
34         AltosSerialMonitor.class \
35         AltosSerial.class \
36         AltosState.class \
37         AltosStatusTable.class \
38         AltosTelemetry.class \
39         AltosTelemetryReader.class \
40         AltosUI.class \
41         AltosDevice.class \
42         AltosDeviceDialog.class \
43         AltosRomconfig.class \
44         AltosRomconfigUI.class \
45         AltosVoice.class
46
47 JAVA_ICONS=\
48         ../icon/altus-metrum-16.png \
49         ../icon/altus-metrum-32.png \
50         ../icon/altus-metrum-48.png \
51         ../icon/altus-metrum-64.png \
52         ../icon/altus-metrum-128.png \
53         ../icon/altus-metrum-256.png
54
55 WINDOWS_ICON=../icon/altus-metrum.ico
56
57 # where altosui.jar gets installed
58 ALTOSLIB=/usr/share/java
59
60 # where freetts.jar is to be found
61 FREETTSLIB=/usr/share/java
62
63 # all of the freetts files
64 FREETTSJAR= \
65         $(FREETTSLIB)/cmudict04.jar \
66         $(FREETTSLIB)/cmulex.jar \
67         $(FREETTSLIB)/cmu_time_awb.jar \
68         $(FREETTSLIB)/cmutimelex.jar \
69         $(FREETTSLIB)/cmu_us_kal.jar \
70         $(FREETTSLIB)/en_us.jar \
71         $(FREETTSLIB)/freetts.jar
72
73 # The current hex files
74 HEXLIB=../src
75 HEXFILES = \
76         $(HEXLIB)/telemetrum-v1.0.ihx \
77         $(HEXLIB)/teledongle-v0.2.ihx
78
79 JAVAFLAGS=-Xlint:unchecked -Xlint:deprecation
80
81 ALTOSUIJAR = altosui.jar
82 FATJAR = fat/altosui.jar
83
84 OS:=$(shell uname)
85
86 LINUX_APP=altosui
87
88 DARWIN_ZIP=Altos-Mac.zip
89
90 WINDOWS_EXE=Altos-Windows.exe
91
92 LINUX_TGZ=Altos-Linux.tgz
93
94 all: altosui.jar $(LINUX_APP)
95 fat: altosui.jar $(LINUX_APP) $(DARWIN_ZIP) $(WINDOWS_EXE) $(LINUX_TGZ)
96
97 $(CLASSFILES):
98
99 .java.class:
100         javac -encoding UTF8 -classpath "$(CLASSPATH)" $(JAVAFLAGS) $*.java
101
102 altosui.jar: classes/images classes/altosui classes/libaltosJNI $(CLASSFILES) Manifest.txt
103         cd ./classes && jar cfm ../$@ altosui/Manifest.txt images/* altosui/*.class libaltosJNI/*.class
104
105 Manifest.txt: Makefile $(CLASSFILES)
106         echo 'Main-Class: altosui.AltosUI' > $@
107         echo "Class-Path: $(FREETTSLIB)/freetts.jar" >> $@
108
109 classes/altosui:
110         mkdir -p classes
111         ln -sf .. classes/altosui
112
113 classes/libaltosJNI:
114         mkdir -p classes
115         ln -sf ../libaltos/libaltosJNI classes/libaltosJNI
116
117 classes/images:
118         mkdir -p classes/images
119         ln -sf ../$(JAVA_ICONS) classes/images
120
121 altosui:
122         echo "#!/bin/sh" > $@
123         echo "exec java -Djava.library.path=/usr/lib/altos -jar /usr/share/java/altosui.jar" >> $@
124         chmod +x ./altosui
125
126 fat/altosui:
127         echo "#!/bin/sh" > $@
128         echo 'ME=`which "$0"`' >> $@
129         echo 'DIR=`dirname "$ME"`' >> $@
130         echo 'exec java -Djava.library.path="$$DIR" -jar "$$DIR"/altosui.jar' >> $@
131         chmod +x $@
132
133 fat/altosui.jar: $(CLASSFILES) $(JAVA_ICONS) fat/classes/Manifest.txt
134         mkdir -p fat/classes
135         test -L fat/classes/altosui || ln -sf ../.. fat/classes/altosui
136         mkdir -p fat/classes/images
137         cp $(JAVA_ICONS) fat/classes/images
138         test -L fat/classes/libaltosJNI || ln -sf ../../libaltos/libaltosJNI fat/classes/libaltosJNI
139         cd ./fat/classes && jar cfm ../../$@ Manifest.txt images/* altosui/*.class libaltosJNI/*.class
140
141 fat/classes/Manifest.txt: $(CLASSFILES) Makefile
142         mkdir -p fat/classes
143         echo 'Main-Class: altosui.AltosUI' > $@
144         echo "Class-Path: freetts.jar" >> $@
145
146 install: altosui.jar altosui
147         install -m 0644 altosui.jar $(DESTDIR)/usr/share/java/altosui.jar
148         install -m 0644 altosui.1 $(DESTDIR)/usr/share/man/man1/altosui.1
149         install altosui $(DESTDIR)/usr/bin/altosui
150
151 clean:
152         rm -f *.class altosui.jar
153         rm -f AltosUI.app/Contents/Resources/Java/*
154         rm -rf classes
155         rm -rf windows linux
156
157 distclean:      clean
158         rm -f $(DARWIN_ZIP) $(WINDOWS_EXE) $(LINUX_TGZ)
159         rm -rf darwin fat
160
161 FAT_FILES=$(FATJAR) $(FREETTSJAR) $(HEXFILES)
162
163 LINUX_FILES=$(FAT_FILES) libaltos/libaltos.so fat/altosui
164 $(LINUX_TGZ): $(LINUX_FILES)
165         rm -f $@
166         mkdir -p linux/AltOS
167         rm -f linux/AltOS/*
168         cp $(LINUX_FILES) linux/AltOS
169         cd linux && tar czf ../$@ AltOS
170
171 DARWIN_RESOURCES=$(FATJAR) $(FREETTSJAR) libaltos/libaltos.dylib
172 DARWIN_EXTRA=$(HEXFILES)
173 DARWIN_FILES=$(DARWIN_RESOURCES) $(DARWIN_EXTRA)
174
175 $(DARWIN_ZIP): $(DARWIN_FILES)
176         rm -f $@
177         cp -a AltosUI.app darwin/
178         mkdir -p darwin/AltosUI.app/Contents/Resources/Java
179         cp $(DARWIN_RESOURCES) darwin/AltosUI.app/Contents/Resources/Java
180         mkdir -p darwin/AltOS
181         cp $(DARWIN_EXTRA) darwin/AltOS
182         cd darwin && zip -r ../$@ AltosUI.app AltOS
183
184 WINDOWS_FILES = $(FAT_FILES) libaltos/altos.dll ../altusmetrum.inf $(WINDOWS_ICON)
185
186 $(WINDOWS_EXE): $(WINDOWS_FILES) altos-windows.nsi
187         rm -f $@
188         mkdir -p windows/AltOS
189         rm -f windows/AltOS/*
190         cp $(WINDOWS_FILES) windows/AltOS
191         makensis altos-windows.nsi