Add Makefile to ex00
authorLukas Jiriste <ljiriste@student.42prague.com>
Wed, 22 Jan 2025 11:53:29 +0000 (12:53 +0100)
committerLukas Jiriste <ljiriste@student.42prague.com>
Wed, 22 Jan 2025 11:54:50 +0000 (12:54 +0100)
ex00/Makefile [new file with mode: 0644]

diff --git a/ex00/Makefile b/ex00/Makefile
new file mode 100644 (file)
index 0000000..ffda4b0
--- /dev/null
@@ -0,0 +1,53 @@
+CC := c++
+CFLAGS = -std=c++98 -Wall -Wextra -Werror -Wpedantic
+
+ifneq ("$(wildcard .debug)","")
+       CFLAGS += -g
+endif
+
+RM := rm -f
+
+INCDIR := inc
+INCDIR += $(addsuffix /inc, $(SUBPROJECTS));
+ifneq ($(INCLUDE),)
+       INCLUDE := $(addprefix -I, $(INCDIR))
+endif
+
+SRCDIR := .
+
+SOURCES :=     main.cpp                        \
+                       ScalarConverter.cpp     \
+
+SOURCES := $(addprefix $(SRCDIR)/, $(SOURCES))
+
+OBJECTS := $(SOURCES:.cpp=.o)
+
+NAME := convert
+
+all : $(NAME)
+
+debug : .debug
+       $(MAKE) all
+
+nodebug :
+       $(RM) .debug
+       $(MAKE) re
+
+.% :
+       $(MAKE) fclean
+       touch $@
+
+$(NAME) : $(OBJECTS)
+       $(CC) $(CFLAGS) -o $@ $^ $(LINKS)
+
+%.o : %.cpp
+       $(CC) $(CFLAGS) -o $@ -c $< $(INCLUDE)
+
+clean :
+       $(RM) $(OBJECTS)
+
+fclean : clean
+       $(RM) $(NAME)
+
+re : fclean
+       $(MAKE) all