make dist
This commit is contained in:
parent
6c5c8460b7
commit
1d93e556c0
2
.gitignore
vendored
2
.gitignore
vendored
@ -10,3 +10,5 @@ pipetest
|
||||
result.txt
|
||||
minishell.log
|
||||
minishell_tester/
|
||||
release/
|
||||
sources.mk
|
||||
8
Makefile
8
Makefile
@ -6,7 +6,7 @@
|
||||
# By: qmennen <qmennen@student.codam.nl> +#+ #
|
||||
# +#+ #
|
||||
# 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"
|
||||
|
||||
17
distribute.sh
Executable file
17
distribute.sh
Executable file
@ -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
|
||||
@ -1,12 +1,12 @@
|
||||
# **************************************************************************** #
|
||||
# #
|
||||
# :::::::: #
|
||||
# Makefile :+: :+: #
|
||||
# Makefile.old :+: :+: #
|
||||
# +:+ #
|
||||
# By: qmennen <qmennen@student.codam.nl> +#+ #
|
||||
# By: whaffman <whaffman@student.codam.nl> +#+ #
|
||||
# +#+ #
|
||||
# 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 $@
|
||||
|
||||
@ -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"))
|
||||
Loading…
Reference in New Issue
Block a user