From nobody Wed Dec 17 17:57:09 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E221F1FE45F for ; Wed, 8 Jan 2025 13:57:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736344628; cv=none; b=fph877iFYqFXe3S/wXISMsGPj2/xeVf/62SFWF4ZRUF73wBGqrlP406/c8EKe9+tAio7h6zlGCeox+DhcCOehstjmKGn9d3yYbit7gL+o/4jklKlFHtIvxs6PCA+nsfMisoT74sennyqwT3H5IlbffMnuuzjBWlwnG/hW6EbH4w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736344628; c=relaxed/simple; bh=dgb739Q2qPOzeOxuFTW//1gwqwRgxTJZnWz9xC0qBP4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=AsNkrkVx87RjgjKrGEMqXqliGFvS2imVcdfKL+K3GgXF+k8LEYo2kk6382MPjXMiVzxurrJgPdn1zhZllVgL/2muQhrilfvpbk3x7L90So/HgzOmRUWxQB79wBFPBGCEXad4PXnMuAxKvB+rRejBZoUmSWMca2GrJzqNmaM/0e0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=QcU7atCO; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QcU7atCO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736344625; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FuXC58lKPSKnc9DIEAeVOgswaDFI/mCcftf/6xtmMb8=; b=QcU7atCOqq91UMYP3JYiuUJWYRKKbu0R9tGZTwrw8Wh5ISjIH7l+uuOqtcrfUcBZj+h4if 1/sq5ZeegckDK33VUTx5mIvJSQzb/r08plWPyUQmkqPL3+gSq4CEASXWh77u8qegw0FTeh oxFtQW1aeSrfhumfPXPSQB2sCCOkk+g= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-355-2Uwi93idNGGjo5JUGo1Fcg-1; Wed, 08 Jan 2025 08:57:02 -0500 X-MC-Unique: 2Uwi93idNGGjo5JUGo1Fcg-1 X-Mimecast-MFC-AGG-ID: 2Uwi93idNGGjo5JUGo1Fcg Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7DD2919560BD; Wed, 8 Jan 2025 13:57:01 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.45.225.0]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AE6F6300018D; Wed, 8 Jan 2025 13:56:58 +0000 (UTC) From: Jan Stancek To: donald.hunter@gmail.com, stfomichev@gmail.com, kuba@kernel.org, jdamato@fastly.com Cc: pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, jstancek@redhat.com Subject: [PATCH v4 3/4] tools: ynl: add install target for generated content Date: Wed, 8 Jan 2025 14:56:16 +0100 Message-ID: <645c68e3d201f1ef4276e3daddfe06262a0c2804.1736343575.git.jstancek@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Content-Type: text/plain; charset="utf-8" Generate docs using ynl_gen_rst and add install target for headers, specs and generates rst files. Factor out SPECS_DIR since it's repeated many times. Signed-off-by: Jan Stancek Reviewed-by: Donald Hunter --- tools/net/ynl/generated/.gitignore | 1 + tools/net/ynl/generated/Makefile | 49 +++++++++++++++++++++++++----- 2 files changed, 43 insertions(+), 7 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/Mak= efile index 00af721b1571..21f9e299dc75 100644 --- a/tools/net/ynl/generated/Makefile +++ b/tools/net/ynl/generated/Makefile @@ -7,32 +7,44 @@ ifeq ("$(DEBUG)","1") CFLAGS +=3D -g -fsanitize=3Daddress -fsanitize=3Dleak -static-libasan endif =20 +INSTALL ?=3D install +prefix ?=3D /usr +datarootdir ?=3D $(prefix)/share +docdir ?=3D $(datarootdir)/doc +includedir ?=3D $(prefix)/include + include ../Makefile.deps =20 YNL_GEN_ARG_ethtool:=3D--user-header linux/ethtool_netlink.h \ --exclude-op stats-get =20 TOOL:=3D../pyynl/ynl_gen_c.py +TOOL_RST:=3D../pyynl/ynl_gen_rst.py =20 +SPECS_DIR:=3D../../../../Documentation/netlink/specs GENS_PATHS=3D$(shell grep -nrI --files-without-match \ 'protocol: netlink' \ - ../../../../Documentation/netlink/specs/) -GENS=3D$(patsubst ../../../../Documentation/netlink/specs/%.yaml,%,${GENS_= PATHS}) + $(SPECS_DIR)) +GENS=3D$(patsubst $(SPECS_DIR)/%.yaml,%,${GENS_PATHS}) SRCS=3D$(patsubst %,%-user.c,${GENS}) HDRS=3D$(patsubst %,%-user.h,${GENS}) OBJS=3D$(patsubst %,%-user.o,${GENS}) =20 -all: protos.a $(HDRS) $(SRCS) $(KHDRS) $(KSRCS) $(UAPI) +SPECS_PATHS=3D$(wildcard $(SPECS_DIR)/*.yaml) +SPECS=3D$(patsubst $(SPECS_DIR)/%.yaml,%,${SPECS_PATHS}) +RSTS=3D$(patsubst %,%.rst,${SPECS}) + +all: protos.a $(HDRS) $(SRCS) $(KHDRS) $(KSRCS) $(UAPI) $(RSTS) =20 protos.a: $(OBJS) @echo -e "\tAR $@" @ar rcs $@ $(OBJS) =20 -%-user.h: ../../../../Documentation/netlink/specs/%.yaml $(TOOL) +%-user.h: $(SPECS_DIR)/%.yaml $(TOOL) @echo -e "\tGEN $@" @$(TOOL) --mode user --header --spec $< -o $@ $(YNL_GEN_ARG_$*) =20 -%-user.c: ../../../../Documentation/netlink/specs/%.yaml $(TOOL) +%-user.c: $(SPECS_DIR)/%.yaml $(TOOL) @echo -e "\tGEN $@" @$(TOOL) --mode user --source --spec $< -o $@ $(YNL_GEN_ARG_$*) =20 @@ -40,14 +52,37 @@ protos.a: $(OBJS) @echo -e "\tCC $@" @$(COMPILE.c) $(CFLAGS_$*) -o $@ $< =20 +%.rst: $(SPECS_DIR)/%.yaml $(TOOL_RST) + @echo -e "\tGEN_RST $@" + @$(TOOL_RST) -o $@ -i $< + clean: rm -f *.o =20 distclean: clean - rm -f *.c *.h *.a + rm -f *.c *.h *.a *.rst =20 regen: @../ynl-regen.sh =20 -.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 $(SPECS_DIR)/*.yaml $(DESTDIR)$(datarootdir)/ynl/spec= s/ + +install: install-headers install-rsts install-specs + +.PHONY: all clean distclean regen install install-headers install-rsts ins= tall-specs .DEFAULT_GOAL: all --=20 2.43.0