code_analyzer/Makefile

60 lines
1.1 KiB
Makefile
Raw Normal View History

2021-12-21 20:45:44 +01:00
CC = gcc
CFLAGS = -Wall -Wextra -Werror -O3
# GCCVERSIONGTE10 := $(shell expr `gcc -dumpversion | cut -f1 -d.` \>= 10)
#
# ifeq "$(GCCVERSIONGTE10)" "1"
# CFLAGS += -fanalyzer
# endif
NAME = code-analyzer
AUTHOR = Volodymyr_Patuta
VERSION = 0.1
SRCDIR = ./src
SRCS = $(shell find $(SRCDIR) -name '*.c')
HEADERS = $(shell find $(SRCDIR) -name '*.h')
OBJS = $(SRCS:.c=.o)
RM = rm -f
TAR = tar
MKDIR = mkdir
CHMOD = chmod
CP = rsync -Rr
DOT = dot -Tpdf -Grankdir=LR
EXTRAFILES = LICENSE README.md
DISTFILES = $(SRCDIR) $(TESTDIR) Makefile $(EXTRAFILES)
distdir = $(AUTHOR)-$(NAME)-$(VERSION)
all: $(NAME)
graph:
$(DOT) graph.dot > out.pdf
debug: CFLAGS += -DDEBUG -g
debug: $(NAME)
$(SRC_DIR)/%.o: %.c
$(CC) $(CFLAGS) $< -c
$(NAME): $(OBJS)
$(CC) $(CFLAGS) $^ -o $(NAME)
dist: distdir
$(CHMOD) -R a+r $(distdir)
$(TAR) zcvf $(distdir).tgz $(distdir)
$(RM) -r $(distdir)
distdir: $(DISTFILES)
$(RM) -r $(distdir)
$(MKDIR) $(distdir)
$(CHMOD) 777 $(distdir)
$(CP) $(DISTFILES) $(distdir)
clean:
2022-01-02 16:48:29 +01:00
$(RM) $(OBJS)
fclean: clean
2022-01-02 16:48:29 +01:00
$(RM) $(NAME) out.pdf graph.dot
.PHONY: all clean fclean re dist distdir debug