OBJECTS = RtAudio.o @objects@
-STATIC = librtaudio.a
+LIBNAME = librtaudio
+STATIC = $(LIBNAME).a
SHARED = @sharedlib@
RELEASE = 4.0.12
MAJOR = 4
DEFS = @CPPFLAGS@
CFLAGS = @CXXFLAGS@ -Iinclude -fPIC
+PREFIX = @prefix@
+
all : $(LIBRARIES)
tests:
%.o : include/%.cpp
$(CC) $(CFLAGS) $(DEFS) -c $(<) -o $@
+install:
+ install --mode=755 $(STATIC) $(PREFIX)/lib/
+ install --mode=755 @sharedname@ $(PREFIX)/lib/
+ $(LN) -sf @sharedname@ $(PREFIX)/lib/$(SHARED)
+ $(LN) -sf @sharedname@ $(PREFIX)/lib/$(SHARED).$(MAJOR)
+ install --mode=644 $(LIBNAME).pc $(PREFIX)/lib/pkgconfig
+ install --mode=644 RtAudio.h RtError.h $(PREFIX)/include/
+ install --mode=755 rtaudio-config $(PREFIX)/bin/
+
+uninstall:
+ -@rm -vf $(patsubst %,$(PREFIX)/lib/%, $(LIBRARIES) $(SHARED).$(MAJOR) $(SHARED).$(RELEASE))
+ -@rm -vf $(PREFIX)/lib/pkgconfig/$(LIBNAME).pc
+ -@rm -vf $(PREFIX)/bin/rtaudio-config
+
clean :
$(RM) -f $(LIBRARIES) @sharedname@ $(SHARED)*
$(RM) -f $(OBJECTS)
$(RM) -f $(LIBRARIES) @sharedname@ $(SHARED)*
$(RM) -f $(OBJECTS)
$(RM) -f *~
- $(RM) -rf config.log config.status autom4te.cache Makefile rtaudio-config librtaudio.pc
+ $(RM) -rf config.log config.status autom4te.cache Makefile rtaudio-config $(LIBNAME).pc
cd tests && $(MAKE) distclean
strip :
strip $(LIBRARIES)
ranlib $(LIBRARIES)
cd tests && $(MAKE) strip
+
+.PHONY: clean distclean strip install uninstall
# Checks for functions
AC_CHECK_FUNC(gettimeofday, [cppflag="$cppflag -DHAVE_GETTIMEOFDAY"], )
+# Set paths if prefix is defined
+if test x"$prefix" != x; then
+ LIBS="$LIBS -L$prefix/lib"
+ CPPFLAGS="$CPPFLAGS -I$prefix/include"
+fi
+
# For -I and -D flags
CPPFLAGS="$CPPFLAGS $cppflag"
CXXFLAGS="@CXXFLAGS@"
CPPFLAGS="@CPPFLAGS@"
-if (test "x$1" == "x--libs") ; then
- echo "$LIBRARY"
-elif (test "x$1" == "x--cxxflags") ; then
+if (test "x$1" = "x--libs") ; then
+ echo "$LIBRARY -lrtaudio"
+elif (test "x$1" = "x--cxxflags") ; then
echo "$CXXFLAGS"
-elif (test "x$1" == "x--cppflags") ; then
+elif (test "x$1" = "x--cppflags") ; then
echo "$CPPFLAGS"
else
echo "Unknown option: $1"