Added initial make build support into new scripts/ folder.

Moved temp sensor example into examples/temp_sensor.
Added basic make example in examples/make_example.
This commit is contained in:
Greg Williams
2015-04-07 13:37:51 -04:00
parent 78beb078c1
commit a86c281824
92 changed files with 302 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
CC ?= gcc
BUILD_DIR ?= ./build
SRC_DIR ?= ./src
TEST_DIR ?= ./test
#UNITY_DIR ?= ../../vendor/cmock/vendor/unity
#CMOCK_DIR ?= ../..
TEST_BUILD_DIR ?= ${BUILD_DIR}/test
TEST_MAKEFILE = ${TEST_BUILD_DIR}/MakefileTestSupport
OBJ ?= ${BUILD_DIR}/obj
OBJ_DIR = ${OBJ}
default: all
all: setup test ${BUILD_DIR}/main run
setup:
mkdir -p ${BUILD_DIR}
mkdir -p ${OBJ}
ruby ../../scripts/create_makefile.rb
clean:
rm -rf ${BUILD_DIR}
${BUILD_DIR}/main: ${SRC_DIR}/main.c ${SRC_DIR}/foo.c
${CC} $< -o $@
run:
./build/main
test: setup
-include ${TEST_MAKEFILE}
+5
View File
@@ -0,0 +1,5 @@
#include "foo.h"
void foo_init(void)
{
}
+5
View File
@@ -0,0 +1,5 @@
#ifndef _foo_h
void foo_init(void);
#endif
+15
View File
@@ -0,0 +1,15 @@
#include <stdio.h>
#include "foo.h"
int real_main(int argc, char ** argv)
{
printf("Hello world!\n");
return 0;
}
#ifndef TEST
int main(int argc, char ** argv)
{
return real_main(argc, argv);
}
#endif
+17
View File
@@ -0,0 +1,17 @@
#include "unity.h"
#include "foo.h"
void setUp(void)
{
}
void tearDown(void)
{
}
void test_foo_init_should_initialize_multiplier()
{
foo_init();
TEST_ASSERT_FALSE(1);
}
+15
View File
@@ -0,0 +1,15 @@
#include "unity.h"
#include "mock_foo.h"
void setUp(void)
{
}
void tearDown(void)
{
}
void test_main_should_initialize_foo(void)
{
TEST_IGNORE_MESSAGE("TODO: Implement main!");
}