--- /dev/null
+LIBHARDWARE?=../../../../hardware/libhardware/
+CFLAGS=-DLOG_TAG=\"sens\" -I$(LIBHARDWARE)include/ -I./linux -fPIC
+LDFLAGS=-ldl -lpthread -lm -lrt
+
+all: sensors-hal.so sens
+
+linux_src = linux/log.o
+
+sens: sens.o $(linux_src)
+ cc -o $@ $^ $(LDFLAGS)
+
+hal_src = entry.c enumeration.c control.c description.c utils.c transform.c compass-calibration.c matrix-ops.c \
+
+sensors-hal.so: $(patsubst %.c,%.o,$(hal_src) $(linux_src))
+ cc -o $@ $^ $(LDFLAGS) -shared
+
+clean:
+ -rm $(patsubst %.c,%.o,$(hal_src) $(linux_src) sens.c) sens sensors-hal.so 2>/dev/null
--- /dev/null
+/*
+ * Copyright (C) 2014 Intel Corporation.
+ */
+
+#include <stdarg.h>
+#include <syslog.h>
+
+static int log;
+
+int __android_log_print(int prio, const char *tag, const char *fmt, ...)
+{
+ va_list args;
+ int loglevel;
+
+ if (!log) {
+ openlog("android", LOG_CONS, LOG_DAEMON);
+ log = 1;
+ }
+
+ switch (prio) {
+ default:
+ case 0:
+ case 1:
+ loglevel = LOG_INFO;
+ break;
+ case 2:
+ case 3:
+ loglevel = LOG_DEBUG;
+ break;
+ case 4:
+ loglevel = LOG_NOTICE;
+ break;
+ case 5:
+ loglevel = LOG_WARNING;
+ break;
+ case 6:
+ loglevel = LOG_ERR;
+ break;
+ case 7:
+ loglevel = LOG_EMERG;
+ break;
+ }
+
+ va_start(args, fmt);
+ vsyslog(loglevel, fmt, args);
+ va_end(args);
+
+ return 0;
+}
--- /dev/null
+/*
+ * Copyright (C) 2014 Intel Corporation.
+ */
+
+#ifndef _LINUX_ALOG_H
+#define _LINUX_ALOG_H
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <linux/limits.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+
+#ifndef ALOGE
+#define ALOGE(...) ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__))
+#endif
+
+#ifndef ALOGI
+#define ALOGI(...) ((void)ALOG(LOG_INFO, LOG_TAG, __VA_ARGS__))
+#endif
+
+#ifndef ALOGD
+#define ALOGD(...) ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__))
+#endif
+
+#ifndef ALOGW
+#define ALOGW(...) ((void)ALOG(LOG_WARN, LOG_TAG, __VA_ARGS__))
+#endif
+
+#ifndef ALOGV
+#define ALOGV(...) ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
+#endif
+
+#ifndef ALOG
+#define ALOG(priority, tag, ...) \
+ LOG_PRI(ANDROID_##priority, tag, __VA_ARGS__)
+#endif
+
+#ifndef LOG_PRI
+#define LOG_PRI(priority, tag, ...) \
+ android_printLog(priority, tag, __VA_ARGS__)
+#endif
+
+#define android_printLog(prio, tag, fmt...) \
+ __android_log_print(prio, tag, fmt)
+
+typedef enum android_LogPriority {
+ ANDROID_LOG_UNKNOWN = 0,
+ ANDROID_LOG_DEFAULT, /* only for SetMinPriority() */
+ ANDROID_LOG_VERBOSE,
+ ANDROID_LOG_DEBUG,
+ ANDROID_LOG_INFO,
+ ANDROID_LOG_WARN,
+ ANDROID_LOG_ERROR,
+ ANDROID_LOG_FATAL,
+ ANDROID_LOG_SILENT, /* only for SetMinPriority(); must be last */
+} android_LogPriority;
+
+extern int __android_log_print(int prio, const char *tag, const char *fmt, ...);
+
+#endif
+