summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--Makefile3
-rw-r--r--toolchain/osx.cmake31
3 files changed, 36 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 787a9e5..c820e3f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,5 @@ ext_images/
.build-tools.cson
.gdbinit
tags
+
+*~
diff --git a/Makefile b/Makefile
index 12ee5c7..41ee486 100644
--- a/Makefile
+++ b/Makefile
@@ -32,6 +32,9 @@ endef
generic:
$(call generate_common,$@)
+osx:
+ $(call generate_common,$@)
+
cortex-m0:
$(call generate_common,$@)
diff --git a/toolchain/osx.cmake b/toolchain/osx.cmake
new file mode 100644
index 0000000..43c9ea7
--- /dev/null
+++ b/toolchain/osx.cmake
@@ -0,0 +1,31 @@
+# Name of the target
+set(CMAKE_SYSTEM_NAME Darwin)
+set(CMAKE_SYSTEM_PROCESSOR i386)
+
+# Toolchain settings
+set(CMAKE_C_COMPILER gcc)
+set(CMAKE_CXX_COMPILER g++)
+set(AS as)
+set(AR as)
+set(OBJCOPY objcopy)
+set(OBJDUMP objdump)
+set(SIZE size)
+
+set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
+
+set(CMAKE_C_FLAGS "-std=gnu99 -fdata-sections -ffunction-sections" CACHE INTERNAL "c compiler flags")
+set(CMAKE_CXX_FLAGS "-fdata-sections -ffunction-sections" CACHE INTERNAL "cxx compiler flags")
+set(CMAKE_ASM_FLAGS "" CACHE INTERNAL "asm compiler flags")
+if (APPLE)
+ set(CMAKE_EXE_LINKER_FLAGS "-dead_strip" CACHE INTERNAL "exe link flags")
+else (APPLE)
+ set(CMAKE_EXE_LINKER_FLAGS "-Wl,--gc-sections" CACHE INTERNAL "exe link flags")
+endif (APPLE)
+
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -ggdb3" CACHE INTERNAL "c debug compiler flags")
+SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -ggdb3" CACHE INTERNAL "cxx debug compiler flags")
+SET(CMAKE_ASM_FLAGS_DEBUG "-g -ggdb3" CACHE INTERNAL "asm debug compiler flags")
+
+SET(CMAKE_C_FLAGS_RELEASE "-O2 -g -ggdb3" CACHE INTERNAL "c release compiler flags")
+SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -g -ggdb3" CACHE INTERNAL "cxx release compiler flags")
+SET(CMAKE_ASM_FLAGS_RELEASE "" CACHE INTERNAL "asm release compiler flags")