Skip to content

Commit 695463c

Browse files
committed
Makefile: skip feature detection for non-build targets
If all make targets are not build related (e.g. make clean), feature detection using the compiler will no longer be run / print results unnecessarily.
1 parent 9d641ea commit 695463c

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

Makefile

+22-18
Original file line numberDiff line numberDiff line change
@@ -112,23 +112,27 @@ ifneq ($$(call parsecexpr),1)
112112
endif
113113
endef
114114

115-
CEXPR_CFLAGS=$(CFLAGS) $(LIBHFS_CFLAGS)
116-
$(eval $(call testcccheck))
117-
$(eval $(call cccheck,HAVE_BEXXTOH_ENDIAN_H,{ be16toh(0); be32toh(0); be64toh(0); },endian.h))
118-
$(eval $(call cccheck,HAVE_BEXXTOH_SYS_ENDIAN_H,{ be16toh(0); be32toh(0); be64toh(0); },sys/endian.h))
119-
$(eval $(call cccheck,HAVE_OSBYTEORDER_H,{ OSSwapBigToHostInt16(0); OSSwapBigToHostInt32(0); OSSwapBigToHostInt64(0); },libkern/OSByteOrder.h))
120-
121-
CEXPR_CFLAGS=$(CFLAGS) $(LOCAL_CFLAGS)
122-
$(eval $(call testcccheck))
123-
$(eval $(call cccheck,HAVE_BIRTHTIME,{ (struct stat){0}.st_birthtime; },sys/stat.h))
124-
$(eval $(call cccheck,HAVE_STAT_FLAGS,{ (struct stat){0}.st_flags; },sys/stat.h))
125-
$(eval $(call cccheck,HAVE_STAT_BLKSIZE,{ (struct stat){0}.st_blksize; },sys/stat.h))
126-
$(eval $(call cccheck,HAVE_STAT_BLOCKS,{ (struct stat){0}.st_blocks; },sys/stat.h))
127-
$(eval $(call cccheck,HAVE_VSYSLOG,{ vsyslog(0,(const char*){0},(va_list){0}); },syslog.h stdarg.h))
128-
$(eval $(call cccheck,HAVE_PREAD,{ pread(0,(void*){0},0,0); },unistd.h))
129-
130-
$(eval $(call cccheck,HAVE_LZFSE,,lzfse.h))
131-
$(eval $(call cccheck,HAVE_ZLIB,,zlib.h))
115+
non_build_targets = dist version uninstall uninstall-lib clean distclean
116+
117+
ifneq ($(filter-out $(non_build_targets),$(or $(MAKECMDGOALS),all)),)
118+
CEXPR_CFLAGS=$(CFLAGS) $(LIBHFS_CFLAGS)
119+
$(eval $(call testcccheck))
120+
$(eval $(call cccheck,HAVE_BEXXTOH_ENDIAN_H,{ be16toh(0); be32toh(0); be64toh(0); },endian.h))
121+
$(eval $(call cccheck,HAVE_BEXXTOH_SYS_ENDIAN_H,{ be16toh(0); be32toh(0); be64toh(0); },sys/endian.h))
122+
$(eval $(call cccheck,HAVE_OSBYTEORDER_H,{ OSSwapBigToHostInt16(0); OSSwapBigToHostInt32(0); OSSwapBigToHostInt64(0); },libkern/OSByteOrder.h))
123+
124+
CEXPR_CFLAGS=$(CFLAGS) $(LOCAL_CFLAGS)
125+
$(eval $(call testcccheck))
126+
$(eval $(call cccheck,HAVE_BIRTHTIME,{ (struct stat){0}.st_birthtime; },sys/stat.h))
127+
$(eval $(call cccheck,HAVE_STAT_FLAGS,{ (struct stat){0}.st_flags; },sys/stat.h))
128+
$(eval $(call cccheck,HAVE_STAT_BLKSIZE,{ (struct stat){0}.st_blksize; },sys/stat.h))
129+
$(eval $(call cccheck,HAVE_STAT_BLOCKS,{ (struct stat){0}.st_blocks; },sys/stat.h))
130+
$(eval $(call cccheck,HAVE_VSYSLOG,{ vsyslog(0,(const char*){0},(va_list){0}); },syslog.h stdarg.h))
131+
$(eval $(call cccheck,HAVE_PREAD,{ pread(0,(void*){0},0,0); },unistd.h))
132+
133+
$(eval $(call cccheck,HAVE_LZFSE,,lzfse.h))
134+
$(eval $(call cccheck,HAVE_ZLIB,,zlib.h))
135+
endif
132136

133137
$(foreach cfg,OS CC AR RANLIB INSTALL TAR PREFIX WITH_UBLIO WITH_UTF8PROC CONFIG_CFLAGS $(FEATURES),$(eval CONFIG:=$(CONFIG)$(cfg)=$$($(cfg))\n))
134138
$(foreach feature,$(FEATURES),$(if $(filter $($(feature)),1),$(eval CFLAGS+=-D$(feature))))
@@ -176,7 +180,7 @@ endif
176180

177181
export CONFIG PREFIX prefix bindir libdir includedir DESTDIR CC CFLAGS LOCAL_CFLAGS APP_FLAGS LIBDIRS AR RANLIB INSTALL INCLUDE
178182

179-
.PHONY: all clean always_check config install uninstall install-lib uninstall-lib lib version dist
183+
.PHONY: all clean always_check config install install-lib lib $(non_build_targets)
180184

181185
all: $(TARGETS)
182186

0 commit comments

Comments
 (0)