-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathMakefile.in
416 lines (374 loc) · 14.3 KB
/
Makefile.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
#
# Copyright (c) 2012-2014 CESNET, z.s.p.o.
#
# LICENSE TERMS
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name of the Company nor the names of its contributors
# may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# ALTERNATIVELY, provided that this notice is retained in full, this
# product may be distributed under the terms of the GNU General Public
# License (GPL) version 2 or later, in which case the provisions
# of the GPL apply INSTEAD OF those given above.
#
# This software is provided ``as is'', and any express or implied
# warranties, including, but not limited to, the implied warranties of
# merchantability and fitness for a particular purpose are disclaimed.
# In no event shall the company or contributors be liable for any
# direct, indirect, incidental, special, exemplary, or consequential
# damages (including, but not limited to, procurement of substitute
# goods or services; loss of use, data, or profits; or business
# interruption) however caused and on any theory of liability, whether
# in contract, strict liability, or tort (including negligence or
# otherwise) arising in any way out of the use of this software, even
# if advised of the possibility of such damage.
#
NAME = @PACKAGE_NAME@
LNCTOOL = dev-tools/lnctool/lnctool
# Various configurable paths (remember to edit Makefile.in, not Makefile)
srcdir = @srcdir@
abs_srcdir = @abs_srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
datadir = @datadir@
bindir = @bindir@
includedir = @includedir@
libdir = @libdir@
mandir = @mandir@
readlink = @READLINK@
libtool = @libtool@
VERSION = $(shell cut -f1 "$(srcdir)/VERSION" | tr -d '\n')
# version for soname:
ABICOMPAT_VER = $(shell echo $(VERSION) | cut -d. -f1,2)
RELEASE = @RELEASE@
# libtool version info
version_info = @LIBTOOL_VERSION_INFO@
CC = @CC@
DOXYGEN = @DOXYGEN@
DOXYGEN_CONFIG = Doxyfile
DOXYGEN_DIR = $(shell cat $(DOXYGEN_CONFIG) | grep '^OUTPUT_DIRECTORY' | sed 's/.*=//')
RPMBUILD = @RPMBUILD@
LDCONFIG = ldconfig
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_DOC = @INSTALL_DOC@
RPMDIR = RPMBUILD
NC_WORKINGDIR_PATH = $(DESTDIR)/@NC_WORKINGDIR_PATH@
NC_SESSIONFILE_PATH = $(DESTDIR)/@NC_SESSIONFILE_PATH@
NCNTF_STREAMS_MAX_SIZE_IN_MB = @NCNTF_STREAMS_MAX_SIZE_IN_MB@
NCNTF_STREAMS_PATH = $(DESTDIR)/@NCNTF_STREAMS_PATH@
SETBIT = @SETBIT@
SETUSER = @SETUSER@
SETGROUP = @SETGROUP@
IDGIT = "built from git $(shell git show --pretty=oneline | head -1 | cut -c -20)"
IDNOGIT = "released as version $(VERSION)"
LIBS = @LDFLAGS@ @LIBS@
CFLAGS = -Wall @CFLAGS@
CPPFLAGS = -DNC_WORKINGDIR_PATH=\"$(NC_WORKINGDIR_PATH)\" -DNC_SESSIONFILE_PATH=\"$(NC_SESSIONFILE_PATH)\" -DNCNTF_STREAMS_MAX_SIZE_IN_MB=$(NCNTF_STREAMS_MAX_SIZE_IN_MB) -DNCNTF_STREAMS_PATH=\"$(NCNTF_STREAMS_PATH)\" -DSETBIT=$(SETBIT) @CPPFLAGS@
LIBTOOL = $(libtool) --tag=CC --quiet
HAVE_PYANG = @HAVE_PYANG@
HAVE_XSLTPROC = @HAVE_XSLTPROC@
PYTHON = @PYTHON@
ifdef PYTHON
PYAPI = pyapi
TARBALLPYAPI = tarball-pyapi
TARBALLPYAPIDIR = python3-netconf-$(VERSION)
INSTALLPYAPI = install-pyapi
UNINSTALLPYAPI = uninstall-pyapi
DOXYGEN_CONFIG_PYTHON = Doxyfile.python
PYPREFIX = @PYPREFIX@
PYHDRS = doc/python/netconf.py
PYSRCS = python/netconf.c \
python/session.c
endif
INCLUDES= -I$(abs_srcdir)/src
ifeq "$(shell pwd)" "$(shell $(readlink) -f $(srcdir))"
OBJDIR = .obj
else
OBJDIR = .
VPATH = $(srcdir)
endif
SRCS = src/callbacks.c \
src/error.c \
src/internal.c \
src/compat.c \
src/messages.c \
src/session.c \
src/transport.c \
@SRCS_TRANSPORT@ \
@SRCS_NOTIFICATIONS@ \
src/with_defaults.c \
@SRCS_URL@ \
src/nacm.c \
src/datastore.c \
src/datastore/edit_config.c \
src/datastore/empty/datastore_empty.c \
src/datastore/file/datastore_file.c \
src/datastore/custom/datastore_custom.c \
src/transapi/transapi.c \
src/transapi/yinparser.c \
src/transapi/xmldiff.c
HDRS_PUBL_ROOT = headers/libnetconf.h \
headers/libnetconf_ssh.h \
@HDRS_PUBL_TLS@ \
headers/libnetconf_xml.h
HDRS_PUBL_SUBDIR = src/netconf.h \
src/callbacks.h \
src/callbacks_ssh.h \
src/error.h \
src/session.h \
src/messages.h \
src/messages_xml.h \
src/transport.h \
src/callhome.h \
@HDRS_PUBL_SUBDIR_NOTIFICATIONS@ \
src/with_defaults.h \
@HDRS_PUBL_SUBDIR_URL@ \
src/datastore.h \
src/datastore_xml.h \
src/datastore/custom/datastore_custom.h \
src/transapi.h
HDRS_PUBL = $(HDRS_PUBL_ROOT) $(HDRS_PUBL_SUBDIR)
SUBHEADERS_DIR = libnetconf
HDRS_PRIV = src/config.h.in \
src/libnetconf.h \
src/libnetconf_xml.h \
src/libnetconf_ssh.h \
@HDRS_PRIV_TLS@ \
src/callbacks.h \
src/callbacks_ssh.h \
src/error.h \
src/messages.h \
src/messages_internal.h \
src/messages_xml.h \
src/netconf.h \
src/netconf_internal.h \
src/session.h \
src/transport.h \
@HDRS_PRIV_TRANSPORT@ \
src/callhome.h \
@HDRS_PRIV_NOTIFICATIONS@ \
src/with_defaults.h \
@HDRS_PRIV_URL@ \
src/nacm.h \
src/datastore.h \
src/datastore/datastore_internal.h \
src/datastore/edit_config.h \
src/datastore/empty/datastore_empty.h \
src/datastore/file/datastore_file.h \
src/datastore/custom/datastore_custom.h \
src/datastore/custom/datastore_custom_private.h \
src/transapi/transapi_internal.h \
src/transapi/yinparser.h \
src/transapi/xmldiff.h
GENERATOR_FILES = dev-tools/lnctool/generator/Makefile.in \
dev-tools/lnctool/generator/configure.in \
dev-tools/lnctool/generator/install-sh \
dev-tools/lnctool/generator/config.guess \
dev-tools/lnctool/generator/config.sub \
dev-tools/lnctool/generator/ltmain.sh \
dev-tools/lnctool/generator/README
LNCDS_FILES = dev-tools/lncdatastore/main.c \
dev-tools/lncdatastore/commands.c \
dev-tools/lncdatastore/commands.h \
dev-tools/lncdatastore/mreadline.c \
dev-tools/lncdatastore/mreadline.h \
dev-tools/lncdatastore/Makefile.in
XML_SRCS = models/ietf-netconf-acm-config.rng.in
BUILT_RNGS = $(XML_SRCS:models/%.rng.in=models/%.rng)
models/%.rng: models/%.rng.in
@sed -e "s/\@DATAROOTDIR\@/$(subst /,\/,$(datarootdir))/g" $< > $@
LOBJS = $(SRCS:%.c=$(OBJDIR)/%.lo)
all: $(NAME).la $(LNCTOOL) $(BUILT_RNGS) $(PYAPI)
$(NAME).la: $(LOBJS)
@rm -f $@
$(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -version-number $(version_info) -no-undefined -o $@ $^ -rpath $(libdir)
.PHONY: $(LNCTOOL)
$(LNCTOOL): $(LNCTOOL).in
@if test -n "$(HAVE_PYANG)" -a -n "$(HAVE_XSLTPROC)"; then \
sed "s/@RNGLIB@/$(subst /,\/,@LNCTOOLDESTDIR@$(datadir)/$(NAME)/rnglib/)/g" $< | \
sed 's/@XSLTDIR@/$(subst /,\/,@LNCTOOLDESTDIR@$(datadir)/$(NAME)/xslt/)/g' | \
sed 's/@TEMPLATEDIR@/$(subst /,\/,@LNCTOOLDESTDIR@$(datadir)/$(NAME)/templates/)/g' > $(LNCTOOL).install; \
sed "s/@RNGLIB@/$(subst /,\/,$(abs_srcdir)/dev-tools/lnctool/rnglib/)/g" $< | \
sed 's/@XSLTDIR@/$(subst /,\/,$(abs_srcdir)/dev-tools/lnctool/xslt/)/g' | \
sed 's/@TEMPLATEDIR@/$(subst /,\/,$(abs_srcdir)/dev-tools/lnctool/generator/)/g' > $(LNCTOOL); \
chmod +x $(LNCTOOL) $(LNCTOOL).install; \
fi
.PHONY: pyapi
pyapi: $(PYSRCS) $(NAME).la
@cd python; $(PYTHON) ./setup.py build; cd -;
$(OBJDIR)/%.lo: %.c
@[ -d $$(dirname $@) ] || \
(mkdir -p $$(dirname $@))
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) $(DBG) -fPIC -c $< -o $@
.PHONY: doc
doc: doc/doxygen/html/index.html
doc/doxygen/html/index.html: $(DOXYGEN_CONFIG).in $(HDRS_PRIV) $(DOXYGEN_CONFIG_PYTHON) $(PYHDRS)
@if [ "$(DOXYGEN)" != "no" ]; then \
[ -d $(DOXYGEN_DIR) ] || mkdir -p $(DOXYGEN_DIR); \
$(DOXYGEN); \
if [ -n "$(DOXYGEN_CONFIG_PYTHON)" ]; then \
$(DOXYGEN) $(DOXYGEN_CONFIG_PYTHON); \
fi; \
else \
echo "Missing doxygen!"; \
fi;
.PHONY: dist
dist: $(NAME).spec tarball rpm
.PHONY: tarball
tarball: $(SRCS) $(HEADERS)
@rm -rf $(NAME)-$(VERSION);
@mkdir $(NAME)-$(VERSION);
for i in $(SRCS) $(HDRS_PUBL) $(HDRS_PRIV) configure.in configure \
headers/libnetconf.h.in headers/libnetconf_xml.h.in headers/libnetconf_ssh.h.in \
ltmain.sh Makefile.in VERSION $(NAME).spec.in $(NAME).pc.in $(LNCDS_FILES)\
dev-tools/lnctool/lnctool.in dev-tools/lnctool/rnglib/* dev-tools/lnctool/xslt/* dev-tools/lnctool/generator/*\
install-sh config.sub config.guess Doxyfile.in doc/img/*.png models/*; do \
[ -d $(NAME)-$(VERSION)/$$(dirname $$i) ] || (mkdir -p $(NAME)-$(VERSION)/$$(dirname $$i)); \
cp $$i $(NAME)-$(VERSION)/$$i; \
done;
@rm -rf $(RPMDIR)/SOURCES/; \
mkdir -p $(RPMDIR)/SOURCES/;
tar -c -z -f $(RPMDIR)/SOURCES/$(NAME)-$(VERSION)-$(RELEASE).tar.gz \
$(NAME)-$(VERSION); \
rm -rf $(NAME)-$(VERSION);
.PHONY: tarball-pyapi
tarball-pyapi: tarball
@rm -rf $(TARBALLPYAPIDIR);
@mkdir $(TARBALLPYAPIDIR);
for i in python/netconf.h python/netconf.c python/session.c python/setup.py; do \
cp $$i $(TARBALLPYAPIDIR)/$$(basename $$i); \
done;
@[ -d "$(RPMDIR)/SOURCES/" ] || (mkdir -p $(RPMDIR)/SOURCES/);
tar -c -z -f $(RPMDIR)/SOURCES/$(TARBALLPYAPIDIR)-$(RELEASE).tar.gz $(TARBALLPYAPIDIR); \
rm -rf $(TARBALLPYAPIDIR);
.PHONY: rpm
rpm: tarball $(TARBALLPYAPI)
if [ "$(RPMBUILD)" != "no" ]; then \
mkdir -p $(RPMDIR)/BUILD $(RPMDIR)/RPMS $(RPMDIR)/SRPMS; \
QA_RPATHS="[ 0x0001|0x0010 ]" $(RPMBUILD) -ba $(NAME).spec \
--define "_topdir `pwd`/$(RPMDIR)"; \
if [ -n "$(PYAPI)" ]; then \
$(RPMBUILD) -ba python/python3-netconf.spec \
--define "_topdir `pwd`/$(RPMDIR)"; \
fi \
else \
echo "Missing rpmbuild"; \
exit 1; \
fi
.PHONY: install
install: all install-bin install-devel $(INSTALL_DOC) $(INSTALLPYAPI)
.PHONY: install-bin
install-bin:
$(INSTALL) -m 775 -d $(DESTDIR)/$(libdir)
$(LIBTOOL) --mode=install cp $(NAME).la $(DESTDIR)/$(libdir)
$(LIBTOOL) --mode=finish $(DESTDIR)/$(libdir)
@if test "`id -u`" = "0"; then $(LDCONFIG); fi
[ -d "$(NC_WORKINGDIR_PATH)" ] || \
mkdir -p $(NC_WORKINGDIR_PATH)
chmod 700 $(NC_WORKINGDIR_PATH)
$(INSTALL_DATA) models/ietf-netconf-acm*.rng models/ietf-netconf-acm-schematron.xsl $(NC_WORKINGDIR_PATH)/
$(INSTALL_DATA) models/yin2yang.xsl $(NC_WORKINGDIR_PATH)/
@if test "$$(($(SETBIT) & 1))" = "1"; then \
if test -n "$(SETUSER)"; then \
chown $(SETUSER) $(NC_WORKINGDIR_PATH) || \
echo "WARNING: invalid group $(SETUSER)"; \
fi; \
fi; \
if test "$$(($(SETBIT) & 2))" = "2"; then \
chmod g+rwx $(NC_WORKINGDIR_PATH); \
if test -n "$(SETGROUP)"; then \
chown :$(SETGROUP) $(NC_WORKINGDIR_PATH) || \
echo "WARNING: invalid group $(SETGROUP)"; \
fi; \
fi; \
if test "$(SETBIT)" = "0"; then \
chmod a+rwx $(NC_WORKINGDIR_PATH); \
fi;
.PHONY: install-devel
install-devel: $(LNCTOOL) $(NAME).la $(HDRS_PUBL_ROOT) $(HDRS_PUBL_SUBDIR) $(NAME).pc
@[ -d $(DESTDIR)/$(libdir) ] || \
(mkdir -p $(DESTDIR)/$(libdir); chmod 755 $(DESTDIR)/$(libdir)); \
[ -d $(DESTDIR)/$(libdir)/pkgconfig ] || \
(mkdir -p $(DESTDIR)/$(libdir)/pkgconfig; chmod 755 $(DESTDIR)/$(libdir)/pkgconfig); \
[ -d $(DESTDIR)/$(includedir) ] || \
(mkdir -p $(DESTDIR)/$(includedir); chmod 755 $(DESTDIR)/$(includedir)); \
[ -d $(DESTDIR)/$(includedir)/$(SUBHEADERS_DIR) ] || \
(mkdir -p $(DESTDIR)/$(includedir)/$(SUBHEADERS_DIR)); \
[ -d $(DESTDIR)/$(datadir)/$(NAME)/rnglib ] || \
(mkdir -p $(DESTDIR)/$(datadir)/$(NAME)/rnglib); \
[ -d $(DESTDIR)/$(datadir)/$(NAME)/xslt ] || \
(mkdir -p $(DESTDIR)/$(datadir)/$(NAME)/xslt);
[ -d $(DESTDIR)/$(datadir)/$(NAME)/templates ] || \
(mkdir -p $(DESTDIR)/$(datadir)/$(NAME)/templates);
$(LIBTOOL) --mode=install cp $(NAME).la $(DESTDIR)/$(libdir); \
for i in $(HDRS_PUBL_ROOT); do \
$(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)/$(includedir)/$$(basename $$i); \
done; \
for i in $(HDRS_PUBL_SUBDIR); do \
$(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)/$(includedir)/$(SUBHEADERS_DIR)/$$(basename $$i); \
done;
$(INSTALL_DATA) $(NAME).pc $(DESTDIR)/$(libdir)/pkgconfig/$(NAME).pc;
[ -d $(DESTDIR)/$(bindir) ] || \
(mkdir -p $(DESTDIR)/$(bindir); chmod 755 $(DESTDIR)/$(bindir)); \
$(INSTALL_PROGRAM) $(LNCTOOL).install $(DESTDIR)/$(bindir)/lnctool; \
$(INSTALL_DATA) dev-tools/lnctool/rnglib/* $(DESTDIR)/$(datadir)/$(NAME)/rnglib/; \
$(INSTALL_DATA) dev-tools/lnctool/xslt/* $(DESTDIR)/$(datadir)/$(NAME)/xslt/;
$(INSTALL_DATA) dev-tools/lnctool/generator/* $(DESTDIR)/$(datadir)/$(NAME)/templates/;
.PHONY: install-doc
install-doc: doc
[ -d $(DESTDIR)/$(datadir)/$(NAME)/doxygen ] || \
(mkdir -p $(DESTDIR)/$(datadir)/$(NAME)/doxygen; \
chmod -R 755 $(DESTDIR)/$(datadir)/$(NAME))
cp -r $(DOXYGEN_DIR)/* $(DESTDIR)/$(datadir)/$(NAME)/doxygen/;
.PHONY: install-pyapi
install-pyapi: pyapi
@cd python; $(PYTHON) ./setup.py install --prefix=$(DESTDIR)/$(PYPREFIX); cd -;
.PHONY: uninstall
uninstall: uninstall-devel uninstall-doc $(UNINSTALLPYAPI)
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)/$(libdir)/libnetconf.la
[ ! -d $(DESTDIR)/$(libdir) ] || rmdir -p $(DESTDIR)/$(libdir) || echo "Directory already gone."
rm $(NC_WORKINGDIR_PATH)/ietf-netconf-acm*.rng $(NC_WORKINGDIR_PATH)/ietf-netconf-acm-schematron.xsl;
.PHONY: uninstall-devel
uninstall-devel:
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)/$(libdir)/libnetconf.la \
[ ! -d $(DESTDIR)/$(libdir) ] || rmdir -p $(DESTDIR)/$(libdir) || echo "Directory already gone."
for i in $(HDRS_PUBL_ROOT); do \
rm -f $(DESTDIR)/$(includedir)/$$(basename $$i); \
done; \
for i in $(HDRS_PUBL_SUBDIR); do \
rm -f $(DESTDIR)/$(includedir)/$(SUBHEADERS_DIR)/$$(basename $$i); \
done; \
rm -f $(DESTDIR)/$(libdir)/pkgconfig/$(NAME).pc; \
rm -f $(DESTDIR)/$(bindir)/lnctool; \
rm -rf $(DESTDIR)/$(datadir)/$(NAME)/rnglib/; \
rm -rf $(DESTDIR)/$(datadir)/$(NAME)/xslt/; \
rm -f $(DESTDIR)/$(bindir)/lncdatastore;
.PHONY: uninstall-doc
uninstall-doc:
rm -rf $(DESTDIR)/$(datadir)/$(NAME)/doxygen;
.PHONY: uninstall-pyapi
uninstall-pyapi:
@cd python; $(PYTHON) ./setup.py uninstall; cd -;
.PHONY: clean clean-all clean-doc clean-rpm
clean:
rm -rf *.a *.so* .obj $(OBJS) $(BUILT_RNGS) $(LNCTOOL) $(LNCTOOL).install python/build
$(LIBTOOL) --mode clean rm -f $(LOBJS)
$(LIBTOOL) --mode clean rm -f $(NAME).la
clean-all: clean clean-doc clean-rpm
clean-doc:
rm -rf $(DOXYGEN_DIR);
clean-rpm:
rm -rf $(RPMDIR)