xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [XEN PATCH] build: fix building flask headers before descending in flask/ss/
@ 2023-01-20 13:36 Anthony PERARD
  2023-01-20 14:13 ` Daniel P. Smith
  2023-01-20 14:16 ` Jan Beulich
  0 siblings, 2 replies; 4+ messages in thread
From: Anthony PERARD @ 2023-01-20 13:36 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Daniel P. Smith

Unfortunatly, adding prerequisite to "$(obj)/ss/built_in.o" doesn't
work because we have "$(obj)/%/built_in.o: $(obj)/% ;" in Rules.mk.
So, make is allow to try to build objects in "xsm/flask/ss/" before
generating the headers.

Adding a prerequisite on "$(obj)/ss" instead will fix the issue has
that the target used to run make in this subdirectory.

Unfortunatly, that target is also used when running `make clean`, so
we need to ignore it in this case. $(MAKECMDGOALS) can't be used in
this case as it is empty, but we can guess which operation is done by
looking at the list of loaded makefiles.

Fixes: 7a3bcd2babcc ("build: build everything from the root dir, use obj=$subdir")
Reported-by: "Daniel P. Smith" <dpsmith@apertussolutions.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/xsm/flask/Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/xen/xsm/flask/Makefile b/xen/xsm/flask/Makefile
index d25312f4fa..2d24346ee3 100644
--- a/xen/xsm/flask/Makefile
+++ b/xen/xsm/flask/Makefile
@@ -16,7 +16,11 @@ FLASK_H_FILES := flask.h class_to_string.h initial_sid_to_string.h
 AV_H_FILES := av_perm_to_string.h av_permissions.h
 ALL_H_FILES := $(addprefix include/,$(FLASK_H_FILES) $(AV_H_FILES))
 
-$(addprefix $(obj)/,$(obj-y)) $(obj)/ss/built_in.o: $(addprefix $(obj)/,$(ALL_H_FILES))
+# Adding prerequisite to descending into ss/ folder only when not running `make
+# clean`.
+ifeq ($(filter %/Makefile.clean,$(MAKEFILE_LIST)),)
+$(addprefix $(obj)/,$(obj-y)) $(obj)/ss: $(addprefix $(obj)/,$(ALL_H_FILES))
+endif
 extra-y += $(ALL_H_FILES)
 
 mkflask := $(srcdir)/policy/mkflask.sh
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [XEN PATCH] build: fix building flask headers before descending in flask/ss/
  2023-01-20 13:36 [XEN PATCH] build: fix building flask headers before descending in flask/ss/ Anthony PERARD
@ 2023-01-20 14:13 ` Daniel P. Smith
  2023-01-20 14:16 ` Jan Beulich
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel P. Smith @ 2023-01-20 14:13 UTC (permalink / raw)
  To: Anthony PERARD, xen-devel

On 1/20/23 08:36, Anthony PERARD wrote:
> Unfortunatly, adding prerequisite to "$(obj)/ss/built_in.o" doesn't
> work because we have "$(obj)/%/built_in.o: $(obj)/% ;" in Rules.mk.
> So, make is allow to try to build objects in "xsm/flask/ss/" before
> generating the headers.
> 
> Adding a prerequisite on "$(obj)/ss" instead will fix the issue has
> that the target used to run make in this subdirectory.
> 
> Unfortunatly, that target is also used when running `make clean`, so
> we need to ignore it in this case. $(MAKECMDGOALS) can't be used in
> this case as it is empty, but we can guess which operation is done by
> looking at the list of loaded makefiles.
> 
> Fixes: 7a3bcd2babcc ("build: build everything from the root dir, use obj=$subdir")
> Reported-by: "Daniel P. Smith" <dpsmith@apertussolutions.com>
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> ---
>   xen/xsm/flask/Makefile | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/xsm/flask/Makefile b/xen/xsm/flask/Makefile
> index d25312f4fa..2d24346ee3 100644
> --- a/xen/xsm/flask/Makefile
> +++ b/xen/xsm/flask/Makefile
> @@ -16,7 +16,11 @@ FLASK_H_FILES := flask.h class_to_string.h initial_sid_to_string.h
>   AV_H_FILES := av_perm_to_string.h av_permissions.h
>   ALL_H_FILES := $(addprefix include/,$(FLASK_H_FILES) $(AV_H_FILES))
>   
> -$(addprefix $(obj)/,$(obj-y)) $(obj)/ss/built_in.o: $(addprefix $(obj)/,$(ALL_H_FILES))
> +# Adding prerequisite to descending into ss/ folder only when not running `make
> +# clean`.
> +ifeq ($(filter %/Makefile.clean,$(MAKEFILE_LIST)),)
> +$(addprefix $(obj)/,$(obj-y)) $(obj)/ss: $(addprefix $(obj)/,$(ALL_H_FILES))
> +endif
>   extra-y += $(ALL_H_FILES)
>   
>   mkflask := $(srcdir)/policy/mkflask.sh

It builds for me, but I also do not have a large enough system to do a 
`-j16` to confirm it at the scale for which it occurred. Regardless, I 
will ack it.

Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [XEN PATCH] build: fix building flask headers before descending in flask/ss/
  2023-01-20 13:36 [XEN PATCH] build: fix building flask headers before descending in flask/ss/ Anthony PERARD
  2023-01-20 14:13 ` Daniel P. Smith
@ 2023-01-20 14:16 ` Jan Beulich
  2023-01-20 14:30   ` Anthony PERARD
  1 sibling, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2023-01-20 14:16 UTC (permalink / raw)
  To: Anthony PERARD; +Cc: Daniel P. Smith, xen-devel

On 20.01.2023 14:36, Anthony PERARD wrote:
> Unfortunatly, adding prerequisite to "$(obj)/ss/built_in.o" doesn't
> work because we have "$(obj)/%/built_in.o: $(obj)/% ;" in Rules.mk.
> So, make is allow to try to build objects in "xsm/flask/ss/" before
> generating the headers.
> 
> Adding a prerequisite on "$(obj)/ss" instead will fix the issue has
> that the target used to run make in this subdirectory.

DYM "... the issue, as that's ..."?

> Unfortunatly, that target is also used when running `make clean`, so
> we need to ignore it in this case. $(MAKECMDGOALS) can't be used in

s/need/want/, I guess, as nothing would break, we'd just create files
only to delete them again right away?

> this case as it is empty, but we can guess which operation is done by
> looking at the list of loaded makefiles.
> 
> Fixes: 7a3bcd2babcc ("build: build everything from the root dir, use obj=$subdir")
> Reported-by: "Daniel P. Smith" <dpsmith@apertussolutions.com>
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>

> --- a/xen/xsm/flask/Makefile
> +++ b/xen/xsm/flask/Makefile
> @@ -16,7 +16,11 @@ FLASK_H_FILES := flask.h class_to_string.h initial_sid_to_string.h
>  AV_H_FILES := av_perm_to_string.h av_permissions.h
>  ALL_H_FILES := $(addprefix include/,$(FLASK_H_FILES) $(AV_H_FILES))
>  
> -$(addprefix $(obj)/,$(obj-y)) $(obj)/ss/built_in.o: $(addprefix $(obj)/,$(ALL_H_FILES))
> +# Adding prerequisite to descending into ss/ folder only when not running `make
> +# clean`.

That's then for all "clean" targets, isn't it? I.e. maybe better to refer to
`make *clean` (or `make %clean`, but I think the % could be misleading there)?

I'm happy to make adjustments while committing, as long (or as far) as you
agree with me doing so.

Jan


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [XEN PATCH] build: fix building flask headers before descending in flask/ss/
  2023-01-20 14:16 ` Jan Beulich
@ 2023-01-20 14:30   ` Anthony PERARD
  0 siblings, 0 replies; 4+ messages in thread
From: Anthony PERARD @ 2023-01-20 14:30 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Daniel P. Smith, xen-devel

On Fri, Jan 20, 2023 at 03:16:51PM +0100, Jan Beulich wrote:
> On 20.01.2023 14:36, Anthony PERARD wrote:
> > Unfortunatly, adding prerequisite to "$(obj)/ss/built_in.o" doesn't
> > work because we have "$(obj)/%/built_in.o: $(obj)/% ;" in Rules.mk.
> > So, make is allow to try to build objects in "xsm/flask/ss/" before
> > generating the headers.
> > 
> > Adding a prerequisite on "$(obj)/ss" instead will fix the issue has
> > that the target used to run make in this subdirectory.
> 
> DYM "... the issue, as that's ..."?

Yes.

> > Unfortunatly, that target is also used when running `make clean`, so
> > we need to ignore it in this case. $(MAKECMDGOALS) can't be used in
> 
> s/need/want/, I guess, as nothing would break, we'd just create files
> only to delete them again right away?

Actually, I did found out that the "FORCE" target doesn't exist in
Makefile.clean, which is why I had to avoid the rule on `make clean`.
But I don't think that needs fixing.

But you can s/need/want/.

> > this case as it is empty, but we can guess which operation is done by
> > looking at the list of loaded makefiles.
> > 
> > Fixes: 7a3bcd2babcc ("build: build everything from the root dir, use obj=$subdir")
> > Reported-by: "Daniel P. Smith" <dpsmith@apertussolutions.com>
> > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> 
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> 
> > --- a/xen/xsm/flask/Makefile
> > +++ b/xen/xsm/flask/Makefile
> > @@ -16,7 +16,11 @@ FLASK_H_FILES := flask.h class_to_string.h initial_sid_to_string.h
> >  AV_H_FILES := av_perm_to_string.h av_permissions.h
> >  ALL_H_FILES := $(addprefix include/,$(FLASK_H_FILES) $(AV_H_FILES))
> >  
> > -$(addprefix $(obj)/,$(obj-y)) $(obj)/ss/built_in.o: $(addprefix $(obj)/,$(ALL_H_FILES))
> > +# Adding prerequisite to descending into ss/ folder only when not running `make
> > +# clean`.
> 
> That's then for all "clean" targets, isn't it? I.e. maybe better to refer to
> `make *clean` (or `make %clean`, but I think the % could be misleading there)?

Yes, all clean targets. Referring to `make *clean` sounds good.

> I'm happy to make adjustments while committing, as long (or as far) as you
> agree with me doing so.

Yes.

Thanks,

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-20 14:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-20 13:36 [XEN PATCH] build: fix building flask headers before descending in flask/ss/ Anthony PERARD
2023-01-20 14:13 ` Daniel P. Smith
2023-01-20 14:16 ` Jan Beulich
2023-01-20 14:30   ` Anthony PERARD

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).