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

restructured repository

This commit is contained in:
Steffen Vogel 2015-11-23 17:39:01 +01:00
parent 19c991d005
commit f645e498e7
79 changed files with 133 additions and 170 deletions

10
.gitignore vendored
View file

@ -1,2 +1,10 @@
*.o
*.d
*.so
*~
thirdparty
server
send
receive
test
random

141
Makefile
View file

@ -1,64 +1,111 @@
# This Makefile is mainy used by Travis-CI
# Executables
TARGETS = server send random receive test
PREFIX=$(PWD)/thirdparty
# Libraries
LIBS = libs2ss.so
COMMIT=$(shell git rev-parse --short HEAD)
# Common objs
OBJS = path.o hooks.o cfg.o utils.o list.o hist.o log.o timing.o
.PHONY: dependencies build deploy test doc clean
# Object files for libs2ss
LIB_OBJS = msg.o node.o checks.o list.o
clean:
make -C server clean
rm -rf thirdparty
rm -rf documentation/{html,latex}
# Source directories
VPATH = src lib
# Install dependencies
dependencies: $(PREFIX)/libconfig-1.5 $(PREFIX)/libnl-3.2.25 $(PREFIX)/doxygen-1.8.10 $(PREFIX)/pciutils-3.4.0
# Default debug level
V ?= 2
# Download latest doxygen
$(PREFIX)/doxygen-1.8.10:
mkdir -p $(PREFIX)
wget -O- http://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.10.linux.bin.tar.gz | tar xzC $(PREFIX)
GIT_REV=$(shell git rev-parse --short HEAD)
# Install & compile libconfig dependency
$(PREFIX)/libconfig-1.5:
mkdir -p $(PREFIX)/usr/
wget -O- http://www.hyperrealm.com/libconfig/libconfig-1.5.tar.gz | tar -xzC $(PREFIX)
cd $(PREFIX)/libconfig-1.5 && ./configure --prefix=$(PREFIX)/usr/ --disable-examples && make install
# Compiler and linker flags
CC = gcc
LDLIBS = -pthread -lrt -lm -lconfig -ls2ss
# Install & compile libnl3 dependency
$(PREFIX)/libnl-3.2.25:
mkdir -p $(PREFIX)/usr/
wget -O- http://www.infradead.org/~tgr/libnl/files/libnl-3.2.25.tar.gz | tar -xzC $(PREFIX)
cd $(PREFIX)/libnl-3.2.25 && ./configure --prefix=$(PREFIX)/usr/ --disable-cli && make install
CFLAGS += -std=gnu99 -Iinclude/ -I. -MMD -Wall -D_GIT_REV='"$(GIT_REV)"' -D_POSIX_C_SOURCE=200809L -D_GNU_SOURCE=1 -DV=$(V)
LDFLAGS += -Wl,-L.,-rpath,'$$ORIGIN'
# Install & compile libpci dependency
$(PREFIX)/pciutils-3.4.0:
mkdir -p $(PREFIX)/usr/
wget -O- ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci/pciutils-3.4.0.tar.gz | tar -xzC $(PREFIX)
cd $(PREFIX)/pciutils-3.4.0 && make && make install-lib PREFIX=$(PREFIX)/usr/
# Add more compiler flags
ifdef DEBUG
CFLAGS += -O0 -g
else
CFLAGS += -O3
endif
# Compile S2SS server
build: dependencies
CFLAGS=-I$(PREFIX)/usr/include/ \
LDFLAGS=-Wl,-L$(PREFIX)/usr/lib/ \
NLDIR=$(PREFIX)/usr/include/libnl3/ \
PCIDIR=$(PREFIX)/usr/include \
make -C server
######## Node types ########
# Test S2SS server by running it for 3 secs
test: build
LD_LIBRARY_PATH=$(PREFIX)/usr/lib/ \
timeout --signal INT --preserve-status 3s \
server/server server/etc/loopback.conf || true
# Enable file node type support
ifndef DISABLE_FILE
LIB_OBJS += file.o
endif
# Deploy
deploy: build
# Enable Socket node type when libnl3 is available
ifeq ($(shell pkg-config libnl-3.0; echo $$?),0)
LIB_OBJS += socket.o nl.o tc.o if.o
LIB_CFLAGS += $(shell pkg-config --cflags libnl-3.0)
LIB_LDLIBS += -lnl-3 -lnl-route-3
endif
# Enable GTFPGA support when libpci is available
ifeq ($(shell pkg-config libpci; echo $$?),0)
LIB_OBJS += gtfpga.o
LIB_CFLAGS += $(shell pkg-config --cflags libpci)
LIB_LDLIBS += $(shell pkg-config --libs libpci)
endif
# Enable NGSI support
ifeq ($(shell pkg-config libcurl jansson uuid; echo $$?),0)
LIB_OBJS += ngsi.o
LIB_CFLAGS += $(shell pkg-config --cflags libcurl jansson uuid)
LIB_LDLIBS += $(shell pkg-config --libs libcurl jansson uuid)
endif
# Enable OPAL-RT Asynchronous Process support (will result in 32bit binary!!!)
ifneq (,$(wildcard $(OPALDIR)/include_target/AsyncApi.h))
LIB_OBJS += opal.o
LIB_CFLAGS += -m32 -I$(OPALDIR)/include_target
LIB_LDFLAGS += -m32 -Wl,-L/lib/i386-linux-gnu/,-L/usr/lib/i386-linux-gnu/,-L$(OPALDIR)/lib/redhawk/
LIB_LDLIBS += -lOpalAsyncApiCore -lOpalCore -lOpalUtils -lirc
endif
######## Targets ########
.PHONY: all clean install release
# Default target: build everything
all: $(LIBS) $(TARGETS)
# Dependencies for individual binaries
server: server.o $(OBJS)
send: send.o $(OBJS)
receive: receive.o $(OBJS)
test: test.o $(OBJS)
random: random.o msg.o utils.o timing.o log.o
# Libraries
libs2ss.so: CFLAGS += -fPIC $(LIB_CFLAGS)
libs2ss.so: $(LIB_OBJS)
$(CC) $(LIB_LDFLAGS) $(LIB_LDLIBS) -shared -o $@ $^
# Common targets
install: $(TARGETS)
install -m 0644 libs2ss.so $(PREFIX)/lib
install -m 0755 server -T $(PREFIX)/bin/s2ss
install -m 0755 send $(PREFIX)/bin/s2ss-send
install -m 0755 receive $(PREFIX)/bin/s2ss-receive
install -m 0755 random $(PREFIX)/bin/s2ss-random
install -m 0755 test $(PREFIX)/bin/s2ss-test
release: all
tar czf s2ss-$(COMMIT)-docs.tar.gz documentation/html/
tar czf s2ss-$(COMMIT).tar.gz server/server server/test server/send server/receive server/random server/etc/
rsync *.tar.gz $(DEPLOY_USER)@$(DEPLOY_HOST):$(DEPLOY_PATH)/
rsync --archive --delete documentation/html/ $(DEPLOY_USER)@$(DEPLOY_HOST):$(DEPLOY_PATH)/doc/
# Generate documentation
doc: $(PREFIX)/doxygen-1.8.10
PATH=$(PREFIX)/doxygen-1.8.10/bin/:$(PATH) \
doxygen
clean:
$(RM) *~ *.o *.d *.so
$(RM) $(TARGETS)
$(RM) -rf doc/{html,latex}
# Include auto-generated dependencies
-include $(wildcard *.d)

