diff --git a/Makefile b/Makefile index 484ea2a..e320d94 100644 --- a/Makefile +++ b/Makefile @@ -6,11 +6,12 @@ # By: qmennen +#+ # # +#+ # # Created: 2024/10/15 11:48:46 by whaffman #+# #+# # -# Updated: 2025/03/07 13:31:12 by whaffman ######## odam.nl # +# Updated: 2025/03/07 14:57:36 by whaffman ######## odam.nl # # # # **************************************************************************** # NAME = minishell +DIST_PATH = dist FLAGS=-DNOCOLORS -DNOBANNER -DNOPROMPT -DSHELL_NAME=\"bash\" # FLAGS=-DNOBANNER @@ -130,6 +131,27 @@ srcs: $(info $(bold)$(green)Regenerating sources.mk on next make$(reset)) $(RM) sources.mk +dist: $(SRC_PATH) $(INC_PATH) $(LIB_PATH) release_makefile.mk + @if [ ! -d $(DIST_PATH) ]; then \ + mkdir -p $(DIST_PATH); \ + else \ + rm -rf $(DIST_PATH)/*; \ + fi + @rsync -av --include='*/' --include='*.c' --include='*.h' --include='Makefile' --exclude='*' src/ $(DIST_PATH)/src/ + @rsync -av --include='*/' --include='*.c' --include='*.h' --include='Makefile' --exclude='*' inc/ $(DIST_PATH)/inc/ + @rsync -av --include='*/' --include='*.c' --include='*.h' --include='Makefile' --exclude='*' lib/ $(DIST_PATH)/lib/ + @cp release_makefile.mk $(DIST_PATH)/Makefile + @make -s sources.mk + @cp sources.mk $(DIST_PATH)/sources.mk + @norminette $(DIST_PATH) > /dev/null; \ + if [ $$? -ne 0 ]; then \ + echo "\e[31mNorminette failed, deleting dist folder\e[0m"; \ + norminette $(DIST_PATH) | grep "Error"; \ + rm -rf $(DIST_PATH); \ + exit 1; \ + fi + @echo -e "\e[32mDistribute successful\e[0m" + # Show this help. help: @echo "Usage: make [target]" @@ -171,7 +193,7 @@ submodules: git submodule update --init; \ fi -.PHONY: all clean fclean re srcs run help +.PHONY: all clean fclean re srcs run help dist red:=$(shell tput setaf 1) green:=$(shell tput setaf 2) diff --git a/distribute.sh b/distribute.sh deleted file mode 100755 index 514879b..0000000 --- a/distribute.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -# This script is used to distribute the files to the target directory - -# Check if the target directory exists -if [ ! -d $1 ]; then - mkdir -p $1 -else - rm -rf $1/* -fi - -rsync -av --include='*/' --include='*.c' --include='*.h' --include='Makefile' --exclude='*' src/ $1/src/ -rsync -av --include='*/' --include='*.c' --include='*.h' --include='Makefile' --exclude='*' inc/ $1/inc/ -rsync -av --include='*/' --include='*.c' --include='*.h' --include='Makefile' --exclude='*' lib/ $1/lib/ -cp release_makefile.mk $1/Makefile -make sources.mk -cp sources.mk $1/sources.mk \ No newline at end of file diff --git a/release_makefile.mk b/release_makefile.mk index fa173ef..dcd5efd 100644 --- a/release_makefile.mk +++ b/release_makefile.mk @@ -1,12 +1,12 @@ # **************************************************************************** # # # # :::::::: # -# Makefile.old :+: :+: # +# release_makefile.mk :+: :+: # # +:+ # # By: whaffman +#+ # # +#+ # # Created: 2025/03/07 13:34:44 by whaffman #+# #+# # -# Updated: 2025/03/07 13:34:45 by whaffman ######## odam.nl # +# Updated: 2025/03/07 13:44:14 by whaffman ######## odam.nl # # # # **************************************************************************** # @@ -31,7 +31,7 @@ CC = cc RM = rm -rf INCLUDES = -I./$(INC_PATH) -I./$(LIBFT_INC_PATH) -CFLAGS = -Wall -Wextra -Werror -fsanitize=address,undefined -MMD -g3 +CFLAGS = -Wall -Wextra -Werror LDLIBS := -L$(LIBFT_PATH) -lft -lreadline all: $(NAME) @@ -52,7 +52,6 @@ clean: $(RM) $(OBJECTS) $(OBJ_PATH) $(MAKE) -C $(LIBFT_PATH) clean - fclean: clean $(RM) $(NAME) $(MAKE) -C $(LIBFT_PATH) fclean