Makefile revision 5b372b684ac4f9585fb2a00098d77f959bec0074
14384370cec4c917dd5d093546ac524b13e8d7dbaAlex Deymo# Default options 24384370cec4c917dd5d093546ac524b13e8d7dbaAlex DeymoUSE_BSDIFF ?= y 34384370cec4c917dd5d093546ac524b13e8d7dbaAlex Deymo 44384370cec4c917dd5d093546ac524b13e8d7dbaAlex DeymoBINARIES-y = bspatch 54384370cec4c917dd5d093546ac524b13e8d7dbaAlex DeymoBINARIES-$(USE_BSDIFF) += bsdiff 64384370cec4c917dd5d093546ac524b13e8d7dbaAlex Deymo 74384370cec4c917dd5d093546ac524b13e8d7dbaAlex DeymoBINARIES += $(BINARIES-y) 8c285feace7a051368d4c5069cc6e0f30cd769f0dThe Android Open Source Project 999b5374de3cf896b8b77779798218be279bda210Gilad ArnoldINSTALL = install 1099b5374de3cf896b8b77779798218be279bda210Gilad ArnoldCFLAGS += -O3 -Wall -Werror 11a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex DeymoCXXFLAGS += -std=c++11 12c285feace7a051368d4c5069cc6e0f30cd769f0dThe Android Open Source Project 1399b5374de3cf896b8b77779798218be279bda210Gilad ArnoldDESTDIR ?= 1499b5374de3cf896b8b77779798218be279bda210Gilad ArnoldPREFIX = /usr 1599b5374de3cf896b8b77779798218be279bda210Gilad ArnoldBINDIR = $(PREFIX)/bin 1699b5374de3cf896b8b77779798218be279bda210Gilad ArnoldDATADIR = $(PREFIX)/share 1799b5374de3cf896b8b77779798218be279bda210Gilad ArnoldMANDIR = $(DATADIR)/man 1899b5374de3cf896b8b77779798218be279bda210Gilad ArnoldMAN1DIR = $(MANDIR)/man1 1999b5374de3cf896b8b77779798218be279bda210Gilad ArnoldINSTALL_PROGRAM ?= $(INSTALL) -c -m 755 2099b5374de3cf896b8b77779798218be279bda210Gilad ArnoldINSTALL_MAN ?= $(INSTALL) -c -m 444 2199b5374de3cf896b8b77779798218be279bda210Gilad Arnold 22a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymo.PHONY: all test clean 2399b5374de3cf896b8b77779798218be279bda210Gilad Arnoldall: $(BINARIES) 24a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymotest: unittests 2599b5374de3cf896b8b77779798218be279bda210Gilad Arnoldclean: 26a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymo rm -f *.o $(BINARIES) unittests 2799b5374de3cf896b8b77779798218be279bda210Gilad Arnold 28a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex DeymoBSDIFF_LIBS = -lbz2 -ldivsufsort -ldivsufsort64 29a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex DeymoBSDIFF_OBJS = \ 30a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymo bsdiff.o 3199b5374de3cf896b8b77779798218be279bda210Gilad Arnold 32a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex DeymoBSPATCH_LIBS = -lbz2 33a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex DeymoBSPATCH_OBJS = \ 34a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymo bspatch.o \ 3503f1debab429e673ba5e9e317c5a04e36e850cefAlex Deymo extents.o \ 3603f1debab429e673ba5e9e317c5a04e36e850cefAlex Deymo extents_file.o \ 375b372b684ac4f9585fb2a00098d77f959bec0074Sen Jiang file.o \ 385b372b684ac4f9585fb2a00098d77f959bec0074Sen Jiang memory_file.o 39a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymo 405b372b684ac4f9585fb2a00098d77f959bec0074Sen JiangUNITTEST_LIBS = -lgmock -lgtest -lpthread 41a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex DeymoUNITTEST_OBJS = \ 42a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymo bsdiff_unittest.o \ 435b372b684ac4f9585fb2a00098d77f959bec0074Sen Jiang bspatch_unittest.o \ 4403f1debab429e673ba5e9e317c5a04e36e850cefAlex Deymo extents_file_unittest.o \ 45437b7afd23768d737055fa70b79f5f2f714583a5Alex Deymo extents_unittest.o \ 46a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymo test_utils.o \ 47a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymo testrunner.o 48a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymo 49a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymobsdiff: $(BSDIFF_OBJS) bsdiff_main.o 50a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymobsdiff: LDLIBS += $(BSDIFF_LIBS) 51a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymo 52a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymobspatch: $(BSPATCH_OBJS) bspatch_main.o 53a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymobspatch: LDLIBS += $(BSPATCH_LIBS) 54a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymo 55a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymounittests: LDLIBS += $(BSDIFF_LIBS) $(BSPATCH_LIBS) $(UNITTEST_LIBS) 56a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymounittests: $(BSPATCH_OBJS) $(BSDIFF_OBJS) $(UNITTEST_OBJS) 5703f1debab429e673ba5e9e317c5a04e36e850cefAlex Deymo 5803f1debab429e673ba5e9e317c5a04e36e850cefAlex Deymounittests bsdiff bspatch: 59a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymo $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $^ $(LDLIBS) 60a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymo 61a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymo# Source file dependencies. 6220891f9c246ec36e6c148579522ac00051b64457Alex Deymobsdiff.o: bsdiff.cc 6320891f9c246ec36e6c148579522ac00051b64457Alex Deymobsdiff_main.o: bsdiff_main.cc bsdiff.h 64a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymobsdiff_unittest.o: bsdiff_unittest.cc bsdiff.h test_utils.h 65437b7afd23768d737055fa70b79f5f2f714583a5Alex Deymobspatch.o: bspatch.cc bspatch.h extents.h extents_file.h file_interface.h \ 66437b7afd23768d737055fa70b79f5f2f714583a5Alex Deymo file.h 6720891f9c246ec36e6c148579522ac00051b64457Alex Deymobspatch_main.o: bspatch_main.cc bspatch.h 685b372b684ac4f9585fb2a00098d77f959bec0074Sen Jiangbspatch_unittest.o: bspatch_unittest.cc bspatch.h test_utils.h 6903f1debab429e673ba5e9e317c5a04e36e850cefAlex Deymoextents.o: extents.cc extents.h extents_file.h file_interface.h 7003f1debab429e673ba5e9e317c5a04e36e850cefAlex Deymoextents_file.o: extents_file.cc extents_file.h file_interface.h 7103f1debab429e673ba5e9e317c5a04e36e850cefAlex Deymoextents_file_unittest.o: extents_file_unittest.cc extents_file.h \ 7203f1debab429e673ba5e9e317c5a04e36e850cefAlex Deymo file_interface.h 73437b7afd23768d737055fa70b79f5f2f714583a5Alex Deymoextents_unittest.o: extents_unittest.cc extents.h extents_file.h \ 74437b7afd23768d737055fa70b79f5f2f714583a5Alex Deymo file_interface.h 7503f1debab429e673ba5e9e317c5a04e36e850cefAlex Deymofile.o: file.cc file.h file_interface.h 765b372b684ac4f9585fb2a00098d77f959bec0074Sen Jiangmemory_file.o: memory_file.cc memory_file.h file_interface.h 77a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymotestrunner.o: testrunner.cc 78a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymotest_utils.o: test_utils.cc test_utils.h 79c285feace7a051368d4c5069cc6e0f30cd769f0dThe Android Open Source Project 80c285feace7a051368d4c5069cc6e0f30cd769f0dThe Android Open Source Projectinstall: 8199b5374de3cf896b8b77779798218be279bda210Gilad Arnold mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MAN1DIR) 8299b5374de3cf896b8b77779798218be279bda210Gilad Arnold $(INSTALL_PROGRAM) $(BINARIES) $(DESTDIR)$(BINDIR) 8399b5374de3cf896b8b77779798218be279bda210Gilad Arnoldifndef WITHOUT_MAN 8499b5374de3cf896b8b77779798218be279bda210Gilad Arnold $(INSTALL_MAN) $(BINARIES:=.1) $(DESTDIR)$(MAN1DIR) 8599b5374de3cf896b8b77779798218be279bda210Gilad Arnoldendif 86