Makefile revision 03f1debab429e673ba5e9e317c5a04e36e850cef
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 \ 3703f1debab429e673ba5e9e317c5a04e36e850cefAlex Deymo file.o 38a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymo 3903f1debab429e673ba5e9e317c5a04e36e850cefAlex DeymoUNITTEST_LIBS = -lgmock -lgtest 40a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex DeymoUNITTEST_OBJS = \ 41a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymo bsdiff_unittest.o \ 4203f1debab429e673ba5e9e317c5a04e36e850cefAlex Deymo extents_file_unittest.o \ 43a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymo test_utils.o \ 44a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymo testrunner.o 45a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymo 46a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymobsdiff: $(BSDIFF_OBJS) bsdiff_main.o 47a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymobsdiff: LDLIBS += $(BSDIFF_LIBS) 48a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymo 49a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymobspatch: $(BSPATCH_OBJS) bspatch_main.o 50a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymobspatch: LDLIBS += $(BSPATCH_LIBS) 51a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymo 52a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymounittests: LDLIBS += $(BSDIFF_LIBS) $(BSPATCH_LIBS) $(UNITTEST_LIBS) 53a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymounittests: $(BSPATCH_OBJS) $(BSDIFF_OBJS) $(UNITTEST_OBJS) 5403f1debab429e673ba5e9e317c5a04e36e850cefAlex Deymo 5503f1debab429e673ba5e9e317c5a04e36e850cefAlex Deymounittests bsdiff bspatch: 56a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymo $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $^ $(LDLIBS) 57a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymo 58a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymo# Source file dependencies. 5920891f9c246ec36e6c148579522ac00051b64457Alex Deymobsdiff.o: bsdiff.cc 6020891f9c246ec36e6c148579522ac00051b64457Alex Deymobsdiff_main.o: bsdiff_main.cc bsdiff.h 61a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymobsdiff_unittest.o: bsdiff_unittest.cc bsdiff.h test_utils.h 6203f1debab429e673ba5e9e317c5a04e36e850cefAlex Deymobspatch.o: bspatch.cc extents.h extents_file.h file_interface.h 6320891f9c246ec36e6c148579522ac00051b64457Alex Deymobspatch_main.o: bspatch_main.cc bspatch.h 6403f1debab429e673ba5e9e317c5a04e36e850cefAlex Deymoextents.o: extents.cc extents.h extents_file.h file_interface.h 6503f1debab429e673ba5e9e317c5a04e36e850cefAlex Deymoextents_file.o: extents_file.cc extents_file.h file_interface.h 6603f1debab429e673ba5e9e317c5a04e36e850cefAlex Deymoextents_file_unittest.o: extents_file_unittest.cc extents_file.h \ 6703f1debab429e673ba5e9e317c5a04e36e850cefAlex Deymo file_interface.h 6803f1debab429e673ba5e9e317c5a04e36e850cefAlex Deymofile.o: file.cc file.h file_interface.h 69a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymotestrunner.o: testrunner.cc 70a5cff2283b9bc60da9f4e74ba07a2119f5616653Alex Deymotest_utils.o: test_utils.cc test_utils.h 71c285feace7a051368d4c5069cc6e0f30cd769f0dThe Android Open Source Project 72c285feace7a051368d4c5069cc6e0f30cd769f0dThe Android Open Source Projectinstall: 7399b5374de3cf896b8b77779798218be279bda210Gilad Arnold mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MAN1DIR) 7499b5374de3cf896b8b77779798218be279bda210Gilad Arnold $(INSTALL_PROGRAM) $(BINARIES) $(DESTDIR)$(BINDIR) 7599b5374de3cf896b8b77779798218be279bda210Gilad Arnoldifndef WITHOUT_MAN 7699b5374de3cf896b8b77779798218be279bda210Gilad Arnold $(INSTALL_MAN) $(BINARIES:=.1) $(DESTDIR)$(MAN1DIR) 7799b5374de3cf896b8b77779798218be279bda210Gilad Arnoldendif 78