code_analyzer/Makefile
2022-01-08 13:54:02 +01:00

54 lines
1.0 KiB
Makefile

CC = cc
CFLAGS = -Wall -Wextra -Werror -O3
NAME = code-analyzer
AUTHOR = Volodymyr_Patuta
VERSION = 1.1.0
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
EXTRAFILES = LICENSE README.md test.c .clang-format rapport.pdf
DISTFILES = $(SRCDIR) Makefile $(EXTRAFILES)
distdir = $(AUTHOR)-$(NAME)-$(VERSION)
all: $(NAME)
graph:
dot -Tps:cairo:cairo graph.dot | ps2pdf - > graph.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) graph.dot graph.pdf
.PHONY: all clean fclean re dist distdir debug