View file

@ -1,4 +1,6 @@
# Simulator to Simulator Server [![Travis-CI](https://magnum.travis-ci.com/RWTH-ACS/S2SS.svg?token=9zFzh6dGWonz6LyBspW3&branch=master)](https://magnum.travis-ci.com/RWTH-ACS/S2SS)
# Simulator to Simulator Server
[![Travis-CI](https://magnum.travis-ci.com/RWTH-ACS/S2SS.svg?token=9zFzh6dGWonz6LyBspW3&branch=master)](https://magnum.travis-ci.com/RWTH-ACS/S2SS)
This is S2SS, a gateway to forward and process simulation data between real time simulators.

12
server/.gitignore vendored
View file

@ -1,12 +0,0 @@
logs/
*.d
*.o
*.so
*~
server
test
send
receive
random

View file

@ -1,109 +0,0 @@
# Executables
TARGETS = server send random receive test
# Libraries
LIBS = libs2ss.so
# Common objs
OBJS = path.o hooks.o cfg.o utils.o list.o hist.o log.o timing.o checks.o
# Object files for libs2ss
LIB_OBJS = msg.o node.o checks.o list.o
# Source directories
VPATH = src lib
# Default debug level
V ?= 2
# Compiler and linker flags
CC = gcc
LDLIBS = -pthread -lrt -lm -lconfig -ls2ss
LDFLAGS = -Wl,-L.
CFLAGS += -std=gnu99 -Iinclude/ -MMD -Wall
CFLAGS += -D_POSIX_C_SOURCE=200809L -D_GNU_SOURCE=1 -DV=$(V)
# Add more compiler flags
ifdef DEBUG
CFLAGS += -O0 -g
else
CFLAGS += -O3
endif
ifneq (,$(shell which git))
CFLAGS += -D_GIT_REV='"$(shell git rev-parse --short HEAD)"'
endif
######## Node types ########
# Enable file node type support
ifndef DISABLE_FILE
LIB_OBJS += file.o
endif
# Enable Socket node type when libnl3 is available
ifeq ($(shell pkg-config libnl-3.0; echo $$?),0)
LIB_OBJS += socket.o nl.o tc.o if.o
LIB_CFLAGS += $(shell pkg-config --cflags libnl-3.0)
LIB_LDLIBS += -lnl-3 -lnl-route-3
endif
# Enable GTFPGA support when libpci is available
ifeq ($(shell pkg-config libpci; echo $$?),0)
LIB_OBJS += gtfpga.o
LIB_CFLAGS += $(shell pkg-config --cflags libpci)
LIB_LDLIBS += $(shell pkg-config --libs libpci)
endif
# Enable NGSI support
ifeq ($(shell pkg-config libcurl jansson uuid; echo $$?),0)
LIB_OBJS += ngsi.o
LIB_CFLAGS += $(shell pkg-config --cflags libcurl jansson uuid)
LIB_LDLIBS += $(shell pkg-config --libs libcurl jansson uuid)
endif
# Enable OPAL-RT Asynchronous Process support (will result in 32bit binary!!!)
ifneq (,$(wildcard $(OPALDIR)/include_target/AsyncApi.h))
LIB_OBJS += opal.o
LIB_CFLAGS += -m32 -I$(OPALDIR)/include_target
LIB_LDFLAGS += -m32 -Wl,-L/lib/i386-linux-gnu/,-L/usr/lib/i386-linux-gnu/,-L$(OPALDIR)/lib/redhawk/
LIB_LDLIBS += -lOpalAsyncApiCore -lOpalCore -lOpalUtils -lirc
endif
######## Targets ########
.PHONY: all clean install
# Default target: build everything
all: $(LIBS) $(TARGETS)
# Dependencies for individual binaries
server: server.o $(OBJS)
send: send.o $(OBJS)
receive: receive.o $(OBJS)
test: test.o $(OBJS)
random: random.o msg.o utils.o timing.o log.o
lib/%.o:
$(CC) $(LIB_CFLAGS) -o $@ $^
libs2ss.so: CFLAGS += -fPIC $(LIB_CFLAGS)
libs2ss.so: $(LIB_OBJS)
$(CC) $(LIB_LDFLAGS) $(LIB_LDLIBS) -shared -o $@ $^
# Common targets
install: $(TARGETS)
install -m 0644 libs2ss.so $(PREFIX)/lib
install -m 0755 server -T $(PREFIX)/bin/s2ss
install -m 0755 send $(PREFIX)/bin/s2ss-send
install -m 0755 receive $(PREFIX)/bin/s2ss-receive
install -m 0755 random $(PREFIX)/bin/s2ss-random
install -m 0755 test $(PREFIX)/bin/s2ss-test
clean:
$(RM) *~ *.o *.d *.so
$(RM) $(TARGETS)
# Include auto-generated dependencies
-include $(wildcard *.d)

27
thirdparty/Makefile vendored Normal file
View file

@ -0,0 +1,27 @@
.PHONY: dependencies
# Install dependencies
dependencies: libconfig-1.5 libnl-3.2.25 doxygen-1.8.10 pciutils-3.4.0
# Download latest doxygen
doxygen-1.8.10:
mkdir -p $(PREFIX)
wget -O- http://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.10.linux.bin.tar.gz | tar xzC $(PREFIX)
# Install & compile libconfig dependency
libconfig-1.5:
mkdir -p $(PREFIX)/usr/
wget -O- http://www.hyperrealm.com/libconfig/libconfig-1.5.tar.gz | tar -xzC $(PREFIX)
cd libconfig-1.5 && ./configure --prefix=$(PWD)/usr/ --disable-examples && make install
# Install & compile libnl3 dependency
libnl-3.2.25:
mkdir -p $(PREFIX)/usr/
wget -O- http://www.infradead.org/~tgr/libnl/files/libnl-3.2.25.tar.gz | tar -xzC $(PREFIX)
cd libnl-3.2.25 && ./configure --prefix=$(PWD)/usr/ --disable-cli && make install
# Install & compile libpci dependency
pciutils-3.4.0:
mkdir -p $(PREFIX)/usr/
wget -O- ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci/pciutils-3.4.0.tar.gz | tar -xzC $(PREFIX)
cd pciutils-3.4.0 && make && make install-lib PREFIX=$(PWD)/usr/