Skip to content
This repository was archived by the owner on Mar 28, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ TAGLIB_LIBS=`taglib-config --libs`
CXXFLAGS=-Wall $(BOOST_CFLAGS) $(TAGLIB_CFLAGS) -fPIC $(OPTFLAGS)
CFLAGS=-Wall -fPIC $(OPTFLAGS)
LDFLAGS=$(TAGLIB_LIBS) -lz -lpthread $(OPTFLAGS)
ifeq ($(UNAME),Darwin)
LIBNAME=libcodegen.$(VERSION).dylib
else
LIBNAME=libcodegen.so
endif
SONAME=$(LIBNAME).$(VERSION_MAJ)
EXENAME=../echoprint-codegen

MODULES_LIB = \
AudioBufferInput.o \
Expand All @@ -29,19 +34,19 @@ MODULES_LIB = \
Whitening.o
MODULES = $(MODULES_LIB) Metadata.o

all: libcodegen echoprint-codegen
all: $(LIBNAME) $(EXENAME)

libcodegen: $(MODULES_LIB)
$(LIBNAME): $(MODULES_LIB)
ifeq ($(UNAME),Darwin)
libtool -dynamic -flat_namespace -install_name libcodegen.$(VERSION).dylib -lSystem -compatibility_version $(VERSION_COMPAT) \
-macosx_version_min 10.6 -current_version $(VERSION) -o libcodegen.$(VERSION).dylib -undefined suppress \
-macosx_version_min 10.6 -current_version $(VERSION) -o $(LIBNAME) -undefined suppress \
$(MODULES_LIB) -framework Accelerate
else
$(CXX) -shared -fPIC -Wl,-soname,$(SONAME) -o $(LIBNAME).$(VERSION) $(MODULES_LIB) -lz
endif

echoprint-codegen: $(MODULES) main.o
$(CXX) $(MODULES) main.o $(LDFLAGS) -o ../echoprint-codegen
$(EXENAME): $(MODULES) main.o
$(CXX) $(MODULES) main.o $(LDFLAGS) -o $(EXENAME)

%.o: %.c %.h
$(CC) $(CFLAGS) -c -o $@ $<
Expand All @@ -56,7 +61,7 @@ echoprint-codegen: $(MODULES) main.o
$(CXX) $(CXXFLAGS) -c -o $@ $<

clean:
rm -f *.o ../echoprint-codegen
rm -f *.o $(EXENAME)
rm -f libcodegen.so*
ifeq ($(UNAME),Darwin)
rm -f *.dylib
Expand All @@ -70,7 +75,7 @@ INCLUDEDIR ?= /include

install: all
mkdir -p $(DESTDIR)$(BINDIR)
install ../echoprint-codegen $(DESTDIR)$(BINDIR)
install $(EXENAME) $(DESTDIR)$(BINDIR)
install -d $(DESTDIR)$(INCLUDEDIR)/echoprint
install -pm 644 Codegen.h $(DESTDIR)$(INCLUDEDIR)/echoprint/
mkdir -p $(DESTDIR)$(LIBDIR)
Expand All @@ -84,4 +89,4 @@ else
ln -fs $(DESTDIR)$(LIBDIR)/$(SONAME) $(DESTDIR)$(LIBDIR)/$(LIBNAME)
endif

.PHONY: clean all libcodegen echoprint-codegen install
.PHONY: clean all install