Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1# SPDX-License-Identifier: GPL-2.0
2
3include ../../scripts/Makefile.arch
4
5INSTALL ?= install
6prefix ?= /usr
7ifeq ($(LP64), 1)
8 libdir_relative = lib64
9else
10 libdir_relative = lib
11endif
12libdir ?= $(prefix)/$(libdir_relative)
13includedir ?= $(prefix)/include
14
15SPECDIR=../../../Documentation/netlink/specs
16
17SUBDIRS = lib generated samples ynltool tests
18
19all: $(SUBDIRS) libynl.a
20
21ynltool: | lib generated libynl.a
22samples: | lib generated
23libynl.a: | lib generated
24 @echo -e "\tAR $@"
25 @ar rcs $@ lib/ynl.o generated/*-user.o
26
27$(SUBDIRS):
28 @if [ -f "$@/Makefile" ] ; then \
29 $(MAKE) -C $@ ; \
30 fi
31
32clean distclean:
33 @for dir in $(SUBDIRS) ; do \
34 if [ -f "$$dir/Makefile" ] ; then \
35 $(MAKE) -C $$dir $@; \
36 fi \
37 done
38 rm -f libynl.a
39 rm -rf pyynl/__pycache__
40 rm -rf pyynl/lib/__pycache__
41 rm -rf pyynl.egg-info
42 rm -rf build
43
44install: libynl.a lib/*.h ynltool
45 @echo -e "\tINSTALL libynl.a"
46 @$(INSTALL) -d $(DESTDIR)$(libdir)
47 @$(INSTALL) -m 0644 libynl.a $(DESTDIR)$(libdir)/libynl.a
48 @echo -e "\tINSTALL libynl headers"
49 @$(INSTALL) -d $(DESTDIR)$(includedir)/ynl
50 @$(INSTALL) -m 0644 lib/*.h $(DESTDIR)$(includedir)/ynl/
51 @echo -e "\tINSTALL pyynl"
52 @pip install --prefix=$(DESTDIR)$(prefix) .
53 @make -C generated install
54 @make -C ynltool install
55
56run_tests:
57 @$(MAKE) -C tests run_tests
58
59lint:
60 yamllint $(SPECDIR)
61
62schema_check:
63 @N=1; \
64 for spec in $(SPECDIR)/*.yaml ; do \
65 NAME=$$(basename $$spec) ; \
66 OUTPUT=$$(./pyynl/cli.py --spec $$spec --validate) ; \
67 if [ $$? -eq 0 ] ; then \
68 echo "ok $$N $$NAME schema validation" ; \
69 else \
70 echo "not ok $$N $$NAME schema validation" ; \
71 echo "$$OUTPUT" ; \
72 echo ; \
73 fi ; \
74 N=$$((N+1)) ; \
75 done
76
77.PHONY: all clean distclean install run_tests lint schema_check $(SUBDIRS)