Skip to content

Commit 04ad4b3

Browse files
committed
Makefile: don't call pkg-config --cflags|libs protobuf for non-build targets, as each takes ~3 seconds to complete
1 parent 001bda0 commit 04ad4b3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,16 @@ endif
99
CC ?= gcc
1010
CXX ?= g++
1111

12+
# pkg-config for protobuf can be expensive/slow
13+
# Skip pkg-config for: clean, indent, kafel_init, and kafel-only builds
14+
ifneq ($(filter-out clean indent kafel_init kafel/libkafel.a,$(MAKECMDGOALS)),)
1215
PROTOBUF_CFLAGS := $(shell pkg-config --cflags protobuf)
1316
PROTOBUF_LIBS := $(shell pkg-config --libs protobuf)
17+
else ifeq ($(MAKECMDGOALS),)
18+
# Default target (all) requires protobuf
19+
PROTOBUF_CFLAGS := $(shell pkg-config --cflags protobuf)
20+
PROTOBUF_LIBS := $(shell pkg-config --libs protobuf)
21+
endif
1422

1523
NL3_EXISTS := $(shell pkg-config --exists libnl-route-3.0 && echo yes)
1624

0 commit comments

Comments
 (0)