You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
3.0 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #
  2. # Makefile for blobs library for OpenCV Version 4 and its examples
  3. #
  4. # Modifications to the Makefile by Carl J. Nobile
  5. #
  6. AR = ar rcs # ru
  7. CXX = g++
  8. MAJORVERSION = 8
  9. MINORVERSION = 3
  10. PATCHLEVEL = 0
  11. BASEDIR = $(shell pwd)
  12. PACKAGE_DIR = $(shell echo $${PWD\#\#*/})
  13. VERSION = ${MAJORVERSION}.${MINORVERSION}.${PATCHLEVEL}
  14. DISTNAME = ${PACKAGE_DIR}-$(VERSION)
  15. PREFIX = /usr/local
  16. LIBDIR = $(PREFIX)/lib
  17. INCDIR = $(PREFIX)/include
  18. TESTDIR = testBlobs
  19. CFLAGS = `pkg-config --cflags opencv gtk+-2.0`
  20. LDFLAGS = `pkg-config --libs opencv gtk+-2.0`
  21. INCFLAGS = -I.
  22. LIBFLAGS = -L. -lblob
  23. SHARED = -fPIC
  24. OPTIONS = -O3 -ansi -pipe -fstrength-reduce -finline-functions -Wall \
  25. -Wno-unused-result
  26. OBJS1 = Blob.o BlobContour.o BlobOperators.o BlobResult.o \
  27. ComponentLabeling.o
  28. HEADERS = BlobContour.h Blob.h BlobLibraryConfiguration.h \
  29. BlobOperators.h BlobResult.h ComponentLabeling.h counted_ptr.h
  30. CFLAGS += $(SHARED) $(OPTIONS)
  31. .SUFFIXES: .cpp.o
  32. .cpp.o: ; echo 'Compiling $*.cpp' ; $(CXX) $(CFLAGS) -c $*.cpp
  33. .SILENT:
  34. all :
  35. make shared
  36. make static
  37. # Target to build shared objects.
  38. shared : $(OBJS1)
  39. $(CXX) -shared -Wl,-soname,libblob.so.$(MAJORVERSION) \
  40. -o libblob.so.$(VERSION) $(OBJS1)
  41. -ln -sf libblob.so.$(VERSION) libblob.so.$(MAJORVERSION)
  42. -ln -sf libblob.so.$(VERSION) libblob.so
  43. # Target to build the static library.
  44. static : $(OBJS1)
  45. $(AR) libblob.a $(OBJS1)
  46. ranlib libblob.a
  47. # Target to build the test program.
  48. test : shared
  49. @echo Build tests, examples and tools...
  50. $(CXX) -g $(TESTDIR)/main.cpp $(LDFLAGS) $(CFLAGS) $(INCFLAGS) \
  51. $(LIBFLAGS) -o $(TESTDIR)/blobdemo
  52. # Header file dependencies. This forces a recompilation if headers change.
  53. $(OBJS1): $(HEADERS)
  54. # Target to run the test program without having to install the libraries.
  55. runtest : test
  56. (export LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH); \
  57. cd testBlobs; ./blobdemo)
  58. # Target to install all libraries. (Must be run as root)
  59. install : all
  60. install -m0644 -D libblob.so.$(VERSION) $(LIBDIR)
  61. install -m0644 -D BlobResult.h $(INCDIR)
  62. -(cd $(LIBDIR); ln -fs libblob.so.$(VERSION) libblob.so.$(MAJORVERSION))
  63. -(cd $(LIBDIR); ln -fs libblob.so.$(VERSION) libblob.so)
  64. /sbin/ldconfig
  65. install -m0644 libblob.a $(LIBDIR)
  66. # Target to uninstall all library and header. (Must be run as root)
  67. uninstall:
  68. (cd $(LIBDIR); rm -f libblob.*)
  69. (cd $(INCDIR); rm -f BlobResult.h)
  70. # Target to package both tar, zip and md5sum files.
  71. package : tarball zip
  72. # Target to create the distribution tarball and md5 checksum file.
  73. tarball : clean
  74. @(cd ..; tar -czvf $(DISTNAME).tar.gz --exclude .svn $(PACKAGE_DIR); \
  75. md5sum $(DISTNAME).tar.gz > $(DISTNAME).md5)
  76. # Target to create the distribution zip and md5 checksum file.
  77. zip : clean
  78. @(cd ..; zip -r $(DISTNAME).zip $(PACKAGE_DIR) -x /*/.svn/*; \
  79. md5sum $(DISTNAME).zip >> $(DISTNAME).md5)
  80. # Target to clean the project.
  81. clean :
  82. @echo Cleaning...
  83. @rm -f *.o *~ \#*\#
  84. @rm -f libblob.*
  85. @(cd $(TESTDIR); rm -f *.o *~ \#*\# blobdemo)