Batteries-Included Filesystems
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.
 
 
 
 

80 lines
2.4 KiB

  1. # build environment
  2. ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
  3. BUILD ?= $(ROOT_DIR)/build
  4. VERSION ?= 0.2
  5. OS ?= LINUX
  6. BUILD_BINDIR := $(BUILD)/bin
  7. BUILD_SBINDIR := $(BUILD)/sbin
  8. BUILD_LIBDIR := $(BUILD)/lib
  9. BUILD_USRBIN := $(BUILD)/usr/bin
  10. BUILD_USRLIB := $(BUILD)/usr/lib
  11. BUILD_USRSHARE := $(BUILD)/usr/share
  12. BUILD_PKGCONFIG := $(BUILD)/usr/lib/pkgconfig
  13. BUILD_USRSBIN := $(BUILD)/usr/sbin
  14. BUILD_INCLUDEDIR := $(BUILD)/usr/include/
  15. BUILD_PRIVATE_INCLUDEDIR := $(BUILD)/fskit_private
  16. BUILD_ETCDIR := $(BUILD)/etc
  17. # install environment
  18. DESTDIR ?=
  19. PREFIX ?= /usr/local
  20. INCLUDE_PREFIX ?= $(PREFIX)
  21. BINDIR ?= $(DESTDIR)$(PREFIX)/bin
  22. SBINDIR ?= $(DESTDIR)$(PREFIX)/sbin
  23. LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
  24. INCLUDEDIR ?= $(DESTDIR)$(INCLUDE_PREFIX)/include
  25. PKGCONFIGDIR ?= $(DESTDIR)$(PREFIX)/lib/pkgconfig
  26. ETCDIR ?= $(DESTDIR)$(PREFIX)/etc
  27. # libfskit
  28. BUILD_LIBFSKIT := $(BUILD_USRLIB)
  29. BUILD_LIBFSKIT_HEADERS := $(BUILD_INCLUDEDIR)/fskit
  30. BUILD_LIBFSKIT_DIRS := $(BUILD_LIBFSKIT) $(BUILD_LIBFSKIT_HEADERS)
  31. INSTALL_LIBFSKIT := $(LIBDIR)
  32. INSTALL_LIBFSKIT_HEADERS := $(INCLUDEDIR)/fskit
  33. LIBFSKIT_MAJOR := 1
  34. LIBFSKIT_MINOR := 0
  35. LIBFSKIT_PATCH := 2
  36. # libfskit_fuse
  37. BUILD_LIBFSKIT_FUSE := $(BUILD_USRLIB)
  38. BUILD_LIBFSKIT_FUSE_HEADERS := $(BUILD_INCLUDEDIR)/fskit/fuse
  39. BUILD_LIBFSKIT_FUSE_DIRS := $(BUILD_LIBFSKIT_FUSE) $(BUILD_LIBFSKIT_FUSE_HEADERS)
  40. INSTALL_LIBFSKIT_FUSE := $(LIBDIR)
  41. INSTALL_LIBFSKIT_FUSE_HEADERS := $(INCLUDEDIR)/fskit/fuse
  42. LIBFSKIT_FUSE_MAJOR := 1
  43. LIBFSKIT_FUSE_MINOR := 0
  44. LIBFSKIT_FUSE_PATCH := 2
  45. # special defs
  46. REPL ?= 1
  47. REPL_DEF := 1
  48. ifeq ($(REPL),1)
  49. REPL_DEF := -D_FSKIT_REPL
  50. endif
  51. # compiler
  52. CCFLAGS := -Wall -std=c11 -g -fPIC -fstack-protector -fstack-protector-all -pthread -Wno-unused-variable -Wno-unused-but-set-variable
  53. CXXFLAGS := -Wall -g -fPIC -fstack-protector -fstack-protector-all -pthread -Wno-unused-variable -Wno-unused-but-set-variable
  54. INC := -I. -I$(ROOT_DIR) -I$(BUILD_INCLUDEDIR) -I$(BUILD)
  55. DEFS := -D_THREAD_SAFE -D__STDC_FORMAT_MACROS $(REPL_DEF)
  56. LIBINC := -L. -L$(BUILD_USRLIB)
  57. CC ?= cc
  58. CXX ?= c++
  59. # build setup
  60. BUILD_DIRS := $(sort $(BUILD_LIBFSKIT_DIRS) $(BUILD_LIBFSKIT_FUSE_DIRS) $(BUILD_PRIVATE_INCLUDEDIR))
  61. all:
  62. build_setup: $(BUILD_DIRS)
  63. $(BUILD_DIRS):
  64. @mkdir -p "$@"
  65. # rule to make an archive member from an object file
  66. (%.o): %.o ; $(AR) cr $@ $*.o
  67. # debugging...
  68. print-%: ; @echo $*=$($*)