C/C++ container implementation
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.

66 lines
1.6KB

  1. # documentation here
  2. # https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html
  3. # http://www.partow.net/programming/makefile/index.html
  4. CXX = gcc
  5. GCXX_DEBUG = -ggdb3 -DDEBUG -g -fstack-protector-all -Wstack-protector -fno-omit-frame-pointer
  6. CFLAGS = -pedantic-errors -Wall -Wextra --std=gnu18 # -Werror
  7. LDFLAGS = # $(shell pkg-config --libs libcrypto jsoncpp)
  8. INCLUDE = -Iinclude/
  9. # path #
  10. BIN_DIR = ./bin
  11. OBJ_DIR = ./obj
  12. SRC_DIR = ./src
  13. SRC_EXT = .c
  14. TARGET = out.ex
  15. # code lists #
  16. # List all source files in the source directory
  17. SRC := \
  18. $(wildcard $(SRC_DIR)/module1/*$(SRC_EXT)) \
  19. $(wildcard $(SRC_DIR)/*$(SRC_EXT)) \
  20. # Set the object file names, with the source directory stripped
  21. # from the path, and the build path prepended in its place
  22. OBJECTS = $(SRC:$(SRC_DIR)/%.$(SRC_EXT)=$(OBJ_DIR)/%.o)
  23. all: $(BIN_DIR)/$(TARGET)
  24. $(OBJ_DIR)/%.o: %$(SRC_EXT)
  25. $(CXX) $(CFLAGS) $(INCLUDE) -c $< -o $@ $(LDFLAGS)
  26. $(BIN_DIR)/$(TARGET): $(OBJECTS)
  27. $(CXX) $(CFLAGS) -o $(BIN_DIR)/$(TARGET) $^ $(LDFLAGS)
  28. .PHONY: all debug release valgrind clean markdown doxygenconf
  29. debug: CFLAGS += $(GCXX_DEBUG)
  30. debug: all
  31. release: CFLAGS += -O2
  32. release: all
  33. # debug target
  34. valgrind:
  35. @valgrind --leak-check=full --show-leak-kinds=all --trace-children=no --track-origins=yes $(BIN_DIR)/$(TARGET) /bin/ls -la /bin
  36. run:
  37. $(BIN_DIR)/$(TARGET) /bin/ls -la /
  38. clean:
  39. @rm -f $(OBJ_DIR)/*.o
  40. @rm -f $(BIN_DIR)/*.ex
  41. markdown:
  42. @pandoc --defaults=pandoc-config.yaml
  43. doxygenconf:
  44. @doxygen -g doxygen.conf
  45. doc: doxygen.conf
  46. @doxygen doxygen.conf
  47. busybox_setup:
  48. @tar xvf alpine-minirootfs-3.12.0-x86.tar.gz --directory=./busybox