diff --git a/src/Makefile b/src/Makefile index f87e424..de59b58 100644 --- a/src/Makefile +++ b/src/Makefile @@ -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 \ @@ -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 $@ $< @@ -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 @@ -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) @@ -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