问题
I use a makefile which in order to create a library uses a .pc file which looks like this
current_path=`readlink -e .`
cat > lib/libmy.pc << EOM
prefix=$current_path
includedir=\${prefix}/inc
libdir=\${prefix}/lib
Name: my
Description: My library
Version: 1.0
Cflags: -I\${includedir}
Libs: -L\${libdir} -lmy
Libs.private: -lm
EOM
The problem is that on mac the -e flag doesn't work (even I installed coreutils). I there a method to replace the flag?
回答1:
The most portable way I could find:
current_path=`python -c "import os; print(os.path.abspath('${MY_AWESOME_PATH}'))"`
in your case:
current_path=`python -c "import os; print(os.path.abspath('.'))"`
来源:https://stackoverflow.com/questions/57195470/what-alternatives-are-there-for-readlink-e