add check-c make target

This makes it easier to run locitest.
diff --git a/Makefile b/Makefile
index ab834be..63d28eb 100644
--- a/Makefile
+++ b/Makefile
@@ -89,6 +89,11 @@
 	PYTHONPATH=${LOXI_OUTPUT_DIR}/pyloxi:. python py_gen/tests/of12.py
 	PYTHONPATH=${LOXI_OUTPUT_DIR}/pyloxi:. python py_gen/tests/of13.py
 
+check-c: c
+	gcc -o ${LOXI_OUTPUT_DIR}/locitest/locitest ${LOXI_OUTPUT_DIR}/locitest/src/*.c ${LOXI_OUTPUT_DIR}/loci/src/*.c \
+		-I ${LOXI_OUTPUT_DIR}/loci/inc -I ${LOXI_OUTPUT_DIR}/locitest/inc -I ${LOXI_OUTPUT_DIR}/loci/src
+	${LOXI_OUTPUT_DIR}/locitest/locitest
+
 pylint:
 	pylint -E ${LOXI_PY_FILES}
 
diff --git a/c_gen/templates/locitest/main.c b/c_gen/templates/locitest/main.c
new file mode 100644
index 0000000..c3c9a77
--- /dev/null
+++ b/c_gen/templates/locitest/main.c
@@ -0,0 +1,42 @@
+/**
+ * @file test_main
+ *
+ * The main kickoff point for running all tests
+ */
+
+#include <locitest/unittest.h>
+#include <locitest/test_common.h>
+
+#if !defined(__APPLE__)
+#include <mcheck.h>
+#define MCHECK_INIT mcheck(NULL)
+#else /* mcheck not available under OS X */
+#define MCHECK_INIT do { } while (0)
+#endif
+
+int
+main(int argc, char *argv[])
+{
+    MCHECK_INIT;
+
+    RUN_TEST(ident_macros);
+
+    TEST_ASSERT(run_unified_accessor_tests() == TEST_PASS);
+    TEST_ASSERT(run_match_tests() == TEST_PASS);
+
+    TEST_ASSERT(run_utility_tests() == TEST_PASS);
+
+    /* These are deprecated by the unified accessor tests */
+    TEST_ASSERT(run_scalar_acc_tests() == TEST_PASS);
+    TEST_ASSERT(run_list_tests() == TEST_PASS);
+    TEST_ASSERT(run_message_tests() == TEST_PASS);
+    TEST_ASSERT(run_setup_from_add_tests() == TEST_PASS);
+
+    TEST_ASSERT(run_validator_tests() == TEST_PASS);
+
+    TEST_ASSERT(run_list_limits_tests() == TEST_PASS);
+
+    RUN_TEST(ext_objs);
+
+    return global_error;
+}
diff --git a/lang_c.py b/lang_c.py
index 4addf0a..aae08ea 100644
--- a/lang_c.py
+++ b/lang_c.py
@@ -106,4 +106,5 @@
     'locitest/src/test_setup_from_add.c': static,
     'locitest/src/test_utils.c': static,
     'locitest/src/test_validator.c': static,
+    'locitest/src/main.c': static,
 }