[vlc-devel] [PATCH] contrib: Keep debug and optimization flags separate
Rémi Denis-Courmont
remi at remlab.net
Wed Jun 12 22:02:32 CEST 2019
Hello,
As far as I know, -g is not an optimization flag. It does not affect code
generation.
And it's a preexisting condition, but we should build -Og, not -O0 - never.
Le mercredi 12 juin 2019, 22:28:41 EEST Marvin Scholz a écrit :
> Passing the debug symbol flag to meson can cause issues when meson
> uses these for tests: https://github.com/mesonbuild/meson/issues/5482
>
> The meson buildtype is already set to debug or release, so passing
> the arguments is redundant.
> ---
> contrib/src/main.mak | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/contrib/src/main.mak b/contrib/src/main.mak
> index 3f40b3b485..99b408065e 100644
> --- a/contrib/src/main.mak
> +++ b/contrib/src/main.mak
> @@ -183,21 +183,21 @@ cppcheck = $(shell $(CC) $(CFLAGS) -E -dM - <
> /dev/null | grep -E $(1))
>
> EXTRA_CFLAGS += -I$(PREFIX)/include
> CPPFLAGS := $(CPPFLAGS) $(EXTRA_CFLAGS)
> -CFLAGS := $(CFLAGS) $(EXTRA_CFLAGS) -g
> -CXXFLAGS := $(CXXFLAGS) $(EXTRA_CFLAGS) $(EXTRA_CXXFLAGS) -g
> +CFLAGS := $(CFLAGS) $(EXTRA_CFLAGS)
> +CXXFLAGS := $(CXXFLAGS) $(EXTRA_CFLAGS) $(EXTRA_CXXFLAGS)
> LDFLAGS := $(LDFLAGS) -L$(PREFIX)/lib $(EXTRA_LDFLAGS)
>
> +OPTIMFLAGS := -g
> +
> ifdef ENABLE_PDB
> CFLAGS := $(CFLAGS) -gcodeview
> CXXFLAGS := $(CXXFLAGS) -gcodeview
> endif
>
> ifndef WITH_OPTIMIZATION
> -CFLAGS := $(CFLAGS) -O0
> -CXXFLAGS := $(CXXFLAGS) -O0
> +OPTIMFLAGS += -O0
> else
> -CFLAGS := $(CFLAGS) -O2
> -CXXFLAGS := $(CXXFLAGS) -O2
> +OPTIMFLAGS += -O2
> endif
>
> # Do not export those! Use HOSTVARS.
> @@ -320,13 +320,13 @@ HOSTTOOLS := \
> PATH="$(PREFIX)/bin:$(PATH)"
> HOSTVARS := \
> CPPFLAGS="$(CPPFLAGS)" \
> - CFLAGS="$(CFLAGS)" \
> - CXXFLAGS="$(CXXFLAGS)" \
> + CFLAGS="$(CFLAGS) $(OPTIMFLAGS)" \
> + CXXFLAGS="$(CXXFLAGS) $(OPTIMFLAGS)" \
> LDFLAGS="$(LDFLAGS)"
> HOSTVARS_PIC := $(HOSTTOOLS) \
> CPPFLAGS="$(CPPFLAGS) $(PIC)" \
> - CFLAGS="$(CFLAGS) $(PIC)" \
> - CXXFLAGS="$(CXXFLAGS) $(PIC)" \
> + CFLAGS="$(CFLAGS) $(OPTIMFLAGS) $(PIC)" \
> + CXXFLAGS="$(CXXFLAGS) $(OPTIMFLAGS) $(PIC)" \
> LDFLAGS="$(LDFLAGS)"
>
> # For cross-compilation with meson, do not set compiler and flags
--
Rémi Denis-Courmont
More information about the vlc-devel
mailing list