netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Donald Hunter <donald.hunter@gmail.com>
To: Jan Stancek <jstancek@redhat.com>
Cc: stfomichev@gmail.com,  kuba@kernel.org,  jdamato@fastly.com,
	pabeni@redhat.com,  davem@davemloft.net,  edumazet@google.com,
	horms@kernel.org,  netdev@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 3/4] tools: ynl: add install target for generated content
Date: Mon, 16 Dec 2024 14:01:06 +0000	[thread overview]
Message-ID: <m2a5cv917h.fsf@gmail.com> (raw)
In-Reply-To: <a2e4ffb9cbd4a9c2fd0d7944b603794bff66e593.1734345017.git.jstancek@redhat.com> (Jan Stancek's message of "Mon, 16 Dec 2024 11:41:43 +0100")

Jan Stancek <jstancek@redhat.com> writes:

> Generate docs using ynl_gen_rst and add install target for
> headers, specs and generates rst files.
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
>  tools/net/ynl/generated/.gitignore |  1 +
>  tools/net/ynl/generated/Makefile   | 40 +++++++++++++++++++++++++++---
>  2 files changed, 38 insertions(+), 3 deletions(-)
>
> diff --git a/tools/net/ynl/generated/.gitignore b/tools/net/ynl/generated/.gitignore
> index ade488626d26..859a6fb446e1 100644
> --- a/tools/net/ynl/generated/.gitignore
> +++ b/tools/net/ynl/generated/.gitignore
> @@ -1,2 +1,3 @@
>  *-user.c
>  *-user.h
> +*.rst
> diff --git a/tools/net/ynl/generated/Makefile b/tools/net/ynl/generated/Makefile
> index 00af721b1571..208f7fead784 100644
> --- a/tools/net/ynl/generated/Makefile
> +++ b/tools/net/ynl/generated/Makefile
> @@ -7,12 +7,19 @@ ifeq ("$(DEBUG)","1")
>    CFLAGS += -g -fsanitize=address -fsanitize=leak -static-libasan
>  endif
>  
> +INSTALL	    ?= install

nit: mix of tabs and spaces here

> +prefix      ?= /usr
> +datarootdir ?= $(prefix)/share
> +docdir      ?= $(datarootdir)/doc
> +includedir  ?= $(prefix)/include
> +
>  include ../Makefile.deps
>  
>  YNL_GEN_ARG_ethtool:=--user-header linux/ethtool_netlink.h \
>  	--exclude-op stats-get
>  
>  TOOL:=../pyynl/ynl_gen_c.py
> +TOOL_RST:=../pyynl/ynl_gen_rst.py
>  
>  GENS_PATHS=$(shell grep -nrI --files-without-match \
>  		'protocol: netlink' \
> @@ -22,7 +29,11 @@ SRCS=$(patsubst %,%-user.c,${GENS})
>  HDRS=$(patsubst %,%-user.h,${GENS})
>  OBJS=$(patsubst %,%-user.o,${GENS})
>  
> -all: protos.a $(HDRS) $(SRCS) $(KHDRS) $(KSRCS) $(UAPI)
> +SPECS_PATHS=$(wildcard ../../../../Documentation/netlink/specs/*.yaml)

You missed Jakub's request to factor out SPECS_DIR:

  Maybe factor out:

  SPECS_DIR := ../../../../Documentation/netlink/specs

  ? It's pretty long and we repeat it all over the place.

> +SPECS=$(patsubst ../../../../Documentation/netlink/specs/%.yaml,%,${SPECS_PATHS})
> +RSTS=$(patsubst %,%.rst,${SPECS})
> +
> +all: protos.a $(HDRS) $(SRCS) $(KHDRS) $(KSRCS) $(UAPI) $(RSTS)
>  
>  protos.a: $(OBJS)
>  	@echo -e "\tAR $@"
> @@ -40,8 +51,12 @@ protos.a: $(OBJS)
>  	@echo -e "\tCC $@"
>  	@$(COMPILE.c) $(CFLAGS_$*) -o $@ $<
>  
> +%.rst: ../../../../Documentation/netlink/specs/%.yaml $(TOOL2)

Did you miss Jakub's review comment: TOOL2 -> TOOL_RST ?

> +	@echo -e "\tGEN_RST $@"
> +	@$(TOOL_RST) -o $@ -i $<
> +
>  clean:
> -	rm -f *.o
> +	rm -f *.o *.rst

Also Jakub's comment:

  No strong preference but I'd count .rst as final artifacts so I'd clean
  them up in distclean target only, not the clean target. The distinction
  itself may be a local custom..

>  distclean: clean
>  	rm -f *.c *.h *.a
> @@ -49,5 +64,24 @@ distclean: clean
>  regen:
>  	@../ynl-regen.sh
>  
> -.PHONY: all clean distclean regen
> +install-headers: $(HDRS)
> +	@echo -e "\tINSTALL generated headers"
> +	@$(INSTALL) -d $(DESTDIR)$(includedir)/ynl
> +	@$(INSTALL) -m 0644 *.h $(DESTDIR)$(includedir)/ynl/
> +
> +install-rsts: $(RSTS)
> +	@echo -e "\tINSTALL generated docs"
> +	@$(INSTALL) -d $(DESTDIR)$(docdir)/ynl
> +	@$(INSTALL) -m 0644 $(RSTS) $(DESTDIR)$(docdir)/ynl/
> +
> +install-specs:
> +	@echo -e "\tINSTALL specs"
> +	@$(INSTALL) -d $(DESTDIR)$(datarootdir)/ynl
> +	@$(INSTALL) -m 0644 ../../../../Documentation/netlink/*.yaml $(DESTDIR)$(datarootdir)/ynl/
> +	@$(INSTALL) -d $(DESTDIR)$(datarootdir)/ynl/specs
> +	@$(INSTALL) -m 0644 ../../../../Documentation/netlink/specs/*.yaml $(DESTDIR)$(datarootdir)/ynl/specs/
> +
> +install: install-headers install-rsts install-specs
> +
> +.PHONY: all clean distclean regen install install-headers install-rsts install-specs
>  .DEFAULT_GOAL: all

  reply	other threads:[~2024-12-16 14:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-16 10:41 [PATCH v3 0/4] tools: ynl: add install target Jan Stancek
2024-12-16 10:41 ` [PATCH v3 1/4] tools: ynl: move python code to separate sub-directory Jan Stancek
2024-12-16 13:45   ` Donald Hunter
2024-12-16 10:41 ` [PATCH v3 2/4] tools: ynl: add initial pyproject.toml for packaging Jan Stancek
2024-12-16 13:52   ` Donald Hunter
2025-01-06 11:57     ` Jan Stancek
2024-12-16 10:41 ` [PATCH v3 3/4] tools: ynl: add install target for generated content Jan Stancek
2024-12-16 14:01   ` Donald Hunter [this message]
2025-01-06 11:35     ` Jan Stancek
2024-12-16 10:41 ` [PATCH v3 4/4] tools: ynl: add main install target Jan Stancek
2024-12-16 14:09   ` Donald Hunter
2024-12-16 22:58   ` Joe Damato

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2a5cv917h.fsf@gmail.com \
    --to=donald.hunter@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jdamato@fastly.com \
    --cc=jstancek@redhat.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stfomichev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).