2017-04-27 13:08:17 +02:00
|
|
|
# Makefile.
|
|
|
|
#
|
|
|
|
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
|
|
|
|
# @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
|
|
|
|
# @license GNU General Public License (version 3)
|
|
|
|
#
|
|
|
|
# VILLASnode
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# any later version.
|
2017-07-13 22:13:40 +02:00
|
|
|
#
|
2017-04-27 13:08:17 +02:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
2017-07-13 22:13:40 +02:00
|
|
|
#
|
2017-04-27 13:08:17 +02:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
###################################################################################
|
|
|
|
|
2017-04-15 21:25:19 +02:00
|
|
|
LIB_NAME = libvillas
|
|
|
|
LIB_ABI_VERSION = 1
|
|
|
|
LIB = $(BUILDDIR)/$(LIB_NAME).so.$(LIB_ABI_VERSION)
|
|
|
|
|
2017-07-25 11:57:01 +02:00
|
|
|
WITH_WEB ?= 1
|
|
|
|
WITH_API ?= 1
|
|
|
|
|
2017-04-15 21:25:19 +02:00
|
|
|
# Object files for libvillas
|
2017-07-25 11:57:01 +02:00
|
|
|
LIB_SRCS += $(addprefix lib/kernel/, kernel.c rt.c) \
|
|
|
|
$(addprefix lib/, sample.c path.c node.c hook.c log.c log_config.c \
|
|
|
|
utils.c super_node.c hist.c timing.c pool.c list.c queue.c \
|
|
|
|
queue_signalled.c memory.c advio.c plugin.c node_type.c stats.c \
|
2017-07-28 18:11:52 +02:00
|
|
|
mapping.c io.c shmem.c config_helper.c crypt.c compat.c \
|
2017-08-27 17:04:25 +02:00
|
|
|
log_table.c log_helper.c io_format.c task.c buffer.c \
|
2017-04-15 21:25:19 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
LIB_LDFLAGS = -shared
|
2017-07-24 19:21:57 +02:00
|
|
|
LIB_LDLIBS = $(LDLIBS)
|
2017-04-15 21:25:19 +02:00
|
|
|
|
2017-07-25 11:57:01 +02:00
|
|
|
ifeq ($(PLATFORM),Linux)
|
2017-07-24 19:21:57 +02:00
|
|
|
LIB_LDLIBS += -ldl -lrt -Wl,-soname,$(LIB_NAME).so.$(LIB_ABI_VERSION)
|
|
|
|
endif
|
|
|
|
|
2017-07-25 11:57:01 +02:00
|
|
|
LIB_PKGS += openssl libcurl
|
2017-07-24 19:21:57 +02:00
|
|
|
|
2017-07-25 11:57:01 +02:00
|
|
|
ifeq ($(WITH_WEB),1)
|
2017-08-27 17:04:25 +02:00
|
|
|
LIB_SRCS += lib/web.c
|
|
|
|
LIB_PKGS += libwebsockets
|
|
|
|
LIB_CFLAGS += -DWITH_WEB
|
2017-05-23 14:54:25 +02:00
|
|
|
endif
|
|
|
|
|
2017-07-25 11:57:01 +02:00
|
|
|
ifeq ($(WITH_API),1)
|
|
|
|
-include lib/api/Makefile.inc
|
2017-07-24 19:21:57 +02:00
|
|
|
endif
|
2017-04-15 21:25:19 +02:00
|
|
|
|
|
|
|
# Add flags by pkg-config
|
2017-05-05 22:59:38 +00:00
|
|
|
LIB_LDLIBS += $(shell $(PKGCONFIG) --libs $(LIB_PKGS))
|
|
|
|
LIB_CFLAGS += $(shell $(PKGCONFIG) --cflags $(LIB_PKGS))
|
2017-04-15 21:25:19 +02:00
|
|
|
|
|
|
|
LIB_OBJS = $(patsubst %.c, $(BUILDDIR)/%.o, $(LIB_SRCS))
|
|
|
|
|
|
|
|
$(LIB_NAME): $(LIB)
|
|
|
|
|
|
|
|
# Link
|
|
|
|
$(LIB): $(LIB_OBJS)
|
|
|
|
$(CC) $(LIB_LDFLAGS) -o $@ $^ $(LIB_LDLIBS)
|
|
|
|
ln -srf $@ $(BUILDDIR)/$(LIB_NAME).so
|
|
|
|
|
|
|
|
# Install
|
2017-08-14 20:19:40 +02:00
|
|
|
install-libvillas: libvillas | $(DESTDIR)$(PREFIX)/include/villas/
|
2017-04-15 21:25:19 +02:00
|
|
|
install -m 0755 -D -T $(LIB) $(DESTDIR)$(PREFIX)/lib/$(LIB_NAME).so.$(LIB_ABI_VERSION)
|
|
|
|
install -m 0644 -D -t $(DESTDIR)$(PREFIX)/include/villas/ include/villas/*.h
|
|
|
|
ln -srf $(DESTDIR)$(PREFIX)/lib/$(LIB_NAME).so.$(LIB_ABI_VERSION) $(DESTDIR)$(PREFIX)/lib/$(LIB_NAME).so
|
2017-08-14 14:36:18 +02:00
|
|
|
if [ "$(PLATFORM)" == "Linux" ]; then ldconfig; fi
|
2017-04-15 21:25:19 +02:00
|
|
|
|
|
|
|
clean-libvillas:
|
2017-07-25 11:57:01 +02:00
|
|
|
rm -f $(LIB)
|
2017-04-15 21:25:19 +02:00
|
|
|
|
2017-04-26 11:52:22 +02:00
|
|
|
.PHONY: install-libvillas clean-libvillas $(LIB_NAME)
|