1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-16 00:00:02 +01:00
VILLASnode/lib/Makefile.inc

69 lines
2.5 KiB
PHP
Raw Normal View History

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-24 19:33:35 +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-24 19:33:35 +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/>.
###################################################################################
SONAMES = villas villas-ext
2017-08-30 22:27:26 +02:00
LIBS = $(patsubst %, lib%, $(SONAMES))
LIB_CFLAGS += $(CFLAGS) -fPIC
ifeq ($(shell uname),Darwin)
LIB_CFLAGS += -D_DARWIN_C_SOURCE=1
endif
2017-10-28 16:43:07 +02:00
include $(patsubst %, lib/Makefile.%.inc, $(SONAMES))
$(BUILDDIR)/include/villas/config.h: include/villas/config.h.in Makefile.config | $$(dir $$@)
cp $< $@
echo -e "\n" >> $@
echo "#define BUILDID \"$(BUILDID)\"" >> $@
echo "#define V $(V)" >> $@
echo "#define PREFIX \"$(PREFIX)\"" >> $@
echo -e "\n" >> $@
echo "/* Available Features */" >> $@
if (( $(WITH_WEB) )); then echo "#define WITH_WEB 1" >> $@; fi
if (( $(WITH_API) )); then echo "#define WITH_API 1" >> $@; fi
if (( $(WITH_HOOKS) )); then echo "#define WITH_HOOKS 1" >> $@; fi
if (( $(WITH_IO) )); then echo "#define WITH_IO 1" >> $@; fi
if (( $(WITH_CONFIG) )); then echo "#define WITH_CONFIG 1" >> $@; fi
for NODE in $(call escape,$(LIB_NODES)); do echo "#define WITH_NODE_$${NODE} 1" >> $@; done
for FORMAT in $(call escape,$(LIB_FORMATS)); do echo "#define WITH_FORMAT_$${FORMAT} 1" >> $@; done
for PKG in $(call escape,$(LIB_PKGS)); do echo "#define WITH_$${PKG} 1" >> $@; done
# Compile
$(BUILDDIR)/lib/%.o: lib/%.c $(BUILDDIR)/include/villas/config.h | $$(dir $$@)
$(CC) $(LIB_CFLAGS) -c $< -o $@
lib: $(patsubst %, lib%, $(SONAMES))
install-lib: $(patsubst %, install-lib%, $(SONAMES))
2017-07-24 19:33:35 +02:00
clean-lib: $(patsubst %, clean-lib%, $(SONAMES))
rm -rf $(BUILDDIR)/lib
rm -rf $(BUILDDIR)/include
.PHONY: lib install-lib clean-lib