summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@gmail.com>2013-11-22 13:49:33 -0300
committerClaudio Takahasi <claudio.takahasi@gmail.com>2013-12-23 11:36:08 -0300
commit7e3fe131156a1f0c9e9975eace473f453c32a26c (patch)
treee00ba052af48502c62c1ff3e4a7f8d5136889b2c
parentb98ffd45f5ead539c18a1c6cd85c1e284a2160c4 (diff)
build: Add initial autotools support
-rw-r--r--Makefile.am22
-rw-r--r--acinclude.m452
-rwxr-xr-xbootstrap7
-rwxr-xr-xbootstrap-configure10
-rw-r--r--configure.ac28
-rw-r--r--examples/platform/nrf51822/helloworld/hello.c33
6 files changed, 152 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..9e1fa01
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,22 @@
+AM_MAKEFLAGS = --no-print-directory
+
+bin_PROGRAMS =
+libexec_PROGRAMS =
+
+builtin_modules =
+builtin_sources =
+builtin_nodist =
+
+stack_sources = stack/ll.h stack/ll.c \
+ stack/bci.h stack/bci.c
+
+builtin_sources += examples/platform/nrf51822/helloworld/hello.c
+libexec_PROGRAMS += examples/platform/nrf51822/helloworld/hello
+
+INCLUDES = -I$(builddir)/stack
+
+CLEANFILES =
+
+MAINTAINERCLEANFILES = Makefile.in \
+ aclocal.m4 configure config.h.in config.sub config.guess \
+ ltmain.sh depcomp missing install-sh mkinstalldirs
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644
index 0000000..842d526
--- /dev/null
+++ b/acinclude.m4
@@ -0,0 +1,52 @@
+AC_DEFUN([AC_PROG_CC_PIE], [
+ AC_CACHE_CHECK([whether ${CC-cc} accepts -fPIE], ac_cv_prog_cc_pie, [
+ echo 'void f(){}' > conftest.c
+ if test -z "`${CC-cc} -fPIE -pie -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_pie=yes
+ else
+ ac_cv_prog_cc_pie=no
+ fi
+ rm -rf conftest*
+ ])
+])
+
+AC_DEFUN([COMPILER_FLAGS], [
+ if (test "${CFLAGS}" = ""); then
+ CFLAGS="-Wall"
+ fi
+ if (test "$USE_MAINTAINER_MODE" = "yes"); then
+ CFLAGS+=" -Werror -Wextra"
+ CFLAGS+=" -Wno-unused-parameter"
+ CFLAGS+=" -Wno-missing-field-initializers"
+ CFLAGS+=" -Wdeclaration-after-statement"
+ CFLAGS+=" -Wmissing-declarations"
+ CFLAGS+=" -Wredundant-decls"
+ CFLAGS+=" -Wcast-align"
+ fi
+])
+
+AC_DEFUN([AC_INIT_BLESTACK], [
+])
+
+AC_DEFUN([AC_ARG_BLESTACK], [
+ debug_enable=no
+ optimization_enable=yes
+
+ AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [enable compiling with debugging information]), [
+ debug_enable=${enableval}
+ ])
+
+ AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization], [disable code optimization]), [
+ optimization_enable=${enableval}
+ ])
+
+ if (test "${debug_enable}" = "yes" && test "${ac_cv_prog_cc_g}" = "yes"); then
+ CFLAGS="-g $CFLAGS"
+ fi
+
+ if (test "${optimization_enable}" = "no"); then
+ CFLAGS="-O0 $CFLAGS"
+ else
+ CFLAGS="-O2 $CFLAGS"
+ fi
+])
diff --git a/bootstrap b/bootstrap
new file mode 100755
index 0000000..91756f9
--- /dev/null
+++ b/bootstrap
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+aclocal && \
+ autoheader && \
+ libtoolize --automake --copy --force && \
+ automake --add-missing --copy && \
+ autoconf
diff --git a/bootstrap-configure b/bootstrap-configure
new file mode 100755
index 0000000..4ff0865
--- /dev/null
+++ b/bootstrap-configure
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if [ -f config.status ]; then
+ make maintainer-clean
+fi
+
+./bootstrap && \
+ ./configure --enable-maintainer-mode \
+ --enable-debug \
+ --disable-optimization $*
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..9f4d430
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,28 @@
+AC_PREREQ(2.60)
+AC_INIT(blestack, 0.0.1)
+
+AM_INIT_AUTOMAKE([foreign subdir-objects])
+AM_CONFIG_HEADER(config.h)
+
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+
+AM_MAINTAINER_MODE
+
+PKG_PROG_PKG_CONFIG
+
+COMPILER_FLAGS
+
+AC_INIT_BLESTACK
+
+AC_LANG_C
+
+AC_PROG_CC
+AC_PROG_CC_PIE
+AC_PROG_INSTALL
+
+AC_DISABLE_STATIC
+AC_PROG_LIBTOOL
+
+AC_ARG_BLESTACK
+
+AC_OUTPUT(Makefile)
diff --git a/examples/platform/nrf51822/helloworld/hello.c b/examples/platform/nrf51822/helloworld/hello.c
new file mode 100644
index 0000000..d86d5ee
--- /dev/null
+++ b/examples/platform/nrf51822/helloworld/hello.c
@@ -0,0 +1,33 @@
+/**
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2013 Paulo B. de Oliveira Filho <pauloborgesfilho@gmail.com>
+ * Copyright (c) 2013 Claudio Takahasi <claudio.takahasi@gmail.com>
+ * Copyright (c) 2013 João Paulo Rechi Vita <jprvita@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <stdio.h>
+
+int main(void)
+{
+ printf("Hello World!\n");
+ return 0;
+}