1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

asyncip: support compilation with GCC / clang

This commit is contained in:
Steffen Vogel 2017-04-24 11:38:05 +02:00
parent 565c6fb094
commit 46d0d4cc84
4 changed files with 106 additions and 85 deletions

19
clients/Makefile.inc Normal file
View file

@ -0,0 +1,19 @@
ASYNCIP_PATH = $(SRCDIR)/clients/opal/udp/models/send_receive
clients: clients-opal
clients-opal:
$(MAKE) -C $(ASYNCIP_PATH) -f Makefile.mk AsyncIP \
RTLAB_INTEL_COMPILER=0 \
PROTOCOL=GTNET_SKT \
OPAL_LIBS="-lSystem -luuid" \
OPAL_LIBPATH=-L$(SRCDIR)/thirdparty/libopal/ \
OPAL_INCPATH=-I$(SRCDIR)/thirdparty/libopal/include/opal
clean-clients:
$(MAKE) -C $(ASYNCIP_PATH) -f Makefile.mk clean
install-clients:
$(MAKE) -C $(ASYNCIP_PATH) -f Makefile.mk install
.PHONY: clients clean-clients install-clients

View file

@ -0,0 +1,57 @@
TARGET = AsyncIP
VPATH = $(SRCDIR)/src
RTLAB_INTEL_COMPILER ?= 1
# Compiler selection
ifeq ($(RTLAB_INTEL_COMPILER),1)
CC = opicc
LD = opicpc
else
CC = gcc
LD = g++
INTEL_LIBS = -limf -lirc
INTEL_OBJS = compat.o
endif
# Support for debugging symbols
ifeq ($(DEBUG),1)
CC_DEBUG_OPTS = -g -D_DEBUG
LD_DEBUG_OPTS = -g
else
CC_DEBUG_OPTS = -O
LD_DEBUG_OPTS =
endif
TARGET_LIB = -lpthread -lm -ldl -lutil -lrt $(INTEL_LIBS)
INCLUDES = -I. $(OPAL_INCPATH) -Iinclude
LIBPATH = -L. $(OPAL_LIBPATH)
CC_OPTS = -m32 -std=c99 -D_GNU_SOURCE -MMD
LD_OPTS = -m32
OBJS = main.o msg.o utils.o socket.o $(INTEL_OBJS)
ifneq ($(PROTOCOL),)
CC_OPTS += -DPROTOCOL=$(PROTOCOL)
endif
ADDLIB = -lOpalCore -lOpalUtils
LIBS = -lOpalAsyncApiCore $(ADDLIB) $(TARGET_LIB) $(OPAL_LIBS)
CFLAGS = -c $(CC_OPTS) $(CC_DEBUG_OPTS) $(INCLUDES)
LDFLAGS = $(LD_OPTS) $(LD_DEBUG_OPTS) $(LIBPATH)
all: $(TARGET)
install: $(TARGET)
install -m 0755 -D -t $(DESTDIR)$(PREFIX)/bin $(TARGET)
clean:
rm -f $(OBJS) $(TARGET)
$(TARGET): $(OBJS)
$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
-include $(wildcard *.d)

View file

@ -0,0 +1,30 @@
/** Compatibility code for GCC
*
* OPAL-RT's libSystem.a links against some Intel
*
* @file
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
* @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
*********************************************************************************/
#include <string.h>
size_t __intel_sse2_strlen(const char *s)
{
return strlen(s);
}
void * _intel_fast_memset(void *b, int c, size_t len)
{
return memset(b, c, len);
}
void * _intel_fast_memcpy(void *restrict dst, const void *restrict src, size_t n)
{
return memcpy(dst, src, n);
}
int _intel_fast_memcmp(const void *s1, const void *s2, size_t n)
{
return memcmp(s1, s2, n);
}

View file

@ -1,85 +0,0 @@
# ----------------------------------------------------------------------------#
# Specify program name
PROGRAM = s2ss
# ----------------------------------------------------------------------------#
# Specify default values if we are not compiling from RT-LAB
#
# ----------------------------------------------------------------------------#
TARGET_OPALRT_ROOT = /usr/opalrt
# ----------------------------------------------------------------------------#
# QNX v6.x
#
ifeq "$(SYSNAME)" "nto"
CC = gcc
LD = $(CC)
TARGET_LIB = -lsocket
endif
# ----------------------------------------------------------------------------#
# ----------------------------------------------------------------------------#
# RedHawk Linux
#
ifeq "$(shell uname)" "Linux"
RTLAB_INTEL_COMPILER ?= 1
# Intel Compiler support
ifeq ($(RTLAB_INTEL_COMPILER),1)
CC = opicc
LD = opicpc
# Gnu Compiler support
else
CC = gcc
LD = g++
INTEL_LIBS = -limf -lirc
endif
# RedHat or RedHawk
LINUX_FLAVOR = $(shell uname -r | grep RedHawk)
ifneq "$(LINUX_FLAVOR) " " " ### Linux (RedHat)
RH_FLAGS = -D_GNU_SOURCE -D__redhawk__
RH_LIBS = -lccur_rt
else
RH_FLAGS = -D_GNU_SOURCE
endif
TARGET_LIB = -lpthread -lm -ldl -lutil -lrt $(RH_LIBS) $(INTEL_LIBS)
endif
# ----------------------------------------------------------------------------#
# Support for debugging symbols
ifeq ($(DEBUG),1)
CC_DEBUG_OPTS=-g -D_DEBUG
LD_DEBUG_OPTS=-g
else
CC_DEBUG_OPTS=-O
LD_DEBUG_OPTS=
endif
INCLUDES = -I.
LIBPATH = -L. $(OPAL_LIBPATH)
CC_OPTS = -std=c99
LD_OPTS =
OBJS = main.o msg.o utils.o socket.o
ADDLIB = -lOpalCore -lOpalUtils
LIBS = -lOpalAsyncApiCore $(ADDLIB) $(TARGET_LIB) $(OPAL_LIBS)
CFLAGS = -c $(CC_OPTS) $(CC_DEBUG_OPTS) $(RH_FLAGS) $(INCLUDES)
LDFLAGS = $(LD_OPTS) $(LD_DEBUG_OPTS) $(LIBPATH)
all: $(PROGRAM)
install:
\mkdir -p $(TARGET_OPALRT_ROOT)/local
\chmod 755 $(TARGET_OPALRT_ROOT)/local
\cp -f $(PROGRAM) $(TARGET_OPALRT_ROOT)/local
clean:
\rm -f $(OBJS) $(PROGRAM)
$(PROGRAM): $(OBJS)
$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
chmod 777 $@
@echo "### Created executable: $(PROGRAM)"