]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: makefile: properly pass CC to sub-projects
authorWilly Tarreau <w@1wt.eu>
Thu, 17 Nov 2022 07:15:27 +0000 (08:15 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 17 Nov 2022 09:56:35 +0000 (10:56 +0100)
The "poll" and "tcploop" sub-projects have their own makefiles. But
since the cmd_* commands were migrated from "echo" to $(info) with
make 3.81, the command is confusingly displayed in the top-level
makefile before entering the directory, even making one think that
the build occurred.

Let's instead propagate the verbosity level through the sub-projects
and let them adapt their own cmd_CC. For now this peans a little bit
of duplication for poll and tcploop.

Makefile
dev/poll/Makefile
dev/tcploop/Makefile

index 3e765aec1ec03d45b0a32ec032d5501caac577bc..6902c37c07a54a2c30f4393d506613d0c9c46547 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1031,13 +1031,13 @@ dev/hpack/%: dev/hpack/%.o
        $(cmd_LD) $(LDFLAGS) -o $@ $^ $(LDOPTS)
 
 dev/poll/poll:
-       $(Q)$(MAKE) -C dev/poll poll CC='$(cmd_CC)' OPTIMIZE='$(COPTS)'
+       $(Q)$(MAKE) -C dev/poll poll CC='$(CC)' OPTIMIZE='$(COPTS)' V='$(V)'
 
 dev/qpack/decode: dev/qpack/decode.o
        $(cmd_LD) $(LDFLAGS) -o $@ $^ $(LDOPTS)
 
 dev/tcploop/tcploop:
-       $(Q)$(MAKE) -C dev/tcploop tcploop CC='$(cmd_CC)' OPTIMIZE='$(COPTS)'
+       $(Q)$(MAKE) -C dev/tcploop tcploop CC='$(CC)' OPTIMIZE='$(COPTS)' V='$(V)'
 
 dev/udp/udp-perturb: dev/udp/udp-perturb.o
        $(cmd_LD) $(LDFLAGS) -o $@ $^ $(LDOPTS)
index fdee514c6212640159f282696f6bd4d38beadf1a..9a493bb711f0913eeeaa7854044d7bb706c9207a 100644 (file)
@@ -4,8 +4,26 @@ DEFINE   =
 INCLUDE  =
 OBJS     = poll
 
+V = 0
+Q = @
+ifeq ($V,1)
+Q=
+endif
+
+ifeq ($V,1)
+cmd_CC = $(CC)
+else
+ifeq (3.81,$(firstword $(sort $(MAKE_VERSION) 3.81)))
+# 3.81 or above
+cmd_CC = $(info $   CC      $@) $(Q)$(CC)
+else
+# 3.80 or older
+cmd_CC = $(Q)echo "  CC      $@";$(CC)
+endif
+endif
+
 poll: poll.c
-       $(CC) $(OPTIMIZE) $(DEFINE) $(INCLUDE) -o $@ $^
+       $(cmd_CC) $(OPTIMIZE) $(DEFINE) $(INCLUDE) -o $@ $^
 
 clean:
        rm -f $(OBJS) *.[oas] *~
index 42a6259c2ba72ce7483f5eff44c651c1ca4c38c1..fd80af9b9c932898a8947d3b35ef84bfeadec5dc 100644 (file)
@@ -4,8 +4,26 @@ DEFINE   =
 INCLUDE  =
 OBJS     = tcploop
 
+V = 0
+Q = @
+ifeq ($V,1)
+Q=
+endif
+
+ifeq ($V,1)
+cmd_CC = $(CC)
+else
+ifeq (3.81,$(firstword $(sort $(MAKE_VERSION) 3.81)))
+# 3.81 or above
+cmd_CC = $(info $   CC      $@) $(Q)$(CC)
+else
+# 3.80 or older
+cmd_CC = $(Q)echo "  CC      $@";$(CC)
+endif
+endif
+
 tcploop: tcploop.c
-       $(CC) $(OPTIMIZE) $(DEFINE) $(INCLUDE) -o $@ $^
+       $(cmd_CC) $(OPTIMIZE) $(DEFINE) $(INCLUDE) -o $@ $^
 
 clean:
        rm -f $(OBJS) *.[oas] *~