diff mbox series

selinux: more Makefile tweaks

Message ID 20230505224835.644278-1-paul@paul-moore.com (mailing list archive)
State Accepted
Delegated to: Paul Moore
Headers show
Series selinux: more Makefile tweaks | expand

Commit Message

Paul Moore May 5, 2023, 10:48 p.m. UTC
A few small tweaks to improve the SELinux Makefile:

- Define a new variable, 'genhdrs', to represent both flask.h and
  av_permissions.h; this should help ensure consistent processing for
  both generated headers.

- Move the 'ccflags-y' variable closer to the top, just after the
  main 'obj-$(CONFIG_SECURITY_SELINUX)' definition to make it more
  visible and improve the grouping in the Makefile.

- Rework some of the vertical whitespace to improve some of the
  grouping in the Makefile.

Signed-off-by: Paul Moore <paul@paul-moore.com>
---
 security/selinux/Makefile | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

Comments

Ondrej Mosnacek May 6, 2023, 9:23 a.m. UTC | #1
On Sat, May 6, 2023 at 12:50 AM Paul Moore <paul@paul-moore.com> wrote:
>
> A few small tweaks to improve the SELinux Makefile:
>
> - Define a new variable, 'genhdrs', to represent both flask.h and
>   av_permissions.h; this should help ensure consistent processing for
>   both generated headers.
>
> - Move the 'ccflags-y' variable closer to the top, just after the
>   main 'obj-$(CONFIG_SECURITY_SELINUX)' definition to make it more
>   visible and improve the grouping in the Makefile.
>
> - Rework some of the vertical whitespace to improve some of the
>   grouping in the Makefile.
>
> Signed-off-by: Paul Moore <paul@paul-moore.com>
> ---
>  security/selinux/Makefile | 19 +++++++++----------
>  1 file changed, 9 insertions(+), 10 deletions(-)

LGTM,

Reviewed-by: Ondrej Mosnacek <omosnace@redhat.com>
Paul Moore May 8, 2023, 8:28 p.m. UTC | #2
On Sat, May 6, 2023 at 5:23 AM Ondrej Mosnacek <omosnace@redhat.com> wrote:
> On Sat, May 6, 2023 at 12:50 AM Paul Moore <paul@paul-moore.com> wrote:
> >
> > A few small tweaks to improve the SELinux Makefile:
> >
> > - Define a new variable, 'genhdrs', to represent both flask.h and
> >   av_permissions.h; this should help ensure consistent processing for
> >   both generated headers.
> >
> > - Move the 'ccflags-y' variable closer to the top, just after the
> >   main 'obj-$(CONFIG_SECURITY_SELINUX)' definition to make it more
> >   visible and improve the grouping in the Makefile.
> >
> > - Rework some of the vertical whitespace to improve some of the
> >   grouping in the Makefile.
> >
> > Signed-off-by: Paul Moore <paul@paul-moore.com>
> > ---
> >  security/selinux/Makefile | 19 +++++++++----------
> >  1 file changed, 9 insertions(+), 10 deletions(-)
>
> LGTM,
>
> Reviewed-by: Ondrej Mosnacek <omosnace@redhat.com>

Thanks for taking a look.  Merged into selinux/next.
diff mbox series

Patch

diff --git a/security/selinux/Makefile b/security/selinux/Makefile
index 0aecf9334ec3..ab8c3093d5fd 100644
--- a/security/selinux/Makefile
+++ b/security/selinux/Makefile
@@ -5,26 +5,25 @@ 
 
 obj-$(CONFIG_SECURITY_SELINUX) := selinux.o
 
+ccflags-y := -I$(srctree)/security/selinux -I$(srctree)/security/selinux/include
+
 selinux-y := avc.o hooks.o selinuxfs.o netlink.o nlmsgtab.o netif.o \
 	     netnode.o netport.o status.o \
 	     ss/ebitmap.o ss/hashtab.o ss/symtab.o ss/sidtab.o ss/avtab.o \
 	     ss/policydb.o ss/services.o ss/conditional.o ss/mls.o ss/context.o
 
 selinux-$(CONFIG_SECURITY_NETWORK_XFRM) += xfrm.o
-
 selinux-$(CONFIG_NETLABEL) += netlabel.o
-
 selinux-$(CONFIG_SECURITY_INFINIBAND) += ibpkey.o
-
 selinux-$(CONFIG_IMA) += ima.o
 
-ccflags-y := -I$(srctree)/security/selinux -I$(srctree)/security/selinux/include
+genhdrs := flask.h av_permissions.h
 
-$(addprefix $(obj)/,$(selinux-y)): $(obj)/flask.h
+$(addprefix $(obj)/,$(selinux-y)): $(addprefix $(obj)/,$(genhdrs))
 
-quiet_cmd_flask = GEN     $(obj)/flask.h $(obj)/av_permissions.h
-      cmd_flask = $< $(obj)/flask.h $(obj)/av_permissions.h
+quiet_cmd_genhdrs = GEN     $(addprefix $(obj)/,$(genhdrs))
+      cmd_genhdrs = $< $(addprefix $(obj)/,$(genhdrs))
 
-targets += flask.h av_permissions.h
-$(obj)/flask.h $(obj)/av_permissions.h &: scripts/selinux/genheaders/genheaders FORCE
-	$(call if_changed,flask)
+targets += $(genhdrs)
+$(addprefix $(obj)/,$(genhdrs)) &: scripts/selinux/genheaders/genheaders FORCE
+	$(call if_changed,genhdrs)