* [PATCH 1/2] Makefile: libfdt: build only the strict necessary
2020-04-11 9:22 [PATCH v3 0/2] Makefile: libfdt: build only the strict necessary Claudio Fontana
@ 2020-04-11 9:22 ` Claudio Fontana
2020-04-11 9:22 ` Claudio Fontana
2020-04-11 9:22 ` [PATCH 2/2] Makefile: remove old compatibility gunks Claudio Fontana
2 siblings, 0 replies; 5+ messages in thread
From: Claudio Fontana @ 2020-04-11 9:22 UTC (permalink / raw)
To: Peter Maydell, David Gibson, Philippe Mathieu-Daude, Markus Armbruster
Cc: Claudio Fontana, Alex Bennee, Laurent Vivier, qemu-devel
when building dtc/libfdt, we were previously using dtc/Makefile,
which tries to build some artifacts that are not needed,
and can complain on stderr about the absence of tools that
are not required to build just libfdt.
Instead, build only the strict necessary to get libfdt.a .
Signed-off-by: Claudio Fontana <cfontana@suse.de>
---
Makefile | 21 +++++++++++++--------
configure | 4 ----
rules.mak | 2 ++
3 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/Makefile b/Makefile
index 84ef881600..7be15eeb7c 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,10 @@ ifneq ($(words $(subst :, ,$(CURDIR))), 1)
$(error main directory cannot contain spaces nor colons)
endif
+# some pattern rules in rules.mak are confused by an empty DSOSUF,
+# and UNCHECKED_GOALS for testing (docker-) can run without prior configure.
+DSOSUF ?= ".so"
+
# Always point to the root of the build tree (needs GNU make).
BUILD_DIR=$(CURDIR)
@@ -526,15 +530,17 @@ $(SOFTMMU_FUZZ_RULES): $(edk2-decompressed)
$(TARGET_DIRS_RULES):
$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" $(notdir $@),)
-DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_srcdir=$(SRC_PATH)/dtc/libfdt
-DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
-DTC_CPPFLAGS=-I$(BUILD_DIR)/dtc -I$(SRC_PATH)/dtc -I$(SRC_PATH)/dtc/libfdt
-
+LIBFDT_objdir = dtc/libfdt
+-include $(SRC_PATH)/dtc/libfdt/Makefile.libfdt
+LIBFDT_objects = $(addprefix $(LIBFDT_objdir)/, $(LIBFDT_OBJS))
+# the name dtc/all is for backward compatibility
.PHONY: dtc/all
-dtc/all: .git-submodule-status dtc/libfdt dtc/tests
- $(call quiet-command,$(MAKE) $(DTC_MAKE_ARGS) CPPFLAGS="$(DTC_CPPFLAGS)" CFLAGS="$(DTC_CFLAGS)" LDFLAGS="$(QEMU_LDFLAGS)" ARFLAGS="$(ARFLAGS)" CC="$(CC)" AR="$(AR)" LD="$(LD)" $(SUBDIR_MAKEFLAGS) libfdt/libfdt.a,)
+dtc/all: .git-submodule-status $(LIBFDT_objdir)/libfdt.a
+$(LIBFDT_objdir)/libfdt.a: $(LIBFDT_objects)
+ $(if $(LIBFDT_objects),$(call quiet-command,rm -f $@ && $(AR) rcs $@ $^,"AR","$(TARGET_DIR)$@"),)
-dtc/%: .git-submodule-status
+$(LIBFDT_objects): | $(LIBFDT_objdir)
+$(LIBFDT_objdir): .git-submodule-status
@mkdir -p $@
# Overriding CFLAGS causes us to lose defines added in the sub-makefile.
@@ -821,7 +827,6 @@ distclean: clean
rm -rf $$d || exit 1 ; \
done
rm -Rf .sdk
- if test -f dtc/version_gen.h; then $(MAKE) $(DTC_MAKE_ARGS) clean; fi
KEYMAPS=da en-gb et fr fr-ch is lt no pt-br sv \
ar de en-us fi fr-be hr it lv nl pl ru th \
diff --git a/configure b/configure
index 233c671aaa..cf32bfb75b 100755
--- a/configure
+++ b/configure
@@ -4278,10 +4278,6 @@ EOF
if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then
fdt=git
mkdir -p dtc
- if [ "$pwd_is_source_path" != "y" ] ; then
- symlink "$source_path/dtc/Makefile" "dtc/Makefile"
- symlink "$source_path/dtc/scripts" "dtc/scripts"
- fi
fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
fdt_ldflags="-L\$(BUILD_DIR)/dtc/libfdt"
fdt_libs="$fdt_libs"
diff --git a/rules.mak b/rules.mak
index 694865b63e..61eb474ba4 100644
--- a/rules.mak
+++ b/rules.mak
@@ -105,6 +105,8 @@ LINK = $(call quiet-command, $(LINKPROG) $(CFLAGS) $(QEMU_LDFLAGS) -o $@ \
DSO_OBJ_CFLAGS := -fPIC -DBUILD_DSO
module-common.o: CFLAGS += $(DSO_OBJ_CFLAGS)
+
+# Note: DSOSUF must not be empty, or these rules will try to match too much
%$(DSOSUF): QEMU_LDFLAGS += $(LDFLAGS_SHARED)
%$(DSOSUF): %.mo
$(call LINK,$^)
--
2.16.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 1/2] Makefile: libfdt: build only the strict necessary
2020-04-11 9:22 [PATCH v3 0/2] Makefile: libfdt: build only the strict necessary Claudio Fontana
2020-04-11 9:22 ` [PATCH 1/2] " Claudio Fontana
@ 2020-04-11 9:22 ` Claudio Fontana
2020-04-11 9:22 ` [PATCH 2/2] Makefile: remove old compatibility gunks Claudio Fontana
2 siblings, 0 replies; 5+ messages in thread
From: Claudio Fontana @ 2020-04-11 9:22 UTC (permalink / raw)
To: Peter Maydell, David Gibson, Philippe Mathieu-Daude, Markus Armbruster
Cc: Claudio Fontana, Alex Bennee, Laurent Vivier, qemu-devel
when building dtc/libfdt, we were previously using dtc/Makefile,
which tries to build some artifacts that are not needed,
and can complain on stderr about the absence of tools that
are not required to build just libfdt.
Instead, build only the strict necessary to get libfdt.a .
Signed-off-by: Claudio Fontana <cfontana@suse.de>
---
Makefile | 21 +++++++++++++--------
configure | 4 ----
rules.mak | 2 ++
3 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/Makefile b/Makefile
index 84ef881600..7be15eeb7c 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,10 @@ ifneq ($(words $(subst :, ,$(CURDIR))), 1)
$(error main directory cannot contain spaces nor colons)
endif
+# some pattern rules in rules.mak are confused by an empty DSOSUF,
+# and UNCHECKED_GOALS for testing (docker-) can run without prior configure.
+DSOSUF ?= ".so"
+
# Always point to the root of the build tree (needs GNU make).
BUILD_DIR=$(CURDIR)
@@ -526,15 +530,17 @@ $(SOFTMMU_FUZZ_RULES): $(edk2-decompressed)
$(TARGET_DIRS_RULES):
$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" $(notdir $@),)
-DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_srcdir=$(SRC_PATH)/dtc/libfdt
-DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
-DTC_CPPFLAGS=-I$(BUILD_DIR)/dtc -I$(SRC_PATH)/dtc -I$(SRC_PATH)/dtc/libfdt
-
+LIBFDT_objdir = dtc/libfdt
+-include $(SRC_PATH)/dtc/libfdt/Makefile.libfdt
+LIBFDT_objects = $(addprefix $(LIBFDT_objdir)/, $(LIBFDT_OBJS))
+# the name dtc/all is for backward compatibility
.PHONY: dtc/all
-dtc/all: .git-submodule-status dtc/libfdt dtc/tests
- $(call quiet-command,$(MAKE) $(DTC_MAKE_ARGS) CPPFLAGS="$(DTC_CPPFLAGS)" CFLAGS="$(DTC_CFLAGS)" LDFLAGS="$(QEMU_LDFLAGS)" ARFLAGS="$(ARFLAGS)" CC="$(CC)" AR="$(AR)" LD="$(LD)" $(SUBDIR_MAKEFLAGS) libfdt/libfdt.a,)
+dtc/all: .git-submodule-status $(LIBFDT_objdir)/libfdt.a
+$(LIBFDT_objdir)/libfdt.a: $(LIBFDT_objects)
+ $(if $(LIBFDT_objects),$(call quiet-command,rm -f $@ && $(AR) rcs $@ $^,"AR","$(TARGET_DIR)$@"),)
-dtc/%: .git-submodule-status
+$(LIBFDT_objects): | $(LIBFDT_objdir)
+$(LIBFDT_objdir): .git-submodule-status
@mkdir -p $@
# Overriding CFLAGS causes us to lose defines added in the sub-makefile.
@@ -821,7 +827,6 @@ distclean: clean
rm -rf $$d || exit 1 ; \
done
rm -Rf .sdk
- if test -f dtc/version_gen.h; then $(MAKE) $(DTC_MAKE_ARGS) clean; fi
KEYMAPS=da en-gb et fr fr-ch is lt no pt-br sv \
ar de en-us fi fr-be hr it lv nl pl ru th \
diff --git a/configure b/configure
index 233c671aaa..cf32bfb75b 100755
--- a/configure
+++ b/configure
@@ -4278,10 +4278,6 @@ EOF
if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then
fdt=git
mkdir -p dtc
- if [ "$pwd_is_source_path" != "y" ] ; then
- symlink "$source_path/dtc/Makefile" "dtc/Makefile"
- symlink "$source_path/dtc/scripts" "dtc/scripts"
- fi
fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
fdt_ldflags="-L\$(BUILD_DIR)/dtc/libfdt"
fdt_libs="$fdt_libs"
diff --git a/rules.mak b/rules.mak
index 694865b63e..61eb474ba4 100644
--- a/rules.mak
+++ b/rules.mak
@@ -105,6 +105,8 @@ LINK = $(call quiet-command, $(LINKPROG) $(CFLAGS) $(QEMU_LDFLAGS) -o $@ \
DSO_OBJ_CFLAGS := -fPIC -DBUILD_DSO
module-common.o: CFLAGS += $(DSO_OBJ_CFLAGS)
+
+# Note: DSOSUF must not be empty, or these rules will try to match too much
%$(DSOSUF): QEMU_LDFLAGS += $(LDFLAGS_SHARED)
%$(DSOSUF): %.mo
$(call LINK,$^)
--
2.16.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] Makefile: remove old compatibility gunks
2020-04-11 9:22 [PATCH v3 0/2] Makefile: libfdt: build only the strict necessary Claudio Fontana
2020-04-11 9:22 ` [PATCH 1/2] " Claudio Fontana
2020-04-11 9:22 ` Claudio Fontana
@ 2020-04-11 9:22 ` Claudio Fontana
2020-04-14 7:30 ` Markus Armbruster
2 siblings, 1 reply; 5+ messages in thread
From: Claudio Fontana @ 2020-04-11 9:22 UTC (permalink / raw)
To: Peter Maydell, David Gibson, Philippe Mathieu-Daude, Markus Armbruster
Cc: Claudio Fontana, Alex Bennee, Laurent Vivier, qemu-devel
Signed-off-by: Claudio Fontana <cfontana@suse.de>
---
Makefile | 6 ------
1 file changed, 6 deletions(-)
diff --git a/Makefile b/Makefile
index 7be15eeb7c..00377f28b9 100644
--- a/Makefile
+++ b/Makefile
@@ -567,12 +567,6 @@ slirp/all: .git-submodule-status
CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" \
CFLAGS="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS="$(QEMU_LDFLAGS)")
-# Compatibility gunk to keep make working across the rename of targets
-# for recursion, to be removed some time after 4.1.
-subdir-dtc: dtc/all
-subdir-capstone: capstone/all
-subdir-slirp: slirp/all
-
$(filter %/all, $(TARGET_DIRS_RULES)): libqemuutil.a $(common-obj-y) \
$(qom-obj-y)
--
2.16.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] Makefile: remove old compatibility gunks
2020-04-11 9:22 ` [PATCH 2/2] Makefile: remove old compatibility gunks Claudio Fontana
@ 2020-04-14 7:30 ` Markus Armbruster
0 siblings, 0 replies; 5+ messages in thread
From: Markus Armbruster @ 2020-04-14 7:30 UTC (permalink / raw)
To: Claudio Fontana
Cc: Peter Maydell, Philippe Mathieu-Daude, qemu-devel,
Laurent Vivier, Alex Bennee, David Gibson
Claudio Fontana <cfontana@suse.de> writes:
> Signed-off-by: Claudio Fontana <cfontana@suse.de>
> ---
> Makefile | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 7be15eeb7c..00377f28b9 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -567,12 +567,6 @@ slirp/all: .git-submodule-status
> CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" \
> CFLAGS="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS="$(QEMU_LDFLAGS)")
>
> -# Compatibility gunk to keep make working across the rename of targets
> -# for recursion, to be removed some time after 4.1.
> -subdir-dtc: dtc/all
> -subdir-capstone: capstone/all
> -subdir-slirp: slirp/all
> -
> $(filter %/all, $(TARGET_DIRS_RULES)): libqemuutil.a $(common-obj-y) \
> $(qom-obj-y)
Reviewed-by: Markus Armbruster <armbru@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread