code_analyzer/Makefile
2022-01-04 00:53:08 +01:00

58 lines
1.1 KiB
Makefile

CC = gcc
CFLAGS = -Wall -Wextra -Werror -O3
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) vgraph.dot > vgraph.pdf
$(DOT) vCC.dot > vCC.pdf
$(DOT) mcgraph.dot > mcgraph.pdf
$(DOT) mcCC.dot > mcCC.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:
$(RM) $(OBJS)
fclean: clean
$(RM) $(NAME) vgraph.pdf vgraph.dot mcgraph.pdf mcgraph.dot mcCC.dot mcCC.pdf vCC.dot vCC.pdf
.PHONY: all clean fclean re dist distdir debug