Makefile 501 B

123456789101112131415161718192021222324252627282930
  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. distclean: clean
  17. rm -f *.a
  18. %.o: %.c
  19. $(COMPILE.c) -MMD -c -o $@ $<
  20. .PHONY: all clean distclean
  21. .DEFAULT_GOAL=all