You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.9 KiB

  1. commit 5df1480da4c4e58830d108f4f0f3347598c55ab3
  2. Author: Willy Tarreau <w@1wt.eu>
  3. Date: Wed Oct 3 09:52:51 2018 +0200
  4. BUILD: Makefile: speed up compiler options detection
  5. Commits b78016649 and d3a7f4035 brought the ability to detect the build
  6. options and warnings that the compiler supports. However, they're detected
  7. using "$(CC) -c", which is 50% slower than "$(CC) -E" for the same result,
  8. just because it starts the assembler at the end. Given that we're starting
  9. to check for a number of warnings, this detection alone starts to become
  10. visible, taking a bit more than 300 ms on the build time. Let's switch to
  11. -E instead to shrink this incompressible time by roughly 100 ms.
  12. (cherry picked from commit f11ca5e7a43c772637018ec2ad981a9fd7d3816f)
  13. [wt: only backported for context and consistency with next patch]
  14. Signed-off-by: Willy Tarreau <w@1wt.eu>
  15. diff --git a/Makefile b/Makefile
  16. index d3615060..1a971f92 100644
  17. --- a/Makefile
  18. +++ b/Makefile
  19. @@ -96,13 +96,13 @@
  20. # Usage: CFLAGS += $(call cc-opt,option). Eg: $(call cc-opt,-fwrapv)
  21. # Note: ensure the referencing variable is assigned using ":=" and not "=" to
  22. # call it only once.
  23. -cc-opt = $(shell set -e; if $(CC) $(1) -c -xc - -o /dev/null </dev/null >&0 2>&0; then echo "$(1)"; fi;)
  24. +cc-opt = $(shell set -e; if $(CC) $(1) -E -xc - -o /dev/null </dev/null >&0 2>&0; then echo "$(1)"; fi;)
  25. # Disable a warning when supported by the compiler. Don't put spaces around the
  26. # warning! And don't use cc-opt which doesn't always report an error until
  27. # another one is also returned.
  28. # Usage: CFLAGS += $(call cc-nowarn,warning). Eg: $(call cc-opt,format-truncation)
  29. -cc-nowarn = $(shell set -e; if $(CC) -W$(1) -c -xc - -o /dev/null </dev/null >&0 2>&0; then echo "-Wno-$(1)"; fi;)
  30. +cc-nowarn = $(shell set -e; if $(CC) -W$(1) -E -xc - -o /dev/null </dev/null >&0 2>&0; then echo "-Wno-$(1)"; fi;)
  31. #### Installation options.
  32. DESTDIR =