-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'tools-ynl-user-space-c'
Jakub Kicinski says: ==================== tools: ynl: user space C Use the code gen which is already in tree to generate a user space library for a handful of simple families. I find YNL C quite useful in some WIP projects, and I think others may find it useful, too. I was hoping someone will pick this work up and finish it... but it seems that Python YNL has largely stolen the thunder. Python may not be great for selftest, tho, and actually this lib is more fully-featured. The Python script was meant as a quick demo, funny how those things go. v2: https://lore.kernel.org/all/20230604175843.662084-1-kuba@kernel.org/ v1: https://lore.kernel.org/all/20230603052547.631384-1-kuba@kernel.org/ ==================== Link: https://lore.kernel.org/r/20230605190108.809439-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
- Loading branch information
Showing
15 changed files
with
2,466 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# SPDX-License-Identifier: GPL-2.0 | ||
|
||
SUBDIRS = lib generated samples | ||
|
||
all: $(SUBDIRS) | ||
|
||
$(SUBDIRS): | ||
@if [ -f "$@/Makefile" ] ; then \ | ||
$(MAKE) -C $@ ; \ | ||
fi | ||
|
||
clean hardclean: | ||
@for dir in $(SUBDIRS) ; do \ | ||
if [ -f "$$dir/Makefile" ] ; then \ | ||
$(MAKE) -C $$dir $@; \ | ||
fi \ | ||
done | ||
|
||
.PHONY: clean all $(SUBDIRS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# SPDX-License-Identifier: GPL-2.0 | ||
|
||
CC=gcc | ||
CFLAGS=-std=gnu11 -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshadow \ | ||
-I../lib/ | ||
ifeq ("$(DEBUG)","1") | ||
CFLAGS += -g -fsanitize=address -fsanitize=leak -static-libasan | ||
endif | ||
|
||
TOOL:=../ynl-gen-c.py | ||
|
||
GENS:=fou netdev | ||
SRCS=$(patsubst %,%-user.c,${GENS}) | ||
HDRS=$(patsubst %,%-user.h,${GENS}) | ||
OBJS=$(patsubst %,%-user.o,${GENS}) | ||
|
||
all: protos.a $(HDRS) $(SRCS) $(KHDRS) $(KSRCS) $(UAPI) regen | ||
|
||
protos.a: $(OBJS) | ||
@echo -e "\tAR $@" | ||
@ar rcs $@ $(OBJS) | ||
|
||
%-user.h: ../../../../Documentation/netlink/specs/%.yaml $(TOOL) | ||
@echo -e "\tGEN $@" | ||
@$(TOOL) --mode user --header --spec $< > $@ | ||
|
||
%-user.c: ../../../../Documentation/netlink/specs/%.yaml $(TOOL) | ||
@echo -e "\tGEN $@" | ||
@$(TOOL) --mode user --source --spec $< > $@ | ||
|
||
%-user.o: %-user.c %-user.h | ||
@echo -e "\tCC $@" | ||
@$(COMPILE.c) -c -o $@ $< | ||
|
||
clean: | ||
rm -f *.o | ||
|
||
hardclean: clean | ||
rm -f *.c *.h *.a | ||
|
||
regen: | ||
@../ynl-regen.sh | ||
|
||
.PHONY: all clean hardclean regen | ||
.DEFAULT_GOAL: all |
Oops, something went wrong.