prefix=`mlt-config --prefix`
[ "$prefix" = "" ] && echo "Can't locate MLT's prefix - please reconfigure MLT." && exit 1
+# Default the libdir
+libdir=""
+
# Allow override from command line
-[ "$1" != "" ] && prefix="${1#--prefix=}"
+for i in $*
+do
+ case $i in
+ --prefix=* ) prefix="${1#--prefix=}" ;;
+ --libdir=* ) libdir="${1#--libdir=}" ;;
+ esac
+done
+
+# Determine the libdir if it's not specified in the args
+[ "$libdir" = "" ] && libdir=$prefix/lib
# Sanity check
[ ! -d "$prefix" ] && echo "Invalid prefix $prefix - aborting" && exit 1
echo "prefix=$prefix" > config.mak
+echo "libdir=$libdir" >> config.mak
targetos=$(uname -s)
Darwin)
echo LIBSUF=.dylib
echo "CXXFLAGS+=-D__DARWIN__ -Wall -fPIC `mlt-config --cflags`"
- echo "LDFLAGS+=-dynamiclib `mlt-config --libs` `mlt-config miracle --libs` `mlt-config valerie --libs` -single_module"
+ echo "LIBFLAGS=-dynamiclib"
+ echo "LDFLAGS+=`mlt-config --libs` `mlt-config miracle --libs` `mlt-config valerie --libs` -single_module"
;;
Linux)
echo LIBSUF=.so
echo "CXXFLAGS+=-pthread -Wall -fPIC `mlt-config --cflags`"
- echo "LDFLAGS+=-shared `mlt-config --libs` `mlt-config miracle --libs`"
+ echo "LIBFLAGS=-shared"
+ echo "LDFLAGS+=`mlt-config --libs` `mlt-config miracle --libs`"
;;
esac >> config.mak
all: $(TARGET)
$(TARGET): $(OBJS)
- $(CC) -o $@ $(OBJS) $(LDFLAGS)
+ $(CC) $(LIBFLAGS) -o $@ $(OBJS) $(LDFLAGS)
clean:
$(RM) $(OBJS) $(TARGET)
install:
- $(INSTALL) -d "$(DESTDIR)$(prefix)/lib"
- $(INSTALL) -m 755 $(TARGET) $(DESTDIR)$(prefix)/lib
+ $(INSTALL) -d "$(DESTDIR)$(libdir)"
+ $(INSTALL) -m 755 $(TARGET) $(DESTDIR)$(libdir)
$(INSTALL) -d "$(DESTDIR)$(prefix)/include/mlt++"
$(INSTALL) -m 644 $(HEADERS) "$(DESTDIR)$(prefix)/include/mlt++"
/sbin/ldconfig || true