common.mk 963 B

123456789101112131415161718192021222324252627282930
  1. ifndef PYTHON
  2. # Default to python3. Some distros like CentOS 8 do not have `python`.
  3. ifeq ($(origin PYTHON), undefined)
  4. PYTHON := $(shell which python3 || which python || echo python3)
  5. endif
  6. export PYTHON
  7. endif
  8. # To setup tmp directory, first recognize some old variables for setting
  9. # test tmp directory or base tmp directory. TEST_TMPDIR is usually read
  10. # by RocksDB tools though Env/FileSystem::GetTestDirectory.
  11. ifeq ($(TEST_TMPDIR),)
  12. TEST_TMPDIR := $(TMPD)
  13. endif
  14. ifeq ($(TEST_TMPDIR),)
  15. ifeq ($(BASE_TMPDIR),)
  16. BASE_TMPDIR :=$(TMPDIR)
  17. endif
  18. ifeq ($(BASE_TMPDIR),)
  19. BASE_TMPDIR :=/tmp
  20. endif
  21. # Use /dev/shm if it has the sticky bit set (otherwise, /tmp or other
  22. # base dir), and create a randomly-named rocksdb.XXXX directory therein.
  23. TEST_TMPDIR := $(shell f=/dev/shm; test -k $$f || f=$(BASE_TMPDIR); \
  24. perl -le 'use File::Temp "tempdir";' \
  25. -e 'print tempdir("'$$f'/rocksdb.XXXX", CLEANUP => 0)')
  26. endif
  27. export TEST_TMPDIR