Created
July 29, 2014 17:40
-
-
Save t-mat/fe34c0c041409a95e4d0 to your computer and use it in GitHub Desktop.
LZ4 Makefile test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Old | |
## | |
## LIBVER_MAJOR=`sed -n '/LZ4_VERSION_MAJOR/s/.*\s\+\([0-9]\+\).*/\1/p' < lz4.h` | |
## LIBVER_MINOR=`sed -n '/LZ4_VERSION_MINOR/s/.*\s\+\([0-9]\+\).*/\1/p' < lz4.h` | |
## LIBVER_PATCH=`sed -n '/LZ4_VERSION_RELEASE/s/.*\s\+\([0-9]\+\).*/\1/p' < lz4.h` | |
## New | |
## | |
## (1) Need 'define ' to match only one line. | |
## (2) Use ' ' instead of '\s' for the compatibility. (Perhaps '[:blank:]' is better) | |
## (3) Use 'XX*' instead of 'X+' for the compatibility. | |
## | |
LIBVER_MAJOR=`sed -n '/define LZ4_VERSION_MAJOR/s/.* \([0-9][0-9]*\).*/\1/p' < lz4.h` | |
LIBVER_MINOR=`sed -n '/define LZ4_VERSION_MINOR/s/.* \([0-9][0-9]*\).*/\1/p' < lz4.h` | |
LIBVER_PATCH=`sed -n '/define LZ4_VERSION_RELEASE/s/.* \([0-9][0-9]*\).*/\1/p' < lz4.h` | |
LIBVER=$(LIBVER_MAJOR).$(LIBVER_MINOR).$(LIBVER_PATCH) | |
default: | |
@echo $(LIBVER) |
Author
t-mat
commented
Jul 29, 2014
- Differences between sed on Mac OSX and other “standard” sed?
- Basic Regular Expressions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment