From 6d847d7468fe5a92b2a16ff9c13acb8d6a51e3fc Mon Sep 17 00:00:00 2001 From: Sven Gestegard Robertz <sven.robertz@cs.lth.se> Date: Sat, 25 Oct 2014 12:51:19 +0200 Subject: [PATCH] put back os_compat.mk for use in examples --- lib/c/Makefile | 34 ++-------------------------------- lib/c/os_compat.mk | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 32 deletions(-) create mode 100644 lib/c/os_compat.mk diff --git a/lib/c/Makefile b/lib/c/Makefile index ed97fc4..ca68add 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 0000000..553d0b1 --- /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 -- GitLab