[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [XEN PATCH v9 05/30] build: prepare to always invoke $(MAKE) from xen/, use $(obj)
On 1/25/22 06:00, Anthony PERARD wrote: > In a future patch, when building a subdirectory, we will set > "obj=$subdir" rather than change directory. > > Before that, we add "$(obj)" and "$(src)" in as many places as > possible where we will need to know which subdirectory is been built. > "$(obj)" is for files been generated during the build, and "$(src)" is > for files present in the source tree. > > For now, we set both to "." in Rules.mk and Makefile.clean. > > A few places don't tolerate the addition of "./", this is because make > remove the leading "./" in targets and dependencies in rules, so these > will be change later. > > Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx> > Acked-by: Jan Beulich <jbeulich@xxxxxxxx> > Acked-by: Julien Grall <jgrall@xxxxxxxxxx> > --- > > Notes: > v8: > - acked > - rebased > > xen/Rules.mk | 5 ++- > xen/arch/arm/Makefile | 14 ++++---- > xen/arch/x86/Makefile | 48 ++++++++++++------------- > xen/arch/x86/boot/Makefile | 14 ++++---- > xen/arch/x86/efi/Makefile | 6 ++-- > xen/common/Makefile | 8 ++--- > xen/common/libelf/Makefile | 4 +-- > xen/common/libfdt/Makefile | 6 ++-- > xen/include/Makefile | 44 +++++++++++------------ > xen/scripts/Makefile.clean | 5 ++- > xen/xsm/flask/Makefile | 36 +++++++++---------- > xen/xsm/flask/policy/mkaccess_vector.sh | 7 ++-- > 12 files changed, 103 insertions(+), 94 deletions(-) > <snip/> > diff --git a/xen/xsm/flask/Makefile b/xen/xsm/flask/Makefile > index 11c530dcf458..51fd37f6c4d5 100644 > --- a/xen/xsm/flask/Makefile > +++ b/xen/xsm/flask/Makefile > @@ -4,46 +4,46 @@ obj-y += flask_op.o > > obj-y += ss/ > > -CFLAGS-y += -I./include > +CFLAGS-y += -I$(obj)/include > > AWK = awk > > -FLASK_H_DEPEND = policy/security_classes policy/initial_sids > -AV_H_DEPEND = policy/access_vectors > +FLASK_H_DEPEND := $(addprefix $(src)/policy/,security_classes initial_sids) > +AV_H_DEPEND = $(src)/policy/access_vectors > > -FLASK_H_FILES = include/flask.h include/class_to_string.h > include/initial_sid_to_string.h > -AV_H_FILES = include/av_perm_to_string.h include/av_permissions.h > -ALL_H_FILES = $(FLASK_H_FILES) $(AV_H_FILES) > +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)) > > -$(obj-y) ss/built_in.o: $(ALL_H_FILES) > +$(addprefix $(obj)/,$(obj-y)) $(obj)/ss/built_in.o: $(addprefix > $(obj)/,$(ALL_H_FILES)) > extra-y += $(ALL_H_FILES) > > -mkflask := policy/mkflask.sh > +mkflask := $(src)/policy/mkflask.sh > quiet_cmd_mkflask = MKFLASK $@ > -cmd_mkflask = $(SHELL) $(mkflask) $(AWK) include $(FLASK_H_DEPEND) > +cmd_mkflask = $(SHELL) $(mkflask) $(AWK) $(obj)/include $(FLASK_H_DEPEND) > > -$(subst include/,%/,$(FLASK_H_FILES)): $(FLASK_H_DEPEND) $(mkflask) FORCE > +$(addprefix $(obj)/%/,$(FLASK_H_FILES)): $(FLASK_H_DEPEND) $(mkflask) FORCE > $(call if_changed,mkflask) > > -mkaccess := policy/mkaccess_vector.sh > +mkaccess := $(src)/policy/mkaccess_vector.sh > quiet_cmd_mkaccess = MKACCESS VECTOR $@ > -cmd_mkaccess = $(SHELL) $(mkaccess) $(AWK) $(AV_H_DEPEND) > +cmd_mkaccess = $(SHELL) $(mkaccess) $(AWK) $(obj)/include $(AV_H_DEPEND) > > -$(subst include/,%/,$(AV_H_FILES)): $(AV_H_DEPEND) $(mkaccess) FORCE > +$(addprefix $(obj)/%/,$(AV_H_FILES)): $(AV_H_DEPEND) $(mkaccess) FORCE > $(call if_changed,mkaccess) > > obj-bin-$(CONFIG_XSM_FLASK_POLICY) += flask-policy.o > -flask-policy.o: policy.bin > +$(obj)/flask-policy.o: $(obj)/policy.bin > > -flask-policy.S: BINFILE_FLAGS := -i > -flask-policy.S: $(BASEDIR)/tools/binfile FORCE > - $(call if_changed,binfile,policy.bin xsm_flask_init_policy) > +$(obj)/flask-policy.S: BINFILE_FLAGS := -i > +$(obj)/flask-policy.S: $(BASEDIR)/tools/binfile FORCE > + $(call if_changed,binfile,$(obj)/policy.bin xsm_flask_init_policy) > targets += flask-policy.S > > FLASK_BUILD_DIR := $(CURDIR) > POLICY_SRC := $(FLASK_BUILD_DIR)/xenpolicy-$(XEN_FULLVERSION) > > -policy.bin: FORCE > +$(obj)/policy.bin: FORCE > $(MAKE) -f $(XEN_ROOT)/tools/flask/policy/Makefile.common \ > -C $(XEN_ROOT)/tools/flask/policy \ > FLASK_BUILD_DIR=$(FLASK_BUILD_DIR) POLICY_FILENAME=$(POLICY_SRC) > diff --git a/xen/xsm/flask/policy/mkaccess_vector.sh > b/xen/xsm/flask/policy/mkaccess_vector.sh > index 942ede4713f1..ad9772193bff 100755 > --- a/xen/xsm/flask/policy/mkaccess_vector.sh > +++ b/xen/xsm/flask/policy/mkaccess_vector.sh > @@ -8,9 +8,12 @@ set -e > awk=$1 > shift > > +output_dir=$1 > +shift > + > # output files > -av_permissions="include/av_permissions.h" > -av_perm_to_string="include/av_perm_to_string.h" > +av_permissions="$output_dir/av_permissions.h" > +av_perm_to_string="$output_dir/av_perm_to_string.h" > > cat $* | $awk " > BEGIN { Reviewed-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx> V/r, Daniel P. Smith Apertus Solutions, LLC
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |