]> git.gag.com Git - fw/altos/blob - micropeak/Makefile.am
Merge branch 'branch-1.9' into debian
[fw/altos] / micropeak / Makefile.am
1 JAVAROOT=classes
2 AM_JAVACFLAGS=$(JAVAC_VERSION_FLAGS) -encoding UTF-8 -Xlint:deprecation -Xlint:unchecked
3
4 man_MANS=micropeak.1
5
6 altoslibdir=$(libdir)/altos
7
8 CLASSPATH_ENV=mkdir -p $(JAVAROOT); CLASSPATH=".:classes:../altoslib/*:../altosuilib/*:../libaltos:$(JCOMMON)/jcommon.jar:$(JFREECHART)/jfreechart.jar"
9
10 bin_SCRIPTS=micropeak
11
12 micropeakdir=$(datadir)/java
13
14 micropeak_JAVA= \
15         MicroPeak.java \
16         MicroData.java \
17         MicroDownload.java \
18         MicroExport.java \
19         MicroFile.java \
20         MicroFrame.java \
21         MicroRaw.java \
22         MicroSave.java \
23         MicroSerial.java \
24         MicroSerialLog.java \
25         MicroFileChooser.java \
26         MicroDeviceDialog.java \
27         MicroUSB.java
28
29 JFREECHART_CLASS= \
30     jfreechart.jar
31
32 JCOMMON_CLASS=\
33     jcommon.jar
34
35 JAR=micropeak.jar
36
37 FATJAR=micropeak-fat.jar
38
39 if MULTI_ARCH
40 LIBALTOS_LINUX=libaltos32.so libaltos64.so
41 else
42 LIBALTOS_LINUX=libaltos.so
43 endif
44
45 LIBALTOS= \
46         $(LIBALTOS_LINUX) \
47         libaltos.dylib \
48         altos64.dll \
49         altos.dll
50
51 ALTOSLIB_CLASS=\
52         altoslib_$(ALTOSLIB_VERSION).jar
53
54 ALTOSUILIB_CLASS=\
55         altosuilib_$(ALTOSUILIB_VERSION).jar
56
57 # Icons
58 ICONDIR=$(top_srcdir)/icon
59
60 JAVA_ICONS=\
61         $(ICONDIR)/altusmetrum-micropeak-16.png \
62         $(ICONDIR)/altusmetrum-micropeak-32.png \
63         $(ICONDIR)/altusmetrum-micropeak-48.png \
64         $(ICONDIR)/altusmetrum-micropeak-64.png \
65         $(ICONDIR)/altusmetrum-micropeak-128.png\
66         $(ICONDIR)/altusmetrum-micropeak-256.png
67
68 # icon base names for jar
69 ICONJAR= \
70         -C $(ICONDIR) altusmetrum-micropeak-16.png \
71         -C $(ICONDIR) altusmetrum-micropeak-32.png \
72         -C $(ICONDIR) altusmetrum-micropeak-48.png \
73         -C $(ICONDIR) altusmetrum-micropeak-64.png \
74         -C $(ICONDIR) altusmetrum-micropeak-128.png\
75         -C $(ICONDIR) altusmetrum-micropeak-256.png
76
77 WINDOWS_ICONS   =\
78         ../icon/altusmetrum-micropeak.ico \
79         ../icon/altusmetrum-micropeak.exe
80         ../icon/application-vnd.altusmetrum.micropeak.ico \
81         ../icon/application-vnd.altusmetrum.micropeak.ico
82
83 MACOSX_ICONS    =\
84         ../icon/altusmetrum-micropeak.icns \
85         ../icon/application-vnd.altusmetrum.micropeak.icns
86
87 LINUX_ICONS     =\
88         $(ICONDIR)/altusmetrum-micropeak.svg \
89         $(ICONDIR)/application-vnd.altusmetrum.micropeak.svg
90
91 LINUX_MIMETYPE  =\
92         $(ICONDIR)/org-altusmetrum-mimetypes.xml
93
94 desktopdir = $(datadir)/applications
95 desktop_file = altusmetrum-micropeak.desktop
96 desktop_SCRIPTS = $(desktop_file)
97
98 all-local: micropeak-test micropeak-jdb $(JAR) $(MDWN)
99
100 clean-local:
101         -rm -rf classes $(JAR) $(FATJAR) \
102                 MicroPeak-Linux-*.tar.bz2 MicroPeak-Mac-*.dmg MicroPeak-Windows-*.exe \
103                 altoslib_*.jar altosuilib_*.jar \
104                 $(JFREECHART_CLASS) $(JCOMMON_CLASS) $(LIBALTOS) Manifest.txt Manifest-fat.txt \
105                 micropeak micropeak-test micropeak-jdb macosx linux windows micropeak-windows.log \
106                 micropeak-windows.nsi *.desktop *.mdwn
107
108 EXTRA_DIST = $(desktop_file).in
109
110 $(desktop_file): $(desktop_file).in
111         sed -e 's#%bindir%#@bindir@#' -e 's#%icondir%#$(datadir)/icons/hicolor/scalable/apps#' ${srcdir}/$(desktop_file).in > $@
112         chmod +x $@
113
114 LINUX_DIST=MicroPeak-Linux-$(VERSION).tar.bz2
115 LINUX_SH=MicroPeak-Linux-$(VERSION).sh
116 MACOSX_DIST=MicroPeak-Mac-$(VERSION).dmg
117 WINDOWS_DIST=MicroPeak-Windows-$(VERSION_DASH).exe
118 MDWN=$(VERSION).mdwn
119 MDWNTMPL=mdwn.tmpl
120
121 MICROPEAK_DOC=$(top_srcdir)/doc/micropeak.pdf
122
123 DOC=$(MICROPEAK_DOC)
124
125 FAT_FILES=$(FATJAR) $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS_CLASS) $(JFREECHART_CLASS) $(JCOMMON_CLASS)
126
127 LINUX_FILES=$(FAT_FILES) $(LIBALTOS_LINUX) $(FIRMWARE) $(DOC) $(desktop_file).in $(LINUX_ICONS) $(LINUX_MIMETYPE)
128 LINUX_EXTRA=micropeak-fat $(desktop_file).in
129
130 MACOSX_DRIVER_0_URL=http://www.ftdichip.com/Drivers/VCP/MacOSX/FTDIUSBSerialDriver_v2_2_18.dmg
131 MACOSX_DRIVER_0=FTDI_v2_2_18.dmg
132
133 MACOSX_DRIVER_1_URL=http://www.ftdichip.com/Drivers/VCP/MacOSX/FTDIUSBSerialDriver_v2_3.dmg
134 MACOSX_DRIVER_1=FTDI_v2_3.dmg
135
136 MACOSX_DRIVERS=$(MACOSX_DRIVER_1) $(MACOSX_DRIVER_0)
137
138 MACOSX_INFO_PLIST=Info.plist
139 MACOSX_README=ReadMe-Mac.rtf
140 MACOSX_INSTALL=../altosui/install-macosx ../altosui/ask-pass
141 MACOSX_FILES=$(FAT_FILES) libaltos.dylib $(MACOSX_INFO_PLIST) $(MACOSX_DRIVERS) $(MACOSX_README) $(DOC) $(MACOSX_ICONS) $(MACOSX_INSTALL)
142
143 $(MACOSX_DRIVER_0):
144         wget -O $@ $(MACOSX_DRIVER_0_URL)
145
146 $(MACOSX_DRIVER_1):
147         wget -O $@ $(MACOSX_DRIVER_1_URL)
148
149 WINDOWS_DRIVER_URL=http://www.ftdichip.com/Drivers/CDM/CDM%20v2.12.00%20WHQL%20Certified.exe
150 WINDOWS_DRIVER=CDM_v2.12.00_WHQL_Certified.exe
151
152 $(WINDOWS_DRIVER):
153         wget -O "$(WINDOWS_DRIVER)" "$(WINDOWS_DRIVER_URL)"
154
155 WINDOWS_FILES=$(FAT_FILES) altos.dll altos64.dll $(DOC) $(WINDOWS_ICONS) $(WINDOWS_DRIVER)
156
157 if FATINSTALL
158
159 FATTARGET=$(FATDIR)/MicroPeak/releases/$(VERSION)
160
161 LINUX_SH_TARGET=$(FATTARGET)/$(LINUX_SH)
162 MACOSX_DIST_TARGET=$(FATTARGET)/$(MACOSX_DIST)
163 WINDOWS_DIST_TARGET=$(FATTARGET)/$(WINDOWS_DIST)
164 MDWN_TARGET=$(FATDIR)/MicroPeak/releases/$(MDWN)
165 RELNOTES=release-notes-$(VERSION).html
166 RELNOTES_SRC=$(top_builddir)/doc/$(RELNOTES)
167 RELNOTES_TARGET=$(FATTARGET)/$(RELNOTES)
168
169 fat-install: $(LINUX_SH_TARGET) $(MACOSX_DIST_TARGET) $(WINDOWS_DIST_TARGET) $(MDWN_TARGET) $(RELNOTES_TARGET)
170
171 $(LINUX_SH_TARGET): $(LINUX_SH)
172         mkdir -p $(FATTARGET)
173         cp -p $< $@
174
175 $(MACOSX_DIST_TARGET): $(MACOSX_DIST)
176         mkdir -p $(FATTARGET)
177         cp -p $< $@
178
179 $(WINDOWS_DIST_TARGET): $(WINDOWS_DIST)
180         mkdir -p $(FATTARGET)
181         cp -p $< $@
182
183 $(MDWN_TARGET): $(MDWN)
184         mkdir -p $(FATTARGET)
185         cp -p $< $@
186
187 $(RELNOTES_TARGET): $(RELNOTES_SRC)
188         mkdir -p $(FATTARGET)
189         sh $(top_srcdir)/doc/install-html -d $(FATTARGET) $(RELNOTES_SRC)
190
191 endif
192
193 $(MDWN): $(MDWNTMPL)
194         sed -e 's/%version%/$(VERSION)/g' -e 's/%version_dash%/$(VERSION_DASH)/g' $(MDWNTMPL) > $@
195
196 fat: $(LINUX_DIST) $(LINUX_SH) $(MACOSX_DIST) $(WINDOWS_DIST)
197
198
199 micropeak: Makefile
200         echo "#!/bin/sh" > $@
201         echo 'exec java  -Djava.library.path="$(altoslibdir)" -jar "$(micropeakdir)/micropeak.jar" "$$@"' >> $@
202         chmod +x $@
203
204 micropeak-jdb: Makefile
205         echo "#!/bin/sh" > $@
206         echo 'exec jdb -classpath "classes:./*:../libaltos:$(JCOMMON)/jcommon.jar:$(JFREECHART)/jfreechart.jar" -Djava.library.path="../libaltos/.libs" org.altusmetrum.micropeak.MicroPeak "$$@"' >> $@
207         chmod +x $@
208
209 micropeak-test: Makefile
210         echo "#!/bin/sh" > $@
211         echo 'exec java -cp "./*:../libaltos/*:$(JCOMMON)/jcommon.jar:$(JFREECHART)/jfreechart.jar" -Djava.library.path="../libaltos/.libs" -jar micropeak.jar "$$@"' >> $@
212         chmod +x $@
213
214 install-micropeakJAVA: micropeak.jar
215         @$(NORMAL_INSTALL)
216         test -z "$(micropeakdir)" || $(MKDIR_P) "$(DESTDIR)$(micropeakdir)"
217         echo " $(INSTALL_DATA)" "$<" "'$(DESTDIR)$(micropeakdir)/micropeak.jar'"; \
218         $(INSTALL_DATA) "$<" "$(DESTDIR)$(micropeakdir)"
219
220 $(JAR): classmicropeak.stamp Manifest.txt $(JAVA_ICONS) $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS)
221         jar cfm $@ Manifest.txt \
222                 $(ICONJAR) \
223                 -C classes org \
224                 -C ../libaltos libaltosJNI
225 if STRIP_NONDETERMINISM
226         $(STRIP_NONDETERMINISM) $@
227 endif
228
229 $(FATJAR): classmicropeak.stamp Manifest-fat.txt $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(JFREECHART_CLASS) $(JCOMMON_CLASS) $(JAVA_ICONS)
230         jar cfm $@ Manifest-fat.txt \
231                 $(ICONJAR) \
232                 -C classes org \
233                 -C ../libaltos libaltosJNI
234 if STRIP_NONDETERMINISM
235         $(STRIP_NONDETERMINISM) $@
236 endif
237
238 classaltosui.stamp: $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS)
239
240 libaltos.so: build-libaltos
241         -rm -f "$@"
242         $(LN_S) ../libaltos/.libs/"$@" .
243
244 libaltos32.so: build-libaltos
245         -rm -f "$@"
246         $(LN_S) ../libaltos/.libs/"$@" .
247
248 libaltos64.so: build-libaltos
249         -rm -f "$@"
250         $(LN_S) ../libaltos/.libs/"$@" .
251
252 libaltos.dylib:
253         -rm -f "$@"
254         $(LN_S) ../libaltos/"$@" .
255
256 altos.dll: ../libaltos/altos.dll
257         -rm -f "$@"
258         $(LN_S) ../libaltos/"$@" .
259
260 altos64.dll: ../libaltos/altos64.dll
261         -rm -f "$@"
262         $(LN_S) ../libaltos/"$@" .
263
264 ../libaltos/.libs/libaltos64.so: ../libaltos/.libs/libaltos32.so
265
266 ../libaltos/.libs/libaltos32.so: build-libaltos
267
268 ../libaltos/.libs/libaltos.so: build-libaltos
269
270 ../libaltos/altos.dll: build-altos-dll
271
272 ../libaltos/altos64.dll: build-altos64-dll
273
274 build-libaltos:
275         +cd ../libaltos && make libaltos.la
276 build-altos-dll:
277         +cd ../libaltos && make altos.dll
278
279 build-altos64-dll:
280         +cd ../libaltos && make altos64.dll
281
282 $(ALTOSLIB_CLASS):
283         -rm -f "$@"
284         $(LN_S) ../altoslib/"$@" .
285
286 $(ALTOSUILIB_CLASS):
287         -rm -f "$@"
288         $(LN_S) ../altosuilib/"$@" .
289
290 $(JFREECHART_CLASS):
291         -rm -f "$@"
292         $(LN_S) "$(JFREECHART)"/"$@" .
293
294 $(JCOMMON_CLASS):
295         -rm -f "$@"
296         $(LN_S) "$(JCOMMON)"/"$@" .
297
298 $(LINUX_DIST): $(LINUX_FILES) $(LINUX_EXTRA)
299         -rm -f $@
300         -rm -rf linux
301         mkdir -p linux/MicroPeak
302         cp -p $(LINUX_FILES) linux/MicroPeak
303         cp -p micropeak-fat linux/MicroPeak/micropeak
304         chmod +x linux/MicroPeak/micropeak
305         tar cjf $@ -C linux MicroPeak
306
307 $(LINUX_SH): $(LINUX_DIST) $(srcdir)/../altosui/linux-install.sh
308         sed 's/AltOS/MicroPeak/g' $(srcdir)/../altosui/linux-install.sh | cat - $(LINUX_DIST) > $@
309         chmod +x $@
310
311 $(MACOSX_DIST): $(MACOSX_FILES)
312         -rm -f $@
313         -rm -rf macosx
314         mkdir macosx
315         cp -a MicroPeak.app macosx/
316         cp -a $(MACOSX_README) macosx/ReadMe-MicroPeak.rtf
317         cp -a $(MACOSX_INSTALL) macosx
318         cp -a $(DOC) macosx
319         cp -p Info.plist macosx/MicroPeak.app/Contents
320         cp -p $(MACOSX_DRIVERS) macosx
321         mkdir -p macosx/MicroPeak.app/Contents/Resources/Java
322         cp -p $(MACOSX_ICONS) macosx/MicroPeak.app/Contents/Resources
323         cp -p $(FATJAR) macosx/MicroPeak.app/Contents/Resources/Java/micropeak.jar
324         cp -p libaltos.dylib macosx/MicroPeak.app/Contents/Resources/Java
325         cp -p $(ALTOSLIB_CLASS) macosx/MicroPeak.app/Contents/Resources/Java
326         cp -p $(ALTOSUILIB_CLASS) macosx/MicroPeak.app/Contents/Resources/Java
327         cp -p $(JFREECHART_CLASS) macosx/MicroPeak.app/Contents/Resources/Java
328         cp -p $(JCOMMON_CLASS) macosx/MicroPeak.app/Contents/Resources/Java
329         genisoimage -D -V MicroPeak-$(VERSION) -no-pad -r -apple -o $@ macosx
330
331 $(WINDOWS_DIST): $(WINDOWS_FILES) micropeak-windows.nsi
332         -rm -f $@
333         makensis -Omicropeak-windows.log "-XOutFile $@" "-DVERSION=$(VERSION)" micropeak-windows.nsi || (cat micropeak-windows.log && exit 1)
334
335 Manifest.txt: Makefile
336         echo 'Main-Class: org.altusmetrum.micropeak.MicroPeak' > $@
337         echo "Class-Path: $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(JCOMMON)/jcommon.jar $(JFREECHART)/jfreechart.jar" >> $@
338
339 Manifest-fat.txt:
340         echo 'Main-Class: org.altusmetrum.micropeak.MicroPeak' > $@
341         echo "Class-Path: $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) jcommon.jar jfreechart.jar" >> $@
342