diff --git a/lib/c/Makefile b/lib/c/Makefile
index ed97fc48edd6335cb4300ac48fc0f3d91d3aaf6a..ca68add3c95acf90f459b3d01f3680b8ab6c5d0f 100644
--- a/lib/c/Makefile
+++ b/lib/c/Makefile
@@ -1,38 +1,8 @@
 ## Macros
-UNAME_S=$(shell uname -s)
-ALL_DEPS=liblabcomm.a liblabcomm.so.1 liblabcomm2006.a liblabcomm2006.so.1  liblabcomm20141009.a liblabcomm20141009.so.1
+include os_compat.mk
 
-ifeq ($(UNAME_S),Linux)
-  CFLAGS=-std=c99 -g -Wall -Werror -O3  -I. -Itest -I2006
-  CC=$(CROSS_COMPILE)gcc
-  LD=$(CROSS_COMPILE)ld
-  LDFLAGS=-L.
-  LDLIBS=-llabcomm -llabcomm2006 -lrt
-  MAKESHARED=gcc -o $1 -shared -Wl,-soname,$2 $3 -lc -lrt
-else ifeq ($(UNAME_S),Darwin)
-  CC=$(CROSS_COMPILE)clang
-  LD=$(CROSS_COMPILE)ld
-  CFLAGS=-g -Wall -Werror -O3  -I. -Itest \
-	 -DLABCOMM_COMPAT=\"labcomm_compat_osx.h\" \
-	 -Wno-tautological-compare -Wno-unused-function
-  LDFLAGS=-L.
-  LDLIBS=-llabcomm -llabcomm2006 
-  MAKESHARED=clang -o $1 -shared -Wl,-install_name,$2 $3 -lc
-else ifneq ($(findstring CYGWIN,$(UNAME_S)),)
-  CFLAGS=-std=c99 -g -Wall -Werror -O3  -I. -Itest
-  CC=$(CROSS_COMPILE)gcc
-  LD=$(CROSS_COMPILE)ld
-  LDFLAGS=-L.
-  LDLIBS=-llabcomm -lrt
-  ALL_DEPS:=$(filter-out %.so.1, $(ALL_DEPS)) # No -fPIC supported in windows?
-else
-  $(error Unknown system $(UNAME_S))
-endif
+ALL_DEPS=liblabcomm.a liblabcomm.so.1 liblabcomm2006.a liblabcomm2006.so.1  liblabcomm20141009.a liblabcomm20141009.so.1
 
-ifeq ($(CROSS_COMPILE),i586-wrs-vxworks-)
-  ALL_DEPS:=$(filter-out %.so.1, $(ALL_DEPS)) # PIC is only supported for RTPs
-  CFLAGS:=$(CFLAGS) -DLABCOMM_COMPAT=\"labcomm_compat_vxworks.h\"
-endif
 # TODO: Support for Codesourcery ARM toolchain.
 
 OBJS2006=2006/labcomm2006_memory.o \
diff --git a/lib/c/os_compat.mk b/lib/c/os_compat.mk
new file mode 100644
index 0000000000000000000000000000000000000000..553d0b1bf19971a8b2bd52dd3a0ad16756140017
--- /dev/null
+++ b/lib/c/os_compat.mk
@@ -0,0 +1,34 @@
+## Macros
+UNAME_S=$(shell uname -s)
+
+ifeq ($(UNAME_S),Linux)
+  CFLAGS=-std=c99 -g -Wall -Werror -O3  -I. -Itest -I2006
+  CC=$(CROSS_COMPILE)gcc
+  LD=$(CROSS_COMPILE)ld
+  LDFLAGS=-L.
+  LDLIBS=-llabcomm -llabcomm2006 -lrt
+  MAKESHARED=gcc -o $1 -shared -Wl,-soname,$2 $3 -lc -lrt
+else ifeq ($(UNAME_S),Darwin)
+  CC=$(CROSS_COMPILE)clang
+  LD=$(CROSS_COMPILE)ld
+  CFLAGS=-g -Wall -Werror -O3  -I. -Itest \
+	 -DLABCOMM_COMPAT=\"labcomm_compat_osx.h\" \
+	 -Wno-tautological-compare -Wno-unused-function
+  LDFLAGS=-L.
+  LDLIBS=-llabcomm -llabcomm2006 
+  MAKESHARED=clang -o $1 -shared -Wl,-install_name,$2 $3 -lc
+else ifneq ($(findstring CYGWIN,$(UNAME_S)),)
+  CFLAGS=-std=c99 -g -Wall -Werror -O3  -I. -Itest
+  CC=$(CROSS_COMPILE)gcc
+  LD=$(CROSS_COMPILE)ld
+  LDFLAGS=-L.
+  LDLIBS=-llabcomm -lrt
+  ALL_DEPS:=$(filter-out %.so.1, $(ALL_DEPS)) # No -fPIC supported in windows?
+else
+  $(error Unknown system $(UNAME_S))
+endif
+
+ifeq ($(CROSS_COMPILE),i586-wrs-vxworks-)
+  ALL_DEPS:=$(filter-out %.so.1, $(ALL_DEPS)) # PIC is only supported for RTPs
+  CFLAGS:=$(CFLAGS) -DLABCOMM_COMPAT=\"labcomm_compat_vxworks.h\"
+endif