Makefile.freebsd 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. ##############################################################################
  2. # FreeBSD 10+ bmake Makefile
  3. #
  4. # Usage:
  5. # $ make -f Makefile.freebsd [compiler={clang|gcc}] [std={98|11|14|17|20|23}] [pic=1]
  6. .include "../src/defs.mk"
  7. OBJSUFF = o
  8. ARSUFF = a
  9. std = 17
  10. compiler = clang
  11. ##############################################################################
  12. .if $(compiler) == gcc
  13. CC := g++ -std=c++$(std) -pthread
  14. CFLAGS := -pedantic-errors -DNDEBUG -O3 -ffunction-sections -fdata-sections
  15. WARNS := $($(std)==98:?-Wno-long-long:)
  16. CFLAGS_PIC = -fPIC -fvisibility=hidden -fvisibility-inlines-hidden
  17. ##############################################################################
  18. .elif $(compiler) == clang
  19. CC := clang++ -std=c++$(std) -pthread
  20. CFLAGS := -pedantic-errors -DNDEBUG -O3
  21. WARNS := $($(std)==98:?-Wno-long-long :)-Wno-non-literal-null-conversion
  22. CFLAGS_PIC = -fPIC -fvisibility=hidden -fvisibility-inlines-hidden
  23. .endif
  24. ##############################################################################
  25. LIBSUFFIX = $(std)$(pic:?_pic:)
  26. LIBFILE := lib$(LIBNAME)$(LIBSUFFIX).$(ARSUFF)
  27. CFLAGS_ALL = -I../include $(pic:?$(CFLAGS_PIC) :)$(CFLAGS) $(WARNS)
  28. AR = ar
  29. ARFLAGS = s
  30. ARFLAGS_ALL = r$(ARFLAGS) $@
  31. .ifndef SOURCES
  32. SOURCES != ls *.cpp
  33. .endif
  34. OBJS := $(SOURCES:.cpp=.$(OBJSUFF))
  35. .PHONY: clean
  36. .include "../src/rules.mk"