Merge pull request #1339 from facebook/grep_colors
fixed usage of grep in Makefile
This commit is contained in:
commit
e74eade251
6
Makefile
6
Makefile
@ -118,6 +118,8 @@ ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD Dr
|
|||||||
HOST_OS = POSIX
|
HOST_OS = POSIX
|
||||||
CMAKE_PARAMS = -DZSTD_BUILD_CONTRIB:BOOL=ON -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_ZLIB_SUPPORT:BOOL=ON -DZSTD_LZMA_SUPPORT:BOOL=ON -DCMAKE_BUILD_TYPE=Release
|
CMAKE_PARAMS = -DZSTD_BUILD_CONTRIB:BOOL=ON -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_ZLIB_SUPPORT:BOOL=ON -DZSTD_LZMA_SUPPORT:BOOL=ON -DCMAKE_BUILD_TYPE=Release
|
||||||
|
|
||||||
|
EGREP = egrep --color=never
|
||||||
|
|
||||||
# Print a two column output of targets and their description. To add a target description, put a
|
# Print a two column output of targets and their description. To add a target description, put a
|
||||||
# comment in the Makefile with the format "## <TARGET>: <DESCRIPTION>". For example:
|
# comment in the Makefile with the format "## <TARGET>: <DESCRIPTION>". For example:
|
||||||
#
|
#
|
||||||
@ -126,12 +128,12 @@ CMAKE_PARAMS = -DZSTD_BUILD_CONTRIB:BOOL=ON -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_B
|
|||||||
list:
|
list:
|
||||||
@TARGETS=$$($(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null \
|
@TARGETS=$$($(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null \
|
||||||
| awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' \
|
| awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' \
|
||||||
| egrep -v -e '^[^[:alnum:]]' | sort); \
|
| $(EGREP) -v -e '^[^[:alnum:]]' | sort); \
|
||||||
{ \
|
{ \
|
||||||
printf "Target Name\tDescription\n"; \
|
printf "Target Name\tDescription\n"; \
|
||||||
printf "%0.s-" {1..16}; printf "\t"; printf "%0.s-" {1..40}; printf "\n"; \
|
printf "%0.s-" {1..16}; printf "\t"; printf "%0.s-" {1..40}; printf "\n"; \
|
||||||
for target in $$TARGETS; do \
|
for target in $$TARGETS; do \
|
||||||
line=$$(egrep "^##[[:space:]]+$$target:" $(lastword $(MAKEFILE_LIST))); \
|
line=$$($(EGREP) "^##[[:space:]]+$$target:" $(lastword $(MAKEFILE_LIST))); \
|
||||||
description=$$(echo $$line | awk '{i=index($$0,":"); print substr($$0,i+1)}' | xargs); \
|
description=$$(echo $$line | awk '{i=index($$0,":"); print substr($$0,i+1)}' | xargs); \
|
||||||
printf "$$target\t$$description\n"; \
|
printf "$$target\t$$description\n"; \
|
||||||
done \
|
done \
|
||||||
|
@ -31,6 +31,8 @@ DEBUGFLAGS= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
|||||||
CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS)
|
CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS)
|
||||||
FLAGS = $(CPPFLAGS) $(CFLAGS)
|
FLAGS = $(CPPFLAGS) $(CFLAGS)
|
||||||
|
|
||||||
|
GREP = grep --color=never
|
||||||
|
|
||||||
ZSTDCOMMON_FILES := $(sort $(wildcard common/*.c))
|
ZSTDCOMMON_FILES := $(sort $(wildcard common/*.c))
|
||||||
ZSTDCOMP_FILES := $(sort $(wildcard compress/*.c))
|
ZSTDCOMP_FILES := $(sort $(wildcard compress/*.c))
|
||||||
ZSTDDECOMP_FILES := $(sort $(wildcard decompress/*.c))
|
ZSTDDECOMP_FILES := $(sort $(wildcard decompress/*.c))
|
||||||
@ -72,7 +74,7 @@ endif
|
|||||||
|
|
||||||
ifneq ($(ZSTD_LEGACY_SUPPORT), 0)
|
ifneq ($(ZSTD_LEGACY_SUPPORT), 0)
|
||||||
ifeq ($(shell test $(ZSTD_LEGACY_SUPPORT) -lt 8; echo $$?), 0)
|
ifeq ($(shell test $(ZSTD_LEGACY_SUPPORT) -lt 8; echo $$?), 0)
|
||||||
ZSTD_FILES += $(shell ls legacy/*.c | grep 'v0[$(ZSTD_LEGACY_SUPPORT)-7]')
|
ZSTD_FILES += $(shell ls legacy/*.c | $(GREP) 'v0[$(ZSTD_LEGACY_SUPPORT)-7]')
|
||||||
endif
|
endif
|
||||||
CPPFLAGS += -I./legacy
|
CPPFLAGS += -I./legacy
|
||||||
endif
|
endif
|
||||||
|
@ -29,7 +29,9 @@ LIBVER := $(shell echo $(LIBVER_SCRIPT))
|
|||||||
|
|
||||||
ZSTD_VERSION = $(LIBVER)
|
ZSTD_VERSION = $(LIBVER)
|
||||||
|
|
||||||
ifeq ($(shell $(CC) -v 2>&1 | grep -c "gcc version "), 1)
|
GREP = grep --color=never
|
||||||
|
|
||||||
|
ifeq ($(shell $(CC) -v 2>&1 | $(GREP) -c "gcc version "), 1)
|
||||||
ALIGN_LOOP = -falign-loops=32
|
ALIGN_LOOP = -falign-loops=32
|
||||||
else
|
else
|
||||||
ALIGN_LOOP =
|
ALIGN_LOOP =
|
||||||
@ -62,7 +64,7 @@ ZSTD_LEGACY_SUPPORT ?= 5
|
|||||||
ZSTDLEGACY_FILES :=
|
ZSTDLEGACY_FILES :=
|
||||||
ifneq ($(ZSTD_LEGACY_SUPPORT), 0)
|
ifneq ($(ZSTD_LEGACY_SUPPORT), 0)
|
||||||
ifeq ($(shell test $(ZSTD_LEGACY_SUPPORT) -lt 8; echo $$?), 0)
|
ifeq ($(shell test $(ZSTD_LEGACY_SUPPORT) -lt 8; echo $$?), 0)
|
||||||
ZSTDLEGACY_FILES += $(shell ls $(ZSTDDIR)/legacy/*.c | grep 'v0[$(ZSTD_LEGACY_SUPPORT)-7]')
|
ZSTDLEGACY_FILES += $(shell ls $(ZSTDDIR)/legacy/*.c | $(GREP) 'v0[$(ZSTD_LEGACY_SUPPORT)-7]')
|
||||||
endif
|
endif
|
||||||
CPPFLAGS += -I$(ZSTDDIR)/legacy
|
CPPFLAGS += -I$(ZSTDDIR)/legacy
|
||||||
else
|
else
|
||||||
@ -260,9 +262,27 @@ preview-man: clean-man man
|
|||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS))
|
ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS))
|
||||||
|
|
||||||
|
EGREP = egrep --color=never
|
||||||
|
|
||||||
|
# Print a two column output of targets and their description. To add a target description, put a
|
||||||
|
# comment in the Makefile with the format "## <TARGET>: <DESCRIPTION>". For example:
|
||||||
|
#
|
||||||
|
## list: Print all targets and their descriptions (if provided)
|
||||||
.PHONY: list
|
.PHONY: list
|
||||||
list:
|
list:
|
||||||
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs
|
@TARGETS=$$($(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null \
|
||||||
|
| awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' \
|
||||||
|
| $(EGREP) -v -e '^[^[:alnum:]]' | sort); \
|
||||||
|
{ \
|
||||||
|
printf "Target Name\tDescription\n"; \
|
||||||
|
printf "%0.s-" {1..16}; printf "\t"; printf "%0.s-" {1..40}; printf "\n"; \
|
||||||
|
for target in $$TARGETS; do \
|
||||||
|
line=$$($(EGREP) "^##[[:space:]]+$$target:" $(lastword $(MAKEFILE_LIST))); \
|
||||||
|
description=$$(echo $$line | awk '{i=index($$0,":"); print substr($$0,i+1)}' | xargs); \
|
||||||
|
printf "$$target\t$$description\n"; \
|
||||||
|
done \
|
||||||
|
} | column -t -s $$'\t'
|
||||||
|
|
||||||
|
|
||||||
DESTDIR ?=
|
DESTDIR ?=
|
||||||
# directory variables : GNU conventions prefer lowercase
|
# directory variables : GNU conventions prefer lowercase
|
||||||
|
Loading…
x
Reference in New Issue
Block a user