clixon/example/Makefile.in
2016-02-26 16:05:34 +01:00

111 lines
3.3 KiB
Makefile

#
# Copyright (C) 2009-2016 Olof Hagsand and Benny Holmgren
#
# This file is part of CLIXON.
#
# CLIXON 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
# (at your option) any later version.
#
# CLIXON 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.
#
# You should have received a copy of the GNU General Public License
# along with CLIXON; see the file LICENSE. If not, see
# <http://www.gnu.org/licenses/>.
#
VPATH = @srcdir@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
prefix = @prefix@
bindir = @bindir@
includedir = @includedir@
datarootdir = @datarootdir@
APPNAME = routing
CC = @CC@
CFLAGS = @CFLAGS@ -rdynamic -fPIC
INCLUDES = -I$(includedir) @INCLUDES@
BE_PLUGIN = $(APPNAME)_backend.so
CLI_PLUGIN = $(APPNAME)_cli.so
NETCONF_PLUGIN = $(APPNAME)_netconf.so
PLUGINS = $(BE_PLUGIN) $(CLI_PLUGIN) $(NETCONF_PLUGIN)
all: $(PLUGINS) $(APPNAME).conf
# Note: clicon.mk has a rule for:
# $(APPNAME.conf)
-include $(DESTDIR)$(datarootdir)/clicon/clicon.mk
CLISPECS = routing_cli.cli
#YANGSPECS = $(APPNAME).yang
YANGSPECS += ietf-yang-types@2013-07-15.yang
YANGSPECS += ietf-inet-types@2013-07-15.yang
YANGSPECS += ietf-interfaces@2014-05-08.yang
YANGSPECS += ietf-ip@2014-06-16.yang
YANGSPECS += ietf-routing@2014-10-26.yang
YANGSPECS += ietf-ipv4-unicast-routing@2014-10-26.yang
YANGSPECS += ietf-ipv6-unicast-routing@2014-10-26.yang
# Backend plugin
BE_SRC = routing_backend.c
BE_OBJ = $(BE_SRC:%.c=%.o)
$(BE_PLUGIN): $(BE_OBJ)
$(CC) -shared -o $@ -lc $<
# CLI frontend plugin
CLI_SRC = routing_cli.c
CLI_OBJ = $(CLI_SRC:%.c=%.o)
$(CLI_PLUGIN): $(CLI_OBJ)
$(CC) -shared -o $@ -lc $^
# NETCONF frontend plugin
NETCONF_SRC = routing_netconf.c
NETCONF_OBJ = $(NETCONF_SRC:%.c=%.o)
$(NETCONF_PLUGIN): $(NETCONF_OBJ)
$(CC) -shared -o $@ -lc $^
SRC = $(BE_SRC) $(CLI_SRC) $(NETCONF_SRC)
OBJS = $(BE_OBJ) $(CLI_OBJ) $(NETCONF_OBJ)
clean:
rm -f $(PLUGINS) $(OBJS) $(APPNAME).conf
distclean: clean
rm -f Makefile *~ .depend
install: $(YANGSPECS) $(CLISPECS) $(BE_PLUGIN) $(CLI_PLUGIN) $(NETCONF_PLUGIN) $(APPNAME).conf
install -d $(DESTDIR)$(clicon_SYSCONFDIR)
install $(APPNAME).conf $(DESTDIR)$(clicon_SYSCONFDIR)
install -d $(DESTDIR)$(clicon_DBSPECDIR)/yang
install $(YANGSPECS) $(DESTDIR)$(clicon_DBSPECDIR)/yang
install -d $(DESTDIR)$(clicon_LIBDIR)/cli
install $(CLI_PLUGIN) $(DESTDIR)$(clicon_LIBDIR)/cli;
install -d $(DESTDIR)$(clicon_LIBDIR)/backend
install $(BE_PLUGIN) $(DESTDIR)$(clicon_LIBDIR)/backend;
install -d $(DESTDIR)$(clicon_LIBDIR)/netconf
install $(NETCONF_PLUGIN) $(DESTDIR)$(clicon_LIBDIR)/netconf;
install -d $(DESTDIR)$(clicon_LIBDIR)/clispec
install $(CLISPECS) $(DESTDIR)$(clicon_LIBDIR)/clispec;
install -d $(DESTDIR)$(clicon_LOCALSTATEDIR)
uninstall:
rm -rf $(DESTDIR)$(clicon_SYSCONFDIR)/$(APPNAME).conf
rm -rf $(DESTDIR)$(clicon_DBSPECDIR)
rm -rf $(DESTDIR)$(clicon_LOCALSTATEDIR)
rm -rf $(DESTDIR)$(clicon_LIBDIR)
install-include:
depend:
$(CC) $(DEPENDFLAGS) $(INCLUDES) $(CFLAGS) -MM $(SRC) > .depend
#include .depend