File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- * .a
1+ * .a
2+ * .o
3+ lib /__pycache__ /
Original file line number Diff line number Diff line change 1+ # SPDX-License-Identifier: GPL-2.0
2+
3+ all : generated lib samples
4+
5+ lib :
6+ $(MAKE ) -C $@
7+
8+ generated :
9+ $(MAKE ) -C $@
10+
11+ samples :
12+ $(MAKE ) -C $@
13+
14+ libynl.a : ynl.o generated
15+ @echo -e " \tAR $@ "
16+ @ar rcs $@ ynl.o $(GENERATED )
17+
18+ clean :
19+ rm -f * .o * .d * ~
20+ $(MAKE ) -C generated $@
21+
22+ distclean : clean
23+ rm -f * .a
24+
25+ .PHONY : all clean generated lib samples
26+ .DEFAULT_GOAL =all
Original file line number Diff line number Diff line change @@ -5,7 +5,16 @@ YNL CPP is a best effort port of YNL C. Like YNL C is only supports
55static linking (because structs are auto-generated and may change
66version to version).
77
8- The best way of using it in your project is probably git submodule.
8+ The best way of using it in your project is probably git submodule,
9+ or possibly just copying in the right source files (YNL code is BSD
10+ licensed).
11+
12+ Dependencies
13+ ------------
14+
15+ This repo uses a Python code generator to turn the Netlink specs in YAML
16+ into C++ classes. Python support for YAML and JSON Schema are required.
17+ (``python3-jsonschema python3-yaml `` packages on Fedora).
918
1019Building ynl-cpp
1120----------------
@@ -14,10 +23,16 @@ The repo supports building code for a specific family::
1423
1524 make -C generated/ netdev_lib.a
1625
17- or a big archive with code for all families::
26+ or a big archive with code for all families (`` libynl.a ``) ::
1827
1928 make -C generated/
2029
30+ Building samples
31+ ----------------
32+
33+ Running ``make `` in the main directory will build a couple of simple
34+ sample apps under the ``samples/ `` directory.
35+
2136Updating to latest kernel versions
2237----------------------------------
2338
Original file line number Diff line number Diff line change 1+ ethtool
2+ netdev
Original file line number Diff line number Diff line change 1+ # SPDX-License-Identifier: GPL-2.0
2+
3+ include ../Makefile.deps
4+
5+ LDLIBS =../lib/ynl.a ../lib/ynl-cpp.a
6+
7+ CPPFLAGS += -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshadow \
8+ -I../lib/ -I../generated/ -idirafter $(UAPI_PATH )
9+
10+ SRCS =$(wildcard * .cpp)
11+ BINS =$(patsubst % .cpp,% ,${SRCS})
12+ PROTOS =$(wildcard ../generated/* .a)
13+
14+ include $(wildcard * .d)
15+
16+ all : $(BINS )
17+
18+ $(BINS ) : ../lib/ynl.a $(PROTOS ) $(SRCS )
19+ @echo -e ' \tCXX sample $@ '
20+ @$(COMPILE.cpp ) $(CPPFLAGS_$@ ) $@ .cpp -o $@ .o
21+ @$(LINK.cpp ) $@ .o -o $@ ../generated/$(patsubst % ,% _lib.a,$@ ) $(LDLIBS )
22+
23+ clean :
24+ rm -f * .o * .d * ~
25+
26+ distclean : clean
27+ rm -f $(BINS )
28+
29+ .PHONY : all clean distclean
30+ .DEFAULT_GOAL =all
You can’t perform that action at this time.
0 commit comments