summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgaryscavone <garyscavone@users.noreply.github.com>2013-10-15 08:44:20 -0700
committergaryscavone <garyscavone@users.noreply.github.com>2013-10-15 08:44:20 -0700
commit068617080d0a6c5416dee2844c16ee4f91bbf293 (patch)
tree79cdd62026d770c6bffbc71b469427c80cd9da49
parentd6fd1442b2fe1bb366c5539354eeb841fc6943a1 (diff)
parent606e1c1722640db96c6b12bdd524f702891f45ed (diff)
Merge pull request #2 from radarsat1/master
Add install/uninstall targets, fix rtaudio-config, support --prefix option. (2nd try)
-rw-r--r--Makefile.in23
-rw-r--r--configure.ac6
-rw-r--r--librtaudio.pc.in2
-rw-r--r--rtaudio-config.in8
4 files changed, 32 insertions, 7 deletions
diff --git a/Makefile.in b/Makefile.in
index 41685e5..a2ab13c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -6,7 +6,8 @@ LN = /bin/ln
OBJECTS = RtAudio.o @objects@
-STATIC = librtaudio.a
+LIBNAME = librtaudio
+STATIC = $(LIBNAME).a
SHARED = @sharedlib@
RELEASE = 4.0.12
MAJOR = 4
@@ -19,6 +20,8 @@ RANLIB = @RANLIB@
DEFS = @CPPFLAGS@
CFLAGS = @CXXFLAGS@ -Iinclude -fPIC
+PREFIX = @prefix@
+
all : $(LIBRARIES)
tests:
@@ -37,6 +40,20 @@ $(LIBRARIES): $(OBJECTS)
%.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)
@@ -47,10 +64,12 @@ distclean:
$(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
diff --git a/configure.ac b/configure.ac
index 6586116..b89fdb0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,6 +44,12 @@ AC_ARG_ENABLE(debug,
# 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"
diff --git a/librtaudio.pc.in b/librtaudio.pc.in
index d7591a7..b4f3985 100644
--- a/librtaudio.pc.in
+++ b/librtaudio.pc.in
@@ -1,4 +1,4 @@
-prefix=/usr/local
+prefix=@prefix@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
diff --git a/rtaudio-config.in b/rtaudio-config.in
index 2422b60..5f83d51 100644
--- a/rtaudio-config.in
+++ b/rtaudio-config.in
@@ -8,11 +8,11 @@ LIBRARY="@LIBS@"
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"