# # ***** BEGIN LICENSE BLOCK ***** # # Copyright (C) 2009-2019 Olof Hagsand and Benny Holmgren # # 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 ***** # prefix = @prefix@ datarootdir = @datarootdir@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ exec_prefix = @exec_prefix@ bindir = @bindir@ libdir = @libdir@ dbdir = @prefix@/db mandir = @mandir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ sysconfdir = @sysconfdir@ HOST_VENDOR = @host_vendor@ SH_SUFFIX = @SH_SUFFIX@ CLIXON_VERSION = @CLIXON_VERSION@ CLIXON_MAJOR = @CLIXON_VERSION_MAJOR@ CLIXON_MINOR = @CLIXON_VERSION_MINOR@ VPATH = @srcdir@ CC = @CC@ CFLAGS = -fPIC @CFLAGS@ INSTALL = @INSTALL@ INSTALL_LIB = @INSTALL@ INSTALLFLAGS = @INSTALLFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ YACC = @YACC@ LEX = @LEX@ CPPFLAGS = @CPPFLAGS@ INCLUDES = -I. @INCLUDES@ -I$(top_srcdir)/lib/clixon -I$(top_srcdir)/include -I$(top_srcdir) SRC = clixon_sig.c clixon_log.c clixon_err.c clixon_event.c \ clixon_string.c clixon_regex.c clixon_handle.c \ clixon_xml.c clixon_xml_sort.c clixon_xml_map.c clixon_file.c \ clixon_json.c clixon_yang.c clixon_yang_type.c clixon_yang_module.c \ clixon_yang_cardinality.c clixon_xml_changelog.c clixon_xml_nsctx.c \ clixon_hash.c clixon_options.c clixon_data.c clixon_plugin.c \ clixon_proto.c clixon_proto_client.c \ clixon_xpath.c clixon_xpath_ctx.c clixon_xpath_eval.c clixon_sha1.c \ clixon_datastore.c clixon_datastore_write.c clixon_datastore_read.c \ clixon_datastore_tree.c \ clixon_netconf_lib.c clixon_stream.c clixon_nacm.c YACCOBJS := lex.clixon_xml_parse.o clixon_xml_parse.tab.o \ lex.clixon_yang_parse.o clixon_yang_parse.tab.o \ lex.clixon_json_parse.o clixon_json_parse.tab.o \ lex.clixon_xpath_parse.o clixon_xpath_parse.tab.o # Generated src GENSRC = build.c OBJS = $(YACCOBJS) $(SRC:.c=.o) GENOBJS = $(GENSRC:.c=.o) # Linker-name: libclixon.so # so-name: libclixon.so.2 # real-name: libclixon.so.2.0 MYLIB = libclixon$(SH_SUFFIX).$(CLIXON_MAJOR).$(CLIXON_MINOR) MYLIBSO = libclixon$(SH_SUFFIX).$(CLIXON_MAJOR) MYLIBLINK = libclixon$(SH_SUFFIX) all: $(MYLIB) $(MYLIBLINK) clean: rm -f $(OBJS) $(MYLIB) $(MYLIBLINK) $(GENOBJS) $(GENSRC) *.core rm -f clixon_xml_parse.tab.[ch] clixon_xml_parse.yy.[co] rm -f clixon_yang_parse.tab.[ch] clixon_yang_parse.[co] rm -f clixon_json_parse.tab.[ch] clixon_json_parse.[co] rm -f clixon_xpath_parse.tab.[ch] clixon_xpath_parse.[co] rm -f lex.clixon_xml_parse.c rm -f lex.clixon_yang_parse.c rm -f lex.clixon_json_parse.c rm -f lex.clixon_xpath_parse.c ############################################################################# # Implicit rules for lex and yacc. # # lex files *.l -> *.yy.c # yacc files *.y -> *.tab.c and *.tab.h # # Lex forces yacc include file *.tab.h to be built. ############################################################################# %.c : %.y # cancel implicit yacc rule %.c : %.l # cancel implicit lex rule # xml parser lex.clixon_xml_parse.c : clixon_xml_parse.l clixon_xml_parse.tab.h $(LEX) -Pclixon_xml_parse clixon_xml_parse.l # -d is debug clixon_xml_parse.tab.h: clixon_xml_parse.y $(YACC) -l -d -b clixon_xml_parse -p clixon_xml_parse clixon_xml_parse.y # -t is debug # extra rule to avoid parallell yaccs clixon_xml_parse.tab.c: clixon_xml_parse.tab.h lex.clixon_xml_parse.o : lex.clixon_xml_parse.c clixon_xml_parse.tab.h # special rule to for make clean to work $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -Wno-error -c $< # yang parser lex.clixon_yang_parse.c : clixon_yang_parse.l clixon_yang_parse.tab.h $(LEX) -Pclixon_yang_parse clixon_yang_parse.l # -d is debug clixon_yang_parse.tab.h: clixon_yang_parse.y $(YACC) -l -d -b clixon_yang_parse -p clixon_yang_parse clixon_yang_parse.y # -t is debug # extra rule to avoid parallell yaccs clixon_yang_parse.tab.c: clixon_yang_parse.tab.h lex.clixon_yang_parse.o : lex.clixon_yang_parse.c clixon_yang_parse.tab.h $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -Wno-error -c $< # json parser lex.clixon_json_parse.c : clixon_json_parse.l clixon_json_parse.tab.h $(LEX) -Pclixon_json_parse clixon_json_parse.l # -d is debug clixon_json_parse.tab.h: clixon_json_parse.y $(YACC) -l -d -b clixon_json_parse -p clixon_json_parse clixon_json_parse.y # -t is debug # extra rule to avoid parallell yaccs clixon_json_parse.tab.c: clixon_json_parse.tab.h lex.clixon_json_parse.o : lex.clixon_json_parse.c clixon_json_parse.tab.h $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -Wno-error -c $< # xpath parser lex.clixon_xpath_parse.c : clixon_xpath_parse.l clixon_xpath_parse.tab.h $(LEX) -Pclixon_xpath_parse clixon_xpath_parse.l # -d is debug clixon_xpath_parse.tab.h: clixon_xpath_parse.y $(YACC) -l -d -b clixon_xpath_parse -p clixon_xpath_parse clixon_xpath_parse.y # -t is debug # extra rule to avoid parallell yaccs clixon_xpath_parse.tab.c: clixon_xpath_parse.tab.h lex.clixon_xpath_parse.o : lex.clixon_xpath_parse.c clixon_xpath_parse.tab.h $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -Wno-error -c $< distclean: clean rm -f Makefile *~ .depend .SUFFIXES: .SUFFIXES: .c .o .c.o: $(GENSRC) $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -c $< .PHONY: build.c build.c: date +"const char CLIXON_BUILDSTR[64]=\"%Y.%m.%d %H:%M by `whoami` on `hostname`"\"\; > build.c; echo "const char CLIXON_VERSION[64]=\"$(CLIXON_VERSION)\""\; >> build.c; $(MYLIB) : $(GENOBJS) $(OBJS) ifeq ($(HOST_VENDOR),apple) $(CC) $(LDFLAGS) -shared -o $@ $(GENOBJS) $(OBJS) $(LIBS) -undefined dynamic_lookup -o $@ else $(CC) $(LDFLAGS) -shared -Wl,-soname,$(MYLIBSO) -o $@ $(GENOBJS) $(OBJS) $(LIBS) -Wl,-soname=$(MYLIBSO) endif # link-name is needed for application linking, eg for clixon_cli and clixon_config $(MYLIBLINK) : $(MYLIB) # ln -sf $(MYLIB) $@ # ar cru $@ $^ # ranlib $@ install: install-lib install-include: install-lib: $(MYLIB) $(INSTALL) -m 0755 -d $(DESTDIR)$(libdir) $(INSTALL_LIB) -m 0644 $(INSTALLFLAGS) $(MYLIB) $(DESTDIR)$(libdir) ln -sf $(MYLIB) $(DESTDIR)$(libdir)/$(MYLIBSO) # -l:libclixon.so.3 ln -sf $(MYLIBSO) $(DESTDIR)$(libdir)/$(MYLIBLINK) # -l:libclixon.so uninstall: rm -f $(DESTDIR)$(libdir)/$(MYLIBLINK)* TAGS: find . -name '*.[chyl]' -print | etags - depend: $(CC) $(DEPENDFLAGS) @DEFS@ $(INCLUDES) $(CFLAGS) -MM $(SRC) > .depend #include .depend