From 1d93e556c0bd04cc09334d3cf95e906c5f3df94b Mon Sep 17 00:00:00 2001 From: whaffman Date: Fri, 7 Mar 2025 13:39:40 +0100 Subject: [PATCH] make dist --- .gitignore | 2 ++ Makefile | 8 ++++++-- distribute.sh | 17 +++++++++++++++++ Makefile.old => release_makefile.mk | 24 ++++++------------------ sources.mk | 2 -- 5 files changed, 31 insertions(+), 22 deletions(-) create mode 100755 distribute.sh rename Makefile.old => release_makefile.mk (67%) delete mode 100644 sources.mk diff --git a/.gitignore b/.gitignore index 09879ed..6b3f46c 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ pipetest result.txt minishell.log minishell_tester/ +release/ +sources.mk \ No newline at end of file diff --git a/Makefile b/Makefile index 54393c0..484ea2a 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: qmennen +#+ # # +#+ # # Created: 2024/10/15 11:48:46 by whaffman #+# #+# # -# Updated: 2025/03/06 15:56:12 by whaffman ######## odam.nl # +# Updated: 2025/03/07 13:31:12 by whaffman ######## odam.nl # # # # **************************************************************************** # @@ -33,8 +33,10 @@ ifeq ($(UNAME_S),Linux) LDLIBS := -L$(LIBFT_PATH) -lft -lreadline endif +VPATH = $(shell find $(SRC_PATH) -type d | tr '\n' ':') +SOURCES = $(shell basename -a $(shell find $(SRC_PATH) -type f -name "*.c")) # Include sources.mk if it exists --include sources.mk +# -include sources.mk # Build configurations BUILD_CONFIGS = release debug asan tsan @@ -134,6 +136,7 @@ help: @echo "" @echo "Targets:" @echo " $(green)$(bold)all $(reset)- Build all configurations (release, debug, asan, tsan)" + @echo " $(green)$(bold)dist $(reset)- rebuild the folderstructure for distribution" @echo " $(green)$(bold)clean $(reset)- Remove build artifacts" @echo " $(green)$(bold)fclean $(reset)- Remove build artifacts and the executable" @echo " $(green)$(bold)re $(reset)- Rebuild the project" @@ -152,6 +155,7 @@ help: @echo " $(green)$(bold)run_debug $(reset)- Run the debug build" @echo " $(green)$(bold)run_asan $(reset)- Run the AddressSanitizer build" @echo " $(green)$(bold)run_tsan $(reset)- Run the ThreadSanitizer build" + @echo " $(green)$(bold)run_valgrind $(reset)- Run the release build with valgrind" @echo "" @echo "Other targets:" @echo " $(green)$(bold)submodules $(reset)- Check and reinitialize git submodules" diff --git a/distribute.sh b/distribute.sh new file mode 100755 index 0000000..514879b --- /dev/null +++ b/distribute.sh @@ -0,0 +1,17 @@ +#!/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/Makefile.old b/release_makefile.mk similarity index 67% rename from Makefile.old rename to release_makefile.mk index 634f3cc..fa173ef 100644 --- a/Makefile.old +++ b/release_makefile.mk @@ -1,12 +1,12 @@ # **************************************************************************** # # # # :::::::: # -# Makefile :+: :+: # +# Makefile.old :+: :+: # # +:+ # -# By: qmennen +#+ # +# By: whaffman +#+ # # +#+ # -# Created: 2024/10/15 11:48:46 by whaffman #+# #+# # -# Updated: 2025/02/20 11:10:42 by whaffman ######## odam.nl # +# Created: 2025/03/07 13:34:44 by whaffman #+# #+# # +# Updated: 2025/03/07 13:34:45 by whaffman ######## odam.nl # # # # **************************************************************************** # @@ -22,9 +22,7 @@ LIBFT = $(LIBFT_PATH)/libft.a OBJ_PATH = obj -VPATH = src:src/environment:src/prompt:src/lexer:src/token:src/utils: -VPATH += src/executor:src/parser:src/expander:src/debug:src/signal:src/builtin -SOURCES = $(shell basename -a $(shell find $(SRC_PATH) -type f -name "*.c")) +-include sources.mk OBJECTS = $(addprefix $(OBJ_PATH)/, $(SOURCES:.c=.o)) DEPENDS = ${OBJECTS:.o=.d} @@ -34,26 +32,16 @@ RM = rm -rf INCLUDES = -I./$(INC_PATH) -I./$(LIBFT_INC_PATH) CFLAGS = -Wall -Wextra -Werror -fsanitize=address,undefined -MMD -g3 - -UNAME_S := $(shell uname -s) -ifeq ($(UNAME_S),Linux) - LDLIBS := -L$(LIBFT_PATH) -lft -lreadline -endif +LDLIBS := -L$(LIBFT_PATH) -lft -lreadline all: $(NAME) - echo $(SOURCES) $(NAME): $(LIBFT) $(OBJECTS) $(CC) $(CFLAGS) $(OBJECTS) $(LDLIBS) -o $(NAME) --include ${DEPENDS} - $(LIBFT): $(LIBFT_PATH) $(MAKE) -C $(LIBFT_PATH) -$(LIBFT_PATH): - git submodule add https://gitea.duinvoetje.nl/willem/libft.git $(LIBFT_PATH) - $(OBJ_PATH): mkdir -p $@ diff --git a/sources.mk b/sources.mk deleted file mode 100644 index 619029c..0000000 --- a/sources.mk +++ /dev/null @@ -1,2 +0,0 @@ -VPATH = $(shell find $(SRC_PATH) -type d | tr '\n' ':') -SOURCES = $(shell basename -a $(shell find $(SRC_PATH) -type f -name "*.c")) \ No newline at end of file