Makefile 518 B

12345678910111213141516171819202122232425262728293031
  1. # SPDX-License-Identifier: GPL-2.0
  2. CC=gcc
  3. CFLAGS=-std=gnu11 -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshadow
  4. ifeq ("$(DEBUG)","1")
  5. CFLAGS += -g -fsanitize=address -fsanitize=leak -static-libasan
  6. endif
  7. SRCS=$(wildcard *.c)
  8. OBJS=$(patsubst %.c,%.o,${SRCS})
  9. include $(wildcard *.d)
  10. all: ynl.a
  11. ynl.a: $(OBJS)
  12. @echo -e "\tAR $@"
  13. @ar rcs $@ $(OBJS)
  14. clean:
  15. rm -f *.o *.d *~
  16. rm -rf __pycache__
  17. distclean: clean
  18. rm -f *.a
  19. %.o: %.c
  20. $(COMPILE.c) -MMD -c -o $@ $<
  21. .PHONY: all clean distclean
  22. .DEFAULT_GOAL=all