clixon/apps/restconf/Makefile.in
2020-06-02 15:49:40 +02:00

178 lines
5.1 KiB
Makefile

#
# ***** BEGIN LICENSE BLOCK *****
#
# Copyright (C) 2009-2016 Olof Hagsand and Benny Holmgren
# Copyright (C) 2017-2019 Olof Hagsand
# Copyright (C) 2020 Olof Hagsand and Rubicon Communications, LLC(Netgate)
#
# This file is part of CLIXON
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Alternatively, the contents of this file may be used under the terms of
# the GNU General Public License Version 3 or later (the "GPL"),
# in which case the provisions of the GPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of the GPL, and not to allow others to
# use your version of this file under the terms of Apache License version 2,
# indicate your decision by deleting the provisions above and replace them with
# the notice and other provisions required by the GPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the Apache License version 2 or the GPL.
#
# ***** END LICENSE BLOCK *****
#
VPATH = @srcdir@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
CC = @CC@
CFLAGS = @CFLAGS@
INSTALLFLAGS = @INSTALLFLAGS@
LDFLAGS = @LDFLAGS@
prefix = @prefix@
datarootdir = @datarootdir@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
mandir = @mandir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
sysconfdir = @sysconfdir@
includedir = @includedir@
HOST_VENDOR = @host_vendor@
# XXX why is not wwwdir under prefix?
wwwdir = @wwwdir@
wwwuser = @wwwuser@
with_libhttp = @with_libhttp@
with_evhtp = @with_evhtp@
SH_SUFFIX = @SH_SUFFIX@
CLIXON_MAJOR = @CLIXON_VERSION_MAJOR@
CLIXON_MINOR = @CLIXON_VERSION_MINOR@
# Use this clixon lib for linking
CLIXON_LIB = libclixon$(SH_SUFFIX).$(CLIXON_MAJOR).$(CLIXON_MINOR)
# For dependency
LIBDEPS = $(top_srcdir)/lib/src/$(CLIXON_LIB)
LIBS = -L$(top_srcdir)/lib/src @LIBS@ $(top_srcdir)/lib/src/$(CLIXON_LIB)
ifeq ($(with_libhttp),yes)
LIBS += -ldl -lpthread
endif
ifeq ($(with_evhtp),yes)
LIBS += -lpthread -levent -levent_openssl -lssl -lcrypto
endif
CPPFLAGS = @CPPFLAGS@ -fPIC
INCLUDES = -I. -I$(top_srcdir)/lib/src -I$(top_srcdir)/lib -I$(top_srcdir)/include -I$(top_srcdir) @INCLUDES@
# Applications
APPLS = clixon_restconf # fcgi / nginx
ifeq ($(with_libhttp),yes)
APPLS += clixon_restconf_libhttp
endif
ifeq ($(with_evhtp),yes)
APPLS += clixon_restconf_evhtp
endif
# Common source - not accessible from plugin - independent of fcgi
APPSRC = restconf_lib.c
APPOBJ = $(APPSRC:.c=.o)
# Fcgi-specific source including main
APPFCGI = restconf_fcgi_lib.c
APPFCGI += restconf_fcgi_main.c
APPFCGI += restconf_methods.c # These should be moved ^
APPFCGI += restconf_methods_post.c
APPFCGI += restconf_methods_get.c
APPFCGI += restconf_stream.c
APPFCGIOBJ = $(APPFCGI:.c=.o)
ifeq ($(with_libhttp),yes)
# Libhttp-specific source including main
APPLIBH = restconf_libhttp_main.c
APPLIBHOBJ = $(APPLIBH:.c=.o)
endif
ifeq ($(with_evhtp),yes)
# Evhtp-specific source including main
APPEVHTPH = restconf_evhtp_main.c
APPEVHTPOBJ = $(APPEVHTPH:.c=.o)
endif
all: $(APPLS)
# Dependency of clixon library
$(top_srcdir)/lib/src/$(CLIXON_LIB):
(cd $(top_srcdir)/lib/src && $(MAKE) $(MFLAGS) $(CLIXON_LIB))
clean:
rm -f *.core $(APPLS) $(APPOBJ) $(APPFCGIOBJ)
ifeq ($(with_libhttp),yes)
rm -f $(APPLIBHOBJ)
endif
ifeq ($(with_evhtp),yes)
rm -f $(APPEVHTPOBJ)
endif
distclean: clean
rm -f Makefile *~ .depend
# Put demon in bin
# Put other executables in libexec/
# Also create a libexec/ directory for writeable/temporary files.
# Put config file in etc/
# Also a rule for letting www-dir be owned by www-data, which only works for sudo
install: $(APPLS)
ifeq ($(shell whoami),root)
install -d -m 0755 -o $(wwwuser) -g $(wwwuser) $(DESTDIR)$(wwwdir)
else
install -d -m 0755 $(DESTDIR)$(wwwdir)
endif
install -m 0755 $(INSTALLFLAGS) $(APPLS) $(DESTDIR)$(wwwdir)
install-include:
uninstall:
rm -f $(DESTDIR)$(wwwdir)/$(APPLS)
.SUFFIXES:
.SUFFIXES: .c .o
.c.o:
$(CC) $(INCLUDES) -D__PROGRAM__=\"clixon_restconf\" $(CPPFLAGS) $(CFLAGS) -c $<
clixon_restconf : $(APPOBJ) $(APPFCGIOBJ)
$(CC) $(LDFLAGS) $(APPOBJ) $(APPFCGIOBJ) -L. $(LIBS) -o $@
ifeq ($(with_libhttp),yes)
clixon_restconf_libhttp : $(APPOBJ) $(APPLIBHOBJ) $(LIBDEPS)
$(CC) $(LDFLAGS) $(APPOBJ) $(APPLIBHOBJ) -L. $(LIBS) -o $@
endif
ifeq ($(with_evhtp),yes)
clixon_restconf_evhtp : $(APPOBJ) $(APPEVHTPOBJ) $(LIBDEPS)
$(CC) $(LDFLAGS) $(APPOBJ) $(APPEVHTPOBJ) -L. $(LIBS) -o $@
endif
TAGS:
find . -name '*.[chyl]' -print | etags -
depend:
$(CC) $(DEPENDFLAGS) @DEFS@ $(INCLUDES) $(CFLAGS) -MM $(APPFCGI) $(APPSRC) > .depend
#include .depend