Commit 1ae74944 authored by Lucas Hosseini's avatar Lucas Hosseini Committed by Matthijs Douze

Add (un)install Makefile targets for CPU version. (#344)

* Remove useless LIBNAME macro in Makefile.

* Add installdirs, install, and uninstall Makefile targets.

* Fix merge.
parent 11154692
......@@ -11,9 +11,9 @@ MAKEFILE_INC=makefile.inc
-include $(MAKEFILE_INC)
LIBNAME=libfaiss
PREFIX ?= /usr/local/
all: .env_ok $(LIBNAME).a demos/demo_ivfpq_indexing
all: .env_ok libfaiss.a demos/demo_ivfpq_indexing
py: _swigfaiss.so
......@@ -33,11 +33,11 @@ LIBOBJ=hamming.o utils.o \
IndexIVFFlat.o OnDiskInvertedLists.o
$(LIBNAME).a: $(LIBOBJ)
ar r $(LIBNAME).a $^
libfaiss.a: $(LIBOBJ)
ar r libfaiss.a $^
$(LIBNAME).$(SHAREDEXT): $(LIBOBJ)
$(CXX) $(LDFLAGS) $(FAISSSHAREDFLAGS) -o $(LIBNAME).$(SHAREDEXT) $^ $(BLASLDFLAGS)
libfaiss.$(SHAREDEXT): $(LIBOBJ)
$(CXX) $(LDFLAGS) $(FAISSSHAREDFLAGS) -o libfaiss.$(SHAREDEXT) $^ $(BLASLDFLAGS)
.cpp.o:
$(CXX) $(CXXFLAGS) -c $< -o $@ $(FLAGS) $(EXTRAFLAGS)
......@@ -62,11 +62,11 @@ BLASLDFLAGSSO ?= $(BLASLDFLAGS)
tests/test_blas: tests/test_blas.cpp
$(CXX) $(CXXFLAGS) $< -o $@ $(LDFLAGS) $(BLASLDFLAGS) $(BLASCFLAGS)
demos/demo_ivfpq_indexing: demos/demo_ivfpq_indexing.cpp $(LIBNAME).a
$(CXX) -o $@ $(CXXFLAGS) $< $(LIBNAME).a $(LDFLAGS) $(BLASLDFLAGS)
demos/demo_ivfpq_indexing: demos/demo_ivfpq_indexing.cpp libfaiss.a
$(CXX) -o $@ $(CXXFLAGS) $< libfaiss.a $(LDFLAGS) $(BLASLDFLAGS)
demos/demo_sift1M: demos/demo_sift1M.cpp $(LIBNAME).a
$(CXX) -o $@ $(CXXFLAGS) $< $(LIBNAME).a $(LDFLAGS) $(BLASLDFLAGS)
demos/demo_sift1M: demos/demo_sift1M.cpp libfaiss.a
$(CXX) -o $@ $(CXXFLAGS) $< libfaiss.a $(LDFLAGS) $(BLASLDFLAGS)
#############################
......@@ -83,7 +83,7 @@ python/swigfaiss_wrap.cxx: swigfaiss.swig $(HFILES)
# extension is .so even on the mac
python/_swigfaiss.so: python/swigfaiss_wrap.cxx $(LIBNAME).a
python/_swigfaiss.so: python/swigfaiss_wrap.cxx libfaiss.a
$(CXX) -I. $(CXXFLAGS) $(LDFLAGS) $(PYTHONCFLAGS) $(SHAREDFLAGS) \
-o $@ $^ $(BLASLDFLAGSSO)
......@@ -156,9 +156,19 @@ IndexIVFFlat.o: IndexIVFFlat.cpp IndexIVFFlat.h IndexIVF.h Index.h \
OnDiskInvertedLists.o: OnDiskInvertedLists.cpp OnDiskInvertedLists.h \
IndexIVF.h Index.h Clustering.h Heap.h FaissAssert.h FaissException.h
installdirs:
mkdir -p $(DESTDIR)$(PREFIX)/lib $(DESTDIR)$(PREFIX)/include/faiss
install: libfaiss.a libfaiss.$(SHAREDEXT) installdirs
cp libfaiss.a libfaiss.$(SHAREDEXT) $(DESTDIR)$(PREFIX)/lib/
cp ./*.h $(DESTDIR)$(PREFIX)/include/faiss/
uninstall:
rm $(DESTDIR)$(PREFIX)/lib/libfaiss.*
rm -rf $(DESTDIR)$(PREFIX)/include/faiss
clean:
rm -f $(LIBNAME).a $(LIBNAME).$(SHAREDEXT)* *.o \
rm -f libfaiss.a libfaiss.$(SHAREDEXT)* *.o \
lua/swigfaiss.so lua/swigfaiss_wrap.cxx \
python/_swigfaiss.so python/swigfaiss_wrap.cxx \
python/swigfaiss.py _swigfaiss.so swigfaiss.py
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment