-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Introduce a new library functions aptx_decode_sync() and aptx_decode_sync_finish() for synchronization and decoding partially corrupted continuous stream * Improve synchronization support in openaptxdec utility via these new library functions * Fix openaptxdec utility to not output data which are result of decoding the trailing aptx padding from the last aptX sample * Fix exit codes from utilities, returns 1 when error occurred * Make utilities to be compatible with Windows systems, set stdin and stdout to binary mode * Make source code to be compatible with ISO C90, C99, C11, C17, ISO C++ 1998, 2011, 2014, 2017, 2020 and also with MSVC 6.0 (and new), but there is one exception that stdint.h header file with basic fixed width integer types needs to be provided * Fix integer variable types, size, signedness and const qualifiers * Make Makefile to be POSIX compatible * Do not install static executables * Generate and install a new pkg-config file for library * Provide and install static library libopenaptx.a * Enable -O3 optimizations in Makefile by default * Update parameters for sox/play examples in README and help
- Loading branch information
Showing
6 changed files
with
643 additions
and
338 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,93 @@ | ||
MAJOR := 0 | ||
MINOR := 1 | ||
PATCH := 0 | ||
.POSIX: | ||
.SUFFIXES: | ||
.PHONY: all clean install uninstall | ||
|
||
PREFIX := /usr/local | ||
BINDIR := bin | ||
LIBDIR := lib | ||
INCDIR := include | ||
RM = rm -f | ||
CP = cp -a | ||
LNS = ln -sf | ||
MKDIR = mkdir -p | ||
PRINTF = printf | ||
|
||
LIBNAME := libopenaptx.so | ||
SONAME := $(LIBNAME).$(MAJOR) | ||
FILENAME := $(SONAME).$(MINOR).$(PATCH) | ||
CFLAGS = -W -Wall -O3 | ||
LDFLAGS = -s | ||
ARFLAGS = -rcs | ||
|
||
UTILITIES := openaptxenc openaptxdec openaptxenc-static openaptxdec-static | ||
PREFIX = /usr/local | ||
BINDIR = bin | ||
LIBDIR = lib | ||
INCDIR = include | ||
PKGDIR = $(LIBDIR)/pkgconfig | ||
|
||
HEADERS := openaptx.h | ||
SOURCES := openaptx.c | ||
NAME = openaptx | ||
MAJOR = 0 | ||
MINOR = 2 | ||
PATCH = 0 | ||
|
||
BUILD := $(FILENAME) $(SONAME) $(LIBNAME) $(UTILITIES) | ||
LIBNAME = lib$(NAME).so | ||
SONAME = $(LIBNAME).$(MAJOR) | ||
SOFILENAME = $(SONAME).$(MINOR).$(PATCH) | ||
ANAME = lib$(NAME).a | ||
PCNAME = lib$(NAME).pc | ||
|
||
UTILITIES = $(NAME)enc $(NAME)dec | ||
STATIC_UTILITIES = $(NAME)enc.static $(NAME)dec.static | ||
|
||
HEADERS = $(NAME).h | ||
SOURCES = $(NAME).c | ||
AOBJECTS = $(NAME).o | ||
IOBJECTS = $(NAME)enc.o $(NAME)dec.o | ||
|
||
BUILD = $(SOFILENAME) $(SONAME) $(LIBNAME) $(ANAME) $(AOBJECTS) $(IOBJECTS) $(UTILITIES) $(STATIC_UTILITIES) | ||
|
||
all: $(BUILD) | ||
|
||
clean: | ||
$(RM) $(BUILD) | ||
|
||
install: $(BUILD) | ||
mkdir -p $(DESTDIR)/$(PREFIX)/$(LIBDIR) | ||
cp -a $(FILENAME) $(SONAME) $(LIBNAME) $(DESTDIR)/$(PREFIX)/$(LIBDIR) | ||
mkdir -p $(DESTDIR)/$(PREFIX)/$(BINDIR) | ||
cp -a $(UTILITIES) $(DESTDIR)/$(PREFIX)/$(BINDIR) | ||
mkdir -p $(DESTDIR)/$(PREFIX)/$(INCDIR) | ||
cp -a $(HEADERS) $(DESTDIR)/$(PREFIX)/$(INCDIR) | ||
|
||
$(FILENAME): $(SOURCES) $(HEADERS) | ||
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -I. -shared -fPIC -Wl,-soname,$(SONAME) -o $@ $(SOURCES) | ||
$(MKDIR) $(DESTDIR)$(PREFIX)/$(LIBDIR) | ||
$(CP) $(SOFILENAME) $(SONAME) $(LIBNAME) $(ANAME) $(DESTDIR)$(PREFIX)/$(LIBDIR) | ||
$(MKDIR) $(DESTDIR)$(PREFIX)/$(BINDIR) | ||
$(CP) $(UTILITIES) $(DESTDIR)$(PREFIX)/$(BINDIR) | ||
$(MKDIR) $(DESTDIR)$(PREFIX)/$(INCDIR) | ||
$(CP) $(HEADERS) $(DESTDIR)$(PREFIX)/$(INCDIR) | ||
$(MKDIR) $(DESTDIR)$(PREFIX)/$(PKGDIR) | ||
$(PRINTF) 'prefix=%s\nexec_prefix=$${prefix}\nlibdir=$${exec_prefix}/%s\nincludedir=$${prefix}/%s\n\n' $(PREFIX) $(LIBDIR) $(INCDIR) > $(DESTDIR)$(PREFIX)/$(PKGDIR)/$(PCNAME) | ||
$(PRINTF) 'Name: lib%s\nDescription: Open Source aptX codec library\nVersion: %u.%u.%u\n' $(NAME) $(MAJOR) $(MINOR) $(PATCH) >> $(DESTDIR)$(PREFIX)/$(PKGDIR)/$(PCNAME) | ||
$(PRINTF) 'Libs: -Wl,-rpath=$${libdir} -L$${libdir} -l%s\nCflags: -I$${includedir}\n' $(NAME) >> $(DESTDIR)$(PREFIX)/$(PKGDIR)/$(PCNAME) | ||
|
||
uninstall: | ||
for f in $(SOFILENAME) $(SONAME) $(LIBNAME) $(ANAME); do $(RM) $(DESTDIR)$(PREFIX)/$(LIBDIR)/$$f; done | ||
for f in $(UTILITIES); do $(RM) $(DESTDIR)$(PREFIX)/$(BINDIR)/$$f; done | ||
for f in $(HEADERS); do $(RM) $(DESTDIR)$(PREFIX)/$(INCDIR)/$$f; done | ||
$(RM) $(DESTDIR)$(PREFIX)/$(PKGDIR)/$(PCNAME) | ||
|
||
$(UTILITIES): $(LIBNAME) | ||
|
||
$(SONAME): $(FILENAME) | ||
ln -sf $< $@ | ||
$(STATIC_UTILITIES): $(ANAME) | ||
|
||
$(AOBJECTS) $(IOBJECTS): $(HEADERS) | ||
|
||
$(LIBNAME): $(SONAME) | ||
ln -sf $< $@ | ||
$(LNS) $(SONAME) $@ | ||
|
||
%-static: %.c $(SOURCES) $(HEADERS) | ||
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -I. -o $@ $< $(SOURCES) | ||
$(SONAME): $(SOFILENAME) | ||
$(LNS) $(SOFILENAME) $@ | ||
|
||
%: %.c $(LIBNAME) $(HEADERS) | ||
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -I. -o $@ $< $(LIBNAME) | ||
$(SOFILENAME): $(SOURCES) $(HEADERS) | ||
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -I. -shared -fPIC -Wl,-soname,$(SONAME) -o $@ $(SOURCES) | ||
|
||
clean: | ||
$(RM) $(BUILD) | ||
$(ANAME): $(AOBJECTS) | ||
$(RM) $@ | ||
$(AR) $(ARFLAGS) $@ $(AOBJECTS) | ||
|
||
.SUFFIXES: .o .c .static | ||
|
||
.o: | ||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBNAME) | ||
|
||
.o.static: | ||
$(CC) $(CFLAGS) $(LDFLAGS) -static -o $@ $< $(ANAME) | ||
|
||
.c.o: | ||
$(CC) $(CFLAGS) $(CPPFLAGS) -I. -c -o $@ $< |
This file contains 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
Oops, something went wrong.