summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile38
1 files changed, 38 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..c74dc92
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,38 @@
+# Makefile for Multi-Tech MTS-Azure libraries and executable
+# Copyright 2019 Multi-Tech Systems Inc. All Rights Reserved.
+# Author: David Marcaccini
+# contact: david.marcaccini@multitech.com
+
+INCLUDE_DIRS= \
+ -I./azure-iot-sdk-c/iothub_client/inc/ \
+ -I./azure-iot-sdk-c/deps/umock-c/inc/ \
+ -I./azure-iot-sdk-c/deps/azure-macro-utils-c/inc/ \
+ -I./azure-iot-sdk-c/c-utility/inc/
+
+LIB_DIRS= \
+ -L./azure-iot-sdk-c/cmake/iotsdk_linux/iothub_client/
+
+LDFLAGS= \
+ -liothub_client
+
+all: mtsazure
+
+mtsazure: src/mtsazure.c libiothub_client.so
+ bash -c "if [[ -d "./azure-iot-sdk-c/.git" ]]; then cd ./azure-iot-sdk-c; git pull; else rm -rf ./azure-iot-sdk-c; git clone --recursive https://github.com/Azure/azure-iot-sdk-c.git; fi"
+ sed -i 's/option(build_as_dynamic "build the IoT SDK libaries as dynamic" OFF)/option(build_as_dynamic "build the IoT SDK libaries as dynamic" ON)/' ./azure-iot-sdk-c/CMakeLists.txt
+ $$CC -O2 -o $@ $< $(INCLUDE_DIRS) $(LIB_DIRS) $(LDFLAGS)
+ arm-mlinux-linux-gnueabi-strip $@
+
+libiothub_client.so:
+ bash -c "source /opt/mlinux/4.0.0dev11/environment-setup-arm926ejste-mlinux-linux-gnueabi && cd ./azure-iot-sdk-c && ./build_all/linux/build.sh --toolchain-file ../toolchain.cmake;"
+
+.PHONY:
+install: mtsazure
+ mkdir -p $(DESTDIR)/usr/bin
+ cp mtsazure $(DESTDIR)/usr/bin
+ cp ./azure-iot-sdk-c/cmake/iotsdk_linux/iothub_client/libiothub_client.so $(DESTDIR)/usr/lib
+
+.PHONY:
+clean:
+ rm -rf mtsazure *.o
+