faiss/Makefile

93 lines
1.7 KiB
Makefile
Raw Normal View History

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.
-include makefile.inc
2017-02-22 23:26:44 +01:00
SRC=$(wildcard *.cpp)
OBJ=$(SRC:.cpp=.o)
2017-02-24 08:37:57 -08:00
############################
# Building
2017-02-22 23:26:44 +01:00
default: libfaiss.a
2017-02-22 23:26:44 +01:00
all: libfaiss.a libfaiss.$(SHAREDEXT)
2017-02-24 08:37:57 -08:00
libfaiss.a: $(OBJ)
ar r $@ $^
2017-02-22 23:26:44 +01:00
libfaiss.$(SHAREDEXT): $(OBJ)
$(CXX) $(SHAREDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
2017-02-22 23:26:44 +01:00
%.o: %.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(CPUFLAGS) -c $< -o $@
2017-02-24 08:37:57 -08:00
clean:
rm -f libfaiss.*
rm -f $(OBJ)
2017-02-22 23:26:44 +01:00
############################
# Installing
2017-02-22 23:26:44 +01: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
installdirs:
$(MKDIR_P) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)/faiss
2017-02-22 23:26:44 +01:00
uninstall:
rm $(DESTDIR)$(libdir)/libfaiss.a
rm $(DESTDIR)$(libdir)/libfaiss.$(SHAREDEXT)
rm -rf $(DESTDIR)$(includedir)/faiss
2017-02-22 23:26:44 +01:00
#############################
# Dependencies
2017-02-22 23:26:44 +01:00
-include depend
2017-02-22 23:26:44 +01: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
#############################
# Tests
2017-02-22 23:26:44 +01:00
test: libfaiss.a py
make -C tests run
PYTHONPATH=./python/build/`ls python/build | grep lib` \
$(PYTHON) -m unittest discover tests/ -v
2017-02-22 23:26:44 +01:00
#############################
# Demos
2017-02-22 23:26:44 +01:00
demos: libfaiss.a
make -C demos
2017-02-22 23:26:44 +01:00
#############################
# Misc
2017-02-22 23:26:44 +01:00
misc/test_blas: misc/test_blas.cpp
$(CXX) $(CXXFLAG) $(LDFLAGS) -o $@ $^ $(LIBS)
2017-02-22 23:26:44 +01:00
2017-02-22 23:26:44 +01:00
#############################
# Python
2017-02-22 23:26:44 +01:00
py:
$(MAKE) -C python build
.PHONY: all clean default demos install installdirs py test uninstall