2017-02-22 23:26:44 +01:00
|
|
|
# Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
2017-07-30 00:18:45 -07:00
|
|
|
# This source code is licensed under the BSD+Patents license found in the
|
2017-02-22 23:26:44 +01:00
|
|
|
# LICENSE file in the root directory of this source tree.
|
|
|
|
|
2018-06-02 08:35:30 +02:00
|
|
|
-include makefile.inc
|
2017-02-22 23:26:44 +01:00
|
|
|
|
2018-06-02 08:35:30 +02:00
|
|
|
SRC=$(wildcard *.cpp)
|
|
|
|
OBJ=$(SRC:.cpp=.o)
|
2017-02-24 08:37:57 -08:00
|
|
|
|
|
|
|
|
2018-06-02 08:35:30 +02:00
|
|
|
############################
|
|
|
|
# Building
|
2017-02-22 23:26:44 +01:00
|
|
|
|
2018-06-02 08:35:30 +02:00
|
|
|
default: libfaiss.a
|
2017-02-22 23:26:44 +01:00
|
|
|
|
2018-06-02 08:35:30 +02:00
|
|
|
all: libfaiss.a libfaiss.$(SHAREDEXT)
|
2017-02-24 08:37:57 -08:00
|
|
|
|
2018-06-02 08:35:30 +02:00
|
|
|
libfaiss.a: $(OBJ)
|
|
|
|
ar r $@ $^
|
2017-02-22 23:26:44 +01:00
|
|
|
|
2018-06-02 08:35:30 +02:00
|
|
|
libfaiss.$(SHAREDEXT): $(OBJ)
|
|
|
|
$(CXX) $(SHAREDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
|
2017-02-22 23:26:44 +01:00
|
|
|
|
2018-06-02 08:35:30 +02:00
|
|
|
%.o: %.cpp
|
|
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(CPUFLAGS) -c $< -o $@
|
2017-02-24 08:37:57 -08:00
|
|
|
|
2018-06-02 08:35:30 +02:00
|
|
|
clean:
|
|
|
|
rm -f libfaiss.*
|
|
|
|
rm -f $(OBJ)
|
2017-02-22 23:26:44 +01:00
|
|
|
|
|
|
|
|
2018-06-02 08:35:30 +02:00
|
|
|
############################
|
|
|
|
# Installing
|
2017-02-22 23:26:44 +01:00
|
|
|
|
2018-06-02 08:35:30 +02:00
|
|
|
install: libfaiss.a libfaiss.$(SHAREDEXT) installdirs
|
|
|
|
cp libfaiss.a libfaiss.$(SHAREDEXT) $(DESTDIR)$(libdir)
|
|
|
|
cp *.h $(DESTDIR)$(includedir)/faiss/
|
2017-02-22 23:26:44 +01:00
|
|
|
|
2018-06-02 08:35:30 +02:00
|
|
|
installdirs:
|
|
|
|
$(MKDIR_P) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)/faiss
|
2017-02-22 23:26:44 +01:00
|
|
|
|
2018-06-02 08:35:30 +02:00
|
|
|
uninstall:
|
|
|
|
rm $(DESTDIR)$(libdir)/libfaiss.a
|
|
|
|
rm $(DESTDIR)$(libdir)/libfaiss.$(SHAREDEXT)
|
|
|
|
rm -rf $(DESTDIR)$(includedir)/faiss
|
2018-02-26 10:23:17 +00:00
|
|
|
|
2017-02-22 23:26:44 +01:00
|
|
|
|
2018-06-02 08:35:30 +02:00
|
|
|
#############################
|
|
|
|
# Dependencies
|
2017-02-22 23:26:44 +01:00
|
|
|
|
2018-06-02 08:35:30 +02:00
|
|
|
-include depend
|
2017-02-22 23:26:44 +01:00
|
|
|
|
2018-06-02 08:35:30 +02:00
|
|
|
# The above makefile.dep is generated by the following target:
|
|
|
|
depend:
|
|
|
|
for i in $(SRC); do \
|
|
|
|
$(CXXCPP) $(CPPFLAGS) -MM $$i; \
|
|
|
|
done > depend
|
2017-02-22 23:26:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
#############################
|
2018-06-02 08:35:30 +02:00
|
|
|
# Tests
|
2017-02-22 23:26:44 +01:00
|
|
|
|
2018-06-04 12:20:44 +02:00
|
|
|
test: libfaiss.a py
|
2018-06-02 08:35:30 +02:00
|
|
|
make -C tests run
|
2018-06-06 14:06:24 +02:00
|
|
|
PYTHONPATH=./python/build/`ls python/build | grep lib` \
|
|
|
|
$(PYTHON) -m unittest discover tests/ -v
|
2017-02-22 23:26:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
#############################
|
2018-06-02 08:35:30 +02:00
|
|
|
# Demos
|
2017-02-22 23:26:44 +01:00
|
|
|
|
2018-06-02 08:35:30 +02:00
|
|
|
demos: libfaiss.a
|
|
|
|
make -C demos
|
2017-02-22 23:26:44 +01:00
|
|
|
|
|
|
|
|
2018-06-02 08:35:30 +02:00
|
|
|
#############################
|
|
|
|
# Misc
|
2017-02-22 23:26:44 +01:00
|
|
|
|
2018-06-02 08:35:30 +02:00
|
|
|
misc/test_blas: misc/test_blas.cpp
|
2018-06-13 11:49:02 +02:00
|
|
|
$(CXX) $(CXXFLAG) $(LDFLAGS) -o $@ $^ $(LIBS)
|
2017-02-22 23:26:44 +01:00
|
|
|
|
2018-06-04 12:20:44 +02:00
|
|
|
|
2017-02-22 23:26:44 +01:00
|
|
|
#############################
|
2018-06-02 08:35:30 +02:00
|
|
|
# Python
|
2017-02-22 23:26:44 +01:00
|
|
|
|
2018-06-04 12:20:44 +02:00
|
|
|
py:
|
2018-06-06 14:06:24 +02:00
|
|
|
$(MAKE) -C python build
|
2018-04-05 11:45:33 +02:00
|
|
|
|
2017-03-20 10:48:35 -07:00
|
|
|
|
2018-06-02 08:35:30 +02:00
|
|
|
.PHONY: all clean default demos install installdirs py test uninstall
|