unity build

This commit is contained in:
Willem Haffmans 2025-05-20 21:30:18 +02:00
parent f2c6b09af8
commit f8019acf7d

View File

@ -6,7 +6,7 @@
# By: whaffman <whaffman@student.codam.nl> +#+ # # By: whaffman <whaffman@student.codam.nl> +#+ #
# +#+ # # +#+ #
# Created: 2024/10/15 11:48:46 by whaffman #+# #+# # # Created: 2024/10/15 11:48:46 by whaffman #+# #+# #
# Updated: 2025/05/15 17:44:48 by whaffman ######## odam.nl # # Updated: 2025/05/20 21:27:02 by whaffman ######## odam.nl #
# # # #
# **************************************************************************** # # **************************************************************************** #
@ -92,6 +92,31 @@ $(foreach config,$(BUILD_CONFIGS),$(eval $(call BUILD_TARGETS,$(config))))
all: release debug asan tsan all: release debug asan tsan
$(info $(bold)$(green)All builc config have been build$(reset)) $(info $(bold)$(green)All builc config have been build$(reset))
# Unity/Jumbo/Blob build
ALL_SOURCES = $(shell find $(SRC_PATH) -type f -name "*.c")
run_unity: $(BUILD_PATH)/unity/$(NAME)
$(info $(bold)$(green)Running unity build$(reset))
./$(BUILD_PATH)/unity/$(NAME) $(RUN_ARGS)
unity: $(BUILD_PATH)/unity/$(NAME)
$(BUILD_PATH)/unity/$(NAME): $(BUILD_PATH)/unity/blob.c $(LIBFT) $(MLX42) $(ALL_SOURCES)
$(info $(bold)$(green)Building unity blob$(reset))
$(CC) $(release_CFLAGS) $(INCLUDES) -Isrc -MMD -MP -c $(BUILD_PATH)/unity/blob.c -o $(BUILD_PATH)/unity/blob.o
$(CC) $(release_CFLAGS) $(INCLUDES) -o $@ $(BUILD_PATH)/unity/blob.o $(LDLIBS)
$(BUILD_PATH)/unity/blob.c: $(ALL_SOURCES) $(BUILD_PATH)/unity
$(info $(bold)$(green)Generating unity blob.c$(reset))
@echo "/* This file is generated by the Makefile */" > $@
@echo "#include \"cub3d.h\"" >> $@
@echo $(ALL_SOURCES) | tr ' ' '\n' | sed 's%^%#include "../../%; s/$$/"/' >> $@
$(BUILD_PATH)/unity:
$(info $(bold)$(green)Creating unity build directory$(reset))
mkdir -p $(BUILD_PATH)/unity
# Build libft # Build libft
$(LIBFT): $(LIBFT_PATH) submodules $(LIBFT): $(LIBFT_PATH) submodules
$(info $(bold)$(green)Building libft$(reset)) $(info $(bold)$(green)Building libft$(reset))