]> git.dkaiser.de - 42/cpp01.git/commitdiff
Setup ex03
authorDominik Kaiser <dkaiser@student.42heilbronn.de>
Mon, 10 Feb 2025 11:02:09 +0000 (12:02 +0100)
committerDominik Kaiser <dkaiser@student.42heilbronn.de>
Mon, 10 Feb 2025 11:02:09 +0000 (12:02 +0100)
ex03/HumanA.cpp [new file with mode: 0644]
ex03/HumanA.hpp [new file with mode: 0644]
ex03/HumanB.cpp [new file with mode: 0644]
ex03/HumanB.hpp [new file with mode: 0644]
ex03/Makefile [new file with mode: 0644]
ex03/Weapon.cpp [new file with mode: 0644]
ex03/Weapon.hpp [new file with mode: 0644]
ex03/main.cpp [new file with mode: 0644]

diff --git a/ex03/HumanA.cpp b/ex03/HumanA.cpp
new file mode 100644 (file)
index 0000000..38d2076
--- /dev/null
@@ -0,0 +1,12 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   HumanA.cpp                                         :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: dkaiser <dkaiser@student.42heilbronn.de    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/02/10 12:00:00 by dkaiser           #+#    #+#             */
+/*   Updated: 2025/02/10 12:00:02 by dkaiser          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
diff --git a/ex03/HumanA.hpp b/ex03/HumanA.hpp
new file mode 100644 (file)
index 0000000..0c8cde6
--- /dev/null
@@ -0,0 +1,16 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   HumanA.hpp                                         :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: dkaiser <dkaiser@student.42heilbronn.de    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/02/10 11:59:28 by dkaiser           #+#    #+#             */
+/*   Updated: 2025/02/10 11:59:50 by dkaiser          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef HUMANA_H_
+#define HUMANA_H_
+
+#endif
diff --git a/ex03/HumanB.cpp b/ex03/HumanB.cpp
new file mode 100644 (file)
index 0000000..4550c59
--- /dev/null
@@ -0,0 +1,12 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   HumanB.cpp                                         :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: dkaiser <dkaiser@student.42heilbronn.de    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/02/10 12:00:11 by dkaiser           #+#    #+#             */
+/*   Updated: 2025/02/10 12:01:05 by dkaiser          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
diff --git a/ex03/HumanB.hpp b/ex03/HumanB.hpp
new file mode 100644 (file)
index 0000000..d8ccdc8
--- /dev/null
@@ -0,0 +1,16 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   HumanB.hpp                                         :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: dkaiser <dkaiser@student.42heilbronn.de    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/02/10 12:00:55 by dkaiser           #+#    #+#             */
+/*   Updated: 2025/02/10 12:00:58 by dkaiser          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef HUMANB_H_
+#define HUMANB_H_
+
+#endif
diff --git a/ex03/Makefile b/ex03/Makefile
new file mode 100644 (file)
index 0000000..5359067
--- /dev/null
@@ -0,0 +1,50 @@
+################################################################################
+################################## VARIABLES ###################################
+################################################################################
+
+NAME    := unnecessary_violence
+
+CC      =  c++
+CFLAGS  =  -Wall -Wextra -Werror -std=c++17
+HEADERS =  -I.
+
+SRC     := main.cpp Weapon.cpp HumanA.cpp HumanB.cpp
+
+OBJ_DIR := _obj
+OBJ     := $(addprefix $(OBJ_DIR)/, $(SRC:%.cpp=%.o))
+
+################################################################################
+#################################### RULES #####################################
+################################################################################
+
+all: $(NAME)
+
+$(NAME): $(OBJ)
+       @$(CC) $(CFLAGS) $^ -o $@ $(HEADERS)
+       @echo "[$(NAME)] Created binary."
+
+$(OBJ_DIR)/%.o: %.cpp
+       @if [ ! -d "$(dir $@)" ]; then \
+               mkdir -p $(dir $@); \
+       fi
+       @$(CC) $(CFLAGS) -c $< -o $@ $(HEADERS)
+       @echo "[$(NAME)] Compiled $<."
+
+clean:
+       @if [ -d "$(OBJ_DIR)" ]; then \
+               rm -rf $(OBJ_DIR); \
+               echo "[$(NAME)] Removed object files."; \
+       fi
+
+fclean: clean
+       @if [ -f "$(NAME)" ]; then \
+               rm -f $(NAME); \
+               echo "[$(NAME)] Removed binary."; \
+       fi
+
+re:    fclean all
+
+.PHONY: all clean fclean re
+
+################################################################################
+################################################################################
diff --git a/ex03/Weapon.cpp b/ex03/Weapon.cpp
new file mode 100644 (file)
index 0000000..42bb132
--- /dev/null
@@ -0,0 +1,12 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Weapon.cpp                                         :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: dkaiser <dkaiser@student.42heilbronn.de    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/02/10 11:59:21 by dkaiser           #+#    #+#             */
+/*   Updated: 2025/02/10 11:59:21 by dkaiser          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
diff --git a/ex03/Weapon.hpp b/ex03/Weapon.hpp
new file mode 100644 (file)
index 0000000..ee8c299
--- /dev/null
@@ -0,0 +1,16 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Weapon.hpp                                         :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: dkaiser <dkaiser@student.42heilbronn.de    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/02/10 11:58:44 by dkaiser           #+#    #+#             */
+/*   Updated: 2025/02/10 11:59:10 by dkaiser          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef WEAPON_H_
+#define WEAPON_H_
+
+#endif
diff --git a/ex03/main.cpp b/ex03/main.cpp
new file mode 100644 (file)
index 0000000..b2ae001
--- /dev/null
@@ -0,0 +1,14 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   main.cpp                                           :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: dkaiser <dkaiser@student.42heilbronn.de    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/02/10 11:58:15 by dkaiser           #+#    #+#             */
+/*   Updated: 2025/02/10 11:58:24 by dkaiser          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+int main(void)
+{}