From 04a8ef186f57002d9defa79cfe5f9af7cd084e30 Mon Sep 17 00:00:00 2001 From: whaffman Date: Fri, 21 Mar 2025 14:57:55 +0100 Subject: [PATCH] mkae it nice --- .vscode/c_cpp_properties.json | 16 --------------- Makefile | 35 +++++++++++++++++++++++++++++++++ common.mk | 4 +++- ex00/{ => src}/megaphone.cpp | 0 ex01/{src => inc}/Contact.hpp | 0 ex01/{src => inc}/PhoneBook.hpp | 0 ex02/{ => inc}/Account.hpp | 0 ex02/{ => src}/Account.cpp | 0 ex02/{ => src}/tests.cpp | 0 9 files changed, 38 insertions(+), 17 deletions(-) delete mode 100644 .vscode/c_cpp_properties.json create mode 100644 Makefile rename ex00/{ => src}/megaphone.cpp (100%) rename ex01/{src => inc}/Contact.hpp (100%) rename ex01/{src => inc}/PhoneBook.hpp (100%) rename ex02/{ => inc}/Account.hpp (100%) rename ex02/{ => src}/Account.cpp (100%) rename ex02/{ => src}/tests.cpp (100%) diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json deleted file mode 100644 index 9e6febf..0000000 --- a/.vscode/c_cpp_properties.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "configurations": [ - { - "name": "Linux", - "includePath": [ - "${workspaceFolder}/**" - ], - "defines": [], - "compilerPath": "/usr/bin/clang", - "cStandard": "c17", - "cppStandard": "c++14", - "intelliSenseMode": "linux-clang-x64" - } - ], - "version": 4 -} \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..953f693 --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +# **************************************************************************** # +# # +# :::::::: # +# Makefile :+: :+: # +# +:+ # +# By: whaffman +#+ # +# +#+ # +# Created: 2025/03/21 14:50:00 by whaffman #+# #+# # +# Updated: 2025/03/21 14:55:52 by whaffman ######## odam.nl # +# # +# **************************************************************************** # + +EX = ex00 ex01 ex02 + +all: + for ex in $(EX); do \ + $(MAKE) -C $$ex; \ + done + +clean: + for ex in $(EX); do \ + $(MAKE) -C $$ex clean; \ + done + +fclean: + for ex in $(EX); do \ + $(MAKE) -C $$ex fclean; \ + done + +re: + for ex in $(EX); do \ + $(MAKE) -C $$ex re; \ + done + +.PHONY: all clean fclean re \ No newline at end of file diff --git a/common.mk b/common.mk index 19184e4..b91b6da 100644 --- a/common.mk +++ b/common.mk @@ -1,3 +1,5 @@ +INC = -I./inc + VPATH = src OBJ = $(SRC:.cpp=.o) CC = c++ @@ -8,7 +10,7 @@ $(NAME): $(OBJ) $(CC) $(CFLAGS) $(OBJ) -o $(NAME) %.o: %.cpp - $(CC) $(CFLAGS) -c $< -o $@ + $(CC) $(CFLAGS) $(INC) -c $< -o $@ clean: rm -f $(OBJ) diff --git a/ex00/megaphone.cpp b/ex00/src/megaphone.cpp similarity index 100% rename from ex00/megaphone.cpp rename to ex00/src/megaphone.cpp diff --git a/ex01/src/Contact.hpp b/ex01/inc/Contact.hpp similarity index 100% rename from ex01/src/Contact.hpp rename to ex01/inc/Contact.hpp diff --git a/ex01/src/PhoneBook.hpp b/ex01/inc/PhoneBook.hpp similarity index 100% rename from ex01/src/PhoneBook.hpp rename to ex01/inc/PhoneBook.hpp diff --git a/ex02/Account.hpp b/ex02/inc/Account.hpp similarity index 100% rename from ex02/Account.hpp rename to ex02/inc/Account.hpp diff --git a/ex02/Account.cpp b/ex02/src/Account.cpp similarity index 100% rename from ex02/Account.cpp rename to ex02/src/Account.cpp diff --git a/ex02/tests.cpp b/ex02/src/tests.cpp similarity index 100% rename from ex02/tests.cpp rename to ex02/src/tests.cpp