C++ library and utilities for the NBT file format.
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.
 
 
 

75 lines
1.2 KiB

  1. EXE = nbt_dump
  2. TEST_EXE = test_nbt
  3. STATIC_LIB = libnbtpp.a
  4. LIB_SRCS = src/nbt.cpp \
  5. LIB_OBJS := $(LIB_SRCS:%.cpp=%.o)
  6. EXE_SRCS = \
  7. src/nbt_dump.cpp \
  8. EXE_OBJS := $(EXE_SRCS:%.cpp=%.o)
  9. INCDIRS = -Iinclude
  10. TEST_SRCS = \
  11. test/test_main.cpp \
  12. test/test_nbt.cpp \
  13. test/test_swaps.cpp \
  14. CXXFLAGS += -std=gnu++14 -Wall -MD -g $(INCDIRS)
  15. LDFLAGS += -g
  16. TEST_OBJS := $(TEST_SRCS:%.cpp=%.o)
  17. TEST_INCDIRS = -Ilib/Catch2/single_include
  18. DEPS := $(LIB_SRCS:%.cpp=%.d) $(EXE_SRCS:%.cpp=%.d) $(TEST_SRCS:%.cpp=%.d)
  19. all: $(EXE) $(STATIC_LIB)
  20. .PHONY: test
  21. test: $(TEST_EXE) test_data
  22. $(EXE): $(EXE_OBJS) $(STATIC_LIB)
  23. $(CXX) $(LDFLAGS) -o [email protected] $^
  24. $(EXE_OBJS): $(STATIC_LIB)
  25. %.o: %.cpp
  26. $(CXX) -c $(CXXFLAGS) -o [email protected] $<
  27. $(STATIC_LIB): $(LIB_OBJS)
  28. ar rcs [email protected] $^
  29. $(TEST_OBJS): CXXFLAGS += $(TEST_INCDIRS)
  30. $(TEST_EXE): $(TEST_OBJS) $(STATIC_LIB) test_data
  31. $(CXX) $(LDFLAGS) -o [email protected] $(TEST_OBJS) $(STATIC_LIB)
  32. .PHONY: test_data
  33. test_data:
  34. $(MAKE) -C test/data
  35. .PHONY: check
  36. check: $(TEST_EXE)
  37. ./$(TEST_EXE)
  38. .PHONY: clean
  39. clean:
  40. rm -f $(EXE) $(STATIC_LIB) $(LIB_OBJS) $(EXE_OBJS) $(TEST_EXE) $(TEST_OBJS) $(DEPS)
  41. make -C test/data clean
  42. .PHONY: tags ctags
  43. tags ctags:
  44. ctags -R src include test
  45. -include $(DEPS)