]> sigrok.org Git - sigrok-androidutils.git/blobdiff - Makefile.am
Add an 'update-device-filter' Makefile target.
[sigrok-androidutils.git] / Makefile.am
index 0524640593a01ac88af5f718182b80b3d2d08145..94209c5b8272de36df08433a45351572c3bfd18a 100644 (file)
@@ -1,22 +1,83 @@
+##
+## This file is part of the sigrok-androidutils project.
+##
+## Copyright (C) 2014 Marcus Comstedt <marcus@mc.pp.se>
+##
+## This program is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program.  If not, see <http://www.gnu.org/licenses/>.
+##
 
-pkgdata_DATA = device_filter.xml
+lib_LTLIBRARIES = libsigrokandroidutils.la
+
+libsigrokandroidutils_la_CXXFLAGS = \
+       -fno-exceptions
+
+libsigrokandroidutils_la_SOURCES = \
+       lib/jvm_glue.cpp \
+       lib/envsetup.cpp
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = lib/libsigrokandroidutils.pc
+
+library_includedir = $(includedir)/libsigrokandroidutils
+library_include_HEADERS = lib/libsigrokandroidutils.h
+noinst_HEADERS = lib/libsigrokandroidutils-internal.h
+
+dist_pkgdata_DATA = device_filter.xml
 
 jardir = $(prefix)/jar
 jar_DATA = $(UTILS_JAR) $(ANTTASKS_JAR)
 
+mvndir = $(prefix)/.m2/repository/org/sigrok/sigrok-core-android/$(BINDINGS_VERSION)
+mvn_DATA = $(SIGROK_CORE_AAR) $(SIGROK_CORE_POM)
+
 UTILS_JAR = sigrok-androidutils.jar
 
 ANTTASKS_JAR = ant/sigrok-androidutils-anttasks.jar
 
-ANTFLAGS = -Dandroid.sdk=$(ANDROID_SDK) -Dandroid.platform=$(ANDROID_PLATFORM)
+BINDINGS_VERSION = $(LIBSIGROKCXX_VERSION)
 
-all : $(UTILS_JAR) $(ANTTASKS_JAR)
+SIGROK_CORE_AAR = sigrok-core-android-$(BINDINGS_VERSION).aar
+SIGROK_CORE_POM = sigrok-core-android-$(BINDINGS_VERSION).pom
+
+ANTFLAGS = -Dandroid.sdk=$(ANDROID_SDK) -Dandroid.platform=$(ANDROID_PLATFORM) \
+       -Dprefix=$(prefix) -Dbindings.version=$(BINDINGS_VERSION)
+
+EXTRA_DIST = build.xml src ant/src ant/resources
 
 $(UTILS_JAR): always
-       @ant $(ANTFLAGS) utils
+       $(AM_V_GEN)ant -S -q $(ANTFLAGS) utils
 
 $(ANTTASKS_JAR): always
-       @ant anttasks
+       $(AM_V_GEN)ant -S -q anttasks
+
+$(SIGROK_CORE_AAR): always $(UTILS_JAR) $(ANTTASKS_JAR) $(lib_LTLIBRARIES)
+       $(AM_V_GEN)ant -S -q $(ANTFLAGS) aar
+
+$(SIGROK_CORE_POM): always
+       $(AM_V_GEN)ant -S -q $(ANTFLAGS) pom
+
+update-device-filter:
+       @echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
+       @echo "<!-- Generated via 'make update-device-filter', don't edit. -->"
+       @echo "<resources>"
+       @echo -e -n `wget 'http://sigrok.org/gitweb/?p=libsigrok.git;a=blob_plain;f=contrib/z60_libsigrok.rules' -q -O - | grep idVendor | sed 's/ATTRS{idVendor}=="\(.*\)", ATTRS{idProduct}=="\(.*\)", MODE.*/<usb-device vendor-id="\1" product-id="\2" \/>\\\n/p' | sort | uniq`
+       @echo "</resources>"
+
+clean-local:
+       -rm -rf build ant/build jni
+       -rm -f $(UTILS_JAR) $(ANTTASKS_JAR)
+       -rm -f $(SIGROK_CORE_AAR) $(SIGROK_CORE_POM) classes.jar
 
 .PHONY: always