diff --git a/Makefile b/Makefile index 1fec61c..5c011c9 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,17 @@ +PROJECT = lossywav +COMMON_CXXFLAGS = -std=c++11 -O2 -pipe +DEFINES = -DHAVE_STD_CHRONO_STEADY_CLOCK_NOW -DHAVE_SETPRIORITY -DHAVE_STAT -DHAVE_CHMOD -DHAVE_NANOSLEEP +AR = ar +LDFLAGS = -s + +CXXFLAGS = ${COMMON_CXXFLAGS} ${DEFINES} +ifeq ($(shell uname --machine), x86_64) + CXXFLAGS += -fPIC +endif +ifeq ($(shell uname --machine), aarch64) + CXXFLAGS += -fPIC +endif + HEADERS = version.h \ units/fftw_interface.h \ units/nComplex.h \ @@ -32,22 +46,16 @@ OBJS = units/fftw_interface.o \ OBJB = lossyWAV.o -COMMON_CXXFLAGS = -std=c++11 -O2 -pipe -DEFINES = -DHAVE_STD_CHRONO_STEADY_CLOCK_NOW -DHAVE_SETPRIORITY -DHAVE_STAT -DHAVE_CHMOD -DHAVE_NANOSLEEP -LDFLAGS = -s - - -all: prep $(OBJS) $(OBJB) link - -prep: - $(eval override CXXFLAGS = ${COMMON_CXXFLAGS} ${CXXFLAGS} ${DEFINES}) +all: $(OBJS) $(OBJB) link *.o: ${@:.o=.cpp} $(HEADERS) ${CXX:-g++} -c ${@:.o=.cpp} -o ${@} ${CXXFLAGS} link: $(OBJS) $(OBJB) - ${CXX} -shared ${OBJS} -Wl,-soname,liblossywav.so.1 -o liblossywav.so.1 ${LDFLAGS} - ${CXX} liblossywav.so.1 ${OBJB} -o lossywav ${LDFLAGS} + ${AR} crs lib${PROJECT}.a ${OBJS} + ${CXX} -shared ${OBJS} -Wl,-soname,lib${PROJECT}.so.1 -o lib${PROJECT}.so.1 ${LDFLAGS} + ${CXX} ${OBJB} lib${PROJECT}.so.1 -o ${PROJECT} ${LDFLAGS} + ${CXX} ${OBJB} lib${PROJECT}.a -o ${PROJECT}-static ${LDFLAGS} clean: - -rm -f $(OBJS) $(OBJB) liblossywav.so.1 lossywav + -rm -f $(OBJS) $(OBJB) lib${PROJECT}.a lib${PROJECT}.so.1 ${PROJECT} ${PROJECT}-static diff --git a/README.md b/README.md index 5abbe40..c632062 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ +![GitHub release (latest by date)](https://img.shields.io/github/v/release/Sound-Linux-More/lossywav-for-linux) +![GitHub Release Date](https://img.shields.io/github/release-date/Sound-Linux-More/lossywav-for-linux) +![GitHub repo size](https://img.shields.io/github/repo-size/Sound-Linux-More/lossywav-for-linux) +![GitHub all releases](https://img.shields.io/github/downloads/Sound-Linux-More/lossywav-for-linux/total) +![GitHub](https://img.shields.io/github/license/Sound-Linux-More/lossywav-for-linux) + # Note This is the `README` of **lossyWAV for POSIX**. The README of lossyWAV (proper) was moved to `README.lossyWAV.md`.