C++11 library providing functionality common to all adapters.
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.

77 lines
1.8 KiB

4 years ago
5 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. # Copyright 2018, pEp Foundation
  2. # This file is part of lib pEp Adapter
  3. # This file may be used under the terms of the GNU General Public License version 3
  4. # see LICENSE.txt
  5. include Makefile.conf
  6. ifneq ($(wildcard local.conf),)
  7. $(info ================================================)
  8. $(info Overrides in \`local.conf\` are used.)
  9. $(info ================================================)
  10. endif
  11. ifdef BUILD_CONFIG
  12. $(info ================================================)
  13. $(info Overrides in \`$(BUILD_CONFIG)\` are used.)
  14. $(info ================================================)
  15. endif
  16. SOURCE=$(wildcard *.cc)
  17. HEADERS=$(wildcard *.hh *.hxx)
  18. OBJECTS=$(subst .cc,.o,$(SOURCE))
  19. WITHOUT_TESTS=$(patsubst test%.o,,$(OBJECTS))
  20. TARGET=libpEpAdapter.a
  21. EXTRA_LIB_PATHS=.:
  22. ifdef ENGINE_LIB
  23. EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(ENGINE_LIB)):
  24. endif
  25. # Remove trailing ':'
  26. EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS::=)
  27. ifeq ($(BUILD_FOR),Darwin)
  28. LIBPATH=DYLD_LIBRARY_PATH
  29. else
  30. LIBPATH=LD_LIBRARY_PATH
  31. endif
  32. $(TEST_CMD_PFX)=$(LIBPATH)=$(EXTRA_LIB_PATHS)
  33. .PHONY: all
  34. all: $(TARGET)
  35. # Rule copied from make's built-in rules
  36. %.o: %.cc %.hh
  37. $(COMPILE.cc) $(OUTPUT_OPTION) $<
  38. $(TARGET): $(WITHOUT_TESTS)
  39. ar -rc $@ $^
  40. .PHONY: clean
  41. clean:
  42. rm -f $(TARGET) $(OBJECTS) *.a test_adapter test_library lib
  43. .PHONY: distclean
  44. distclean: clean
  45. rm -Rf .gnupg .pEp_management*
  46. # $$(pwd) will return the incorrect directory, if make is run with `make -C ...`.
  47. .PHONY: test
  48. test: test_adapter test_library
  49. $(TEST_CMD_PFX) HOME=$$(pwd) ./test_adapter
  50. test_%: test_%.o $(TARGET)
  51. .PHONY: install
  52. install: $(TARGET)
  53. -mkdir -p $(PREFIX)/include/pEp
  54. cp $(HEADERS) $(PREFIX)/include/pEp/
  55. cp $(TARGET) $(PREFIX)/lib/
  56. .PHONY: uninstall
  57. uninstall:
  58. cd $(PREFIX)/include/pEp && rm -f $(HEADERS)
  59. cd $(PREFIX)/lib && rm -f $(TARGET)