From 27fdb228d5fa6a5afbbac7ffce52e8f23674358d Mon Sep 17 00:00:00 2001 From: Lukas Jiriste Date: Thu, 24 Oct 2024 14:43:41 +0200 Subject: [PATCH] Add main.cpp and Makefile to ex00 --- ex00/Makefile | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ ex00/main.cpp | 15 +++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 ex00/Makefile create mode 100644 ex00/main.cpp diff --git a/ex00/Makefile b/ex00/Makefile new file mode 100644 index 0000000..3bd789c --- /dev/null +++ b/ex00/Makefile @@ -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 \ + Fixed.cpp \ + +SOURCES := $(addprefix $(SRCDIR)/, $(SOURCES)) + +OBJECTS := $(SOURCES:.cpp=.o) + +NAME := fixed + +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 diff --git a/ex00/main.cpp b/ex00/main.cpp new file mode 100644 index 0000000..72562e0 --- /dev/null +++ b/ex00/main.cpp @@ -0,0 +1,15 @@ +#include "Fixed.h" +#include + +int main() +{ + Fixed a; + Fixed b(a); + Fixed c; + + c = b; + std::cout << a.getRawBits() << std::endl; + std::cout << b.getRawBits() << std::endl; + std::cout << c.getRawBits() << std::endl; + return (0); +} -- 2.30.2