Makefile now creates .debug file when "make debug" is executed.
This make Makefile able to remember the debug mode for futher builds
and rebuilds. The debug mode can be disabled by removing the .debug file
or by executing "make nodebug" which will also build the project.
*.swp
.libtemp
tags
+.debug
CC := cc
CFLAGS := -std=c99 -Wall -Wextra -Werror -Wpedantic
+
+ifneq ("$(wildcard .debug)","")
+ CFLAGS += -g
+endif
+
AR := ar
RM := rm -f
all : $(NAME)
-debug : CFLAGS += -g
-debug : $(NAME)
+.debug :
+ $(MAKE) fclean
+ touch $@
+
+debug : .debug
+ $(MAKE) all
+
+nodebug :
+ $(RM) .debug
+ $(MAKE) re
$(NAME) : $(OBJECTS)
$(AR) rcs $@ $^