Switched to Filelist.<name>.mk files

This commit is contained in:
Maieul BOYER 2024-07-23 22:04:11 +00:00
parent fd646bda95
commit c3626fc59e
42 changed files with 456 additions and 399 deletions

View file

@ -14,6 +14,15 @@ CompileFlags: # Tweak the parse settings
- "-I/home/maiboyer/Documents/ring-2/shcat/includes/"
- "-I/home/maiboyer/Documents/ring-2/shcat/output/include/"
- "-I/home/maiboyer/Documents/ring-2/shcat/generic_sources/header/"
- "-I/home/nixos/shcat/vendor/"
- "-I/home/nixos/shcat/stdme/include/"
- "-I/home/nixos/shcat/allocator/include/"
- "-I/home/nixos/shcat/stdme/vendor/"
- "-I/home/nixos/shcat/stdme/output/include/"
- "-I/home/nixos/shcat/stdme/generic_sources/header/"
- "-I/home/nixos/shcat/includes/"
- "-I/home/nixos/shcat/output/include/"
- "-I/home/nixos/shcat/generic_sources/header/"
- "-I/home/maix/school/shcat/vendor/"
- "-I/home/maix/school/shcat/stdme/include/"
- "-I/home/maix/school/shcat/allocator/include/"

1
.gitignore vendored
View file

@ -71,3 +71,4 @@ parser/split_rust
.tree-sitter-sh/src/parser.c
.tree-sitter-sh/src/tree_sitter/
.tree-sitter-sh/src/node-types.json
.direnv

23
Filelist.sh.mk Normal file
View file

@ -0,0 +1,23 @@
SRC_FILES = \
env \
ft_cmd \
ft_echo \
ft_exit \
ft_pwd \
main \
node/node \
operation/ft_classic_op \
operation/ft_hard_op \
signal_handler \
GEN_FILES = \
src/hashmap/env/env \
src/hashmap/env/env_iter \
src/hashmap/env/env_utils \
src/vec/ast/ast \
src/vec/ast/ast_functions2 \
src/vec/ast/ast_functions3 \
src/vec/str/str \
src/vec/str/str_functions2 \
src/vec/str/str_functions3 \

View file

@ -6,7 +6,7 @@
# By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/11/12 11:05:05 by rparodi #+# #+# #
# Updated: 2024/07/17 17:05:25 by rparodi ### ########.fr #
# Updated: 2024/07/23 21:47:47 by maiboyer ### ########.fr #
# #
# **************************************************************************** #
@ -43,12 +43,12 @@ endif
# All (make all)
all:
@$(MAKE) --no-print-directory header "BUILD_DIR=$(BUILD_DIR)" "BASE_PATH=$(shell pwd)"
@$(MAKE) --no-print-directory -f./Minishell.mk "BUILD_DIR=$(BUILD_DIR)" "BASE_PATH=$(shell pwd)" $(PMAKE)
@$(MAKE) --no-print-directory -f ./Minishell.mk "BUILD_DIR=$(BUILD_DIR)" "BASE_PATH=$(shell pwd)" "" $(PMAKE)
@$(MAKE) --no-print-directory footer "BUILD_DIR=$(BUILD_DIR)" "BASE_PATH=$(shell pwd)"
bonus:
@$(MAKE) --no-print-directory header "BUILD_DIR=$(BUILD_DIR)" "BASE_PATH=$(shell pwd)"
@$(MAKE) --no-print-directory -f./Minishell.mk "BUILD_DIR=$(BUILD_DIR)" "BASE_PATH=$(shell pwd)" $(PMAKE) bonus
@$(MAKE) --no-print-directory -f ./Minishell.mk "BUILD_DIR=$(BUILD_DIR)" "BASE_PATH=$(shell pwd)" $(PMAKE) bonus
@$(MAKE) --no-print-directory footer "BUILD_DIR=$(BUILD_DIR)" "BASE_PATH=$(shell pwd)"
# Header
@ -107,8 +107,16 @@ re: header
tokei:
/bin/sh -c 'tokei -tC,C\ Header -e tree-sitter-sh'
generate_filelist:
@/usr/bin/env zsh -c "tree -iFf --noreport $(SRC_DIR) | rg '^$(SRC_DIR)/(.*\.c)\$$' --replace '\$$1' | sort -u" > ./src.list
@/usr/bin/env zsh -c "tree -iFf --noreport $(GEN_DIR) | rg '^$(GEN_DIR)/(.*\.c)\$$' --replace '\$$1' | sort -u" > ./gen.list
build_filelist:
@$(MAKE) --no-print-directory -C ./stdme/ build_filelist
@$(MAKE) --no-print-directory -C ./allocator/ build_filelist
@$(MAKE) --no-print-directory -C ./ast/ build_filelist
@$(MAKE) --no-print-directory -C ./exec/ build_filelist
@$(MAKE) --no-print-directory -C ./line/ build_filelist
@$(MAKE) --no-print-directory -C ./parser/ -f ./Grammar.mk build_filelist
@$(MAKE) --no-print-directory -C ./parser/ -f ./Parser.mk build_filelist
@$(MAKE) --no-print-directory -f ./Minishell.mk build_filelist
# phony
.PHONY: all bonus clean fclean re header footer generate_filelist
.PHONY: all bonus clean fclean re header footer build_filelist

View file

@ -6,7 +6,7 @@
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/04/28 17:28:30 by maiboyer #+# #+# #
# Updated: 2024/07/11 17:14:34 by maiboyer ### ########.fr #
# Updated: 2024/07/23 21:54:12 by maiboyer ### ########.fr #
# #
# **************************************************************************** #
@ -15,27 +15,24 @@
link_group = -Wl,--start-group $(1) -Wl,--end-group
# Variables
ANAME = sh
BUILD_DIR ?= $(shell realpath ./build/)
# TODO: ADD THIS WHEN FINISHING THIS:
# CFLAGS_ADDITIONAL = -DNVALGRIND
# Flags
CFLAGS = -Werror -Wextra -Wall -Wno-unused-command-line-argument -g3 -MMD -I./includes -I./output/include -I./stdme/output/include -rdynamic -Wl,-E
# CFLAGS += -fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-return=runtime -fno-common -fsanitize-address-use-after-scope
# Sources
# LIB = ./libft/ft_bzero.c \
# ./libft/ft_calloc.c \
# ./libft/ft_memset.c \
# ./libft/ft_split.c \
# ./libft/ft_strcmp.c \
# ./libft/ft_strdup.c \
# ./libft/ft_strlcpy.c \
# ./libft/ft_strjoin.c \
# ./libft/ft_strlen.c
CFLAGS += $(CFLAGS_ADDITIONAL)
SRC_DIR = sources
GEN_DIR = output
SRC = $(addprefix $(SRC_DIR)/,$(shell cat ./src.list)) $(addprefix $(GEN_DIR)/,$(shell cat ./gen.list))
-include Filelist.$(ANAME).mk
SRC = $(addsuffix .c,$(addprefix $(SRC_DIR)/,$(SRC_FILES)) $(addprefix $(GEN_DIR)/,$(GEN_FILES)))
OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES) $(GEN_FILES)))
DEP = $(addsuffix .d,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES) $(GEN_FILES)))
NAME = minishell
# Commands
@ -43,7 +40,6 @@ CC ?= clang
RM = rm -rf
# Objects
OBJ = $(addprefix $(BUILD_DIR)/sh/,$(SRC:.c=.o))
# Colors
GREEN = \033[32m
@ -52,20 +48,20 @@ RED = \033[0;31m
GOLD = \033[38;5;220m
END = \033[0m
.PHONY: all Bonus
.PHONY: all bonus build_filelist re clean fclean
LIBS_NAMES = me gmr aq ast parser line exec
LIBS_FILES = $(addprefix $(BUILD_DIR)/, $(addsuffix .a, $(addprefix lib, $(LIBS_NAMES))))
LIBS_FLAGS = $(addprefix -l, $(LIBS_NAMES))
all:
@$(MAKE) -C ./stdme/ "LIB_NAME=$(shell realpath ./stdme)/" "BUILD_DIR=$(BUILD_DIR)" libme.a
@$(MAKE) -C ./allocator/ "LIB_NAME=$(shell realpath ./allocator)/" "BUILD_DIR=$(BUILD_DIR)" libaq.a
@$(MAKE) -C ./ast/ "LIB_NAME=$(shell realpath ./ast)/" "BUILD_DIR=$(BUILD_DIR)" libast.a
@$(MAKE) -C ./exec/ "LIB_NAME=$(shell realpath ./exec)/" "BUILD_DIR=$(BUILD_DIR)" libexec.a
@$(MAKE) -C ./line/ "LIB_NAME=$(shell realpath ./line)/" "BUILD_DIR=$(BUILD_DIR)" libline.a
@$(MAKE) -C ./parser/ -f./Grammar.mk "LIB_NAME=$(shell realpath ./parser)/" "BUILD_DIR=$(BUILD_DIR)" libgmr.a
@$(MAKE) -C ./parser/ -f./Parser.mk "LIB_NAME=$(shell realpath ./parser)/" "BUILD_DIR=$(BUILD_DIR)" libparser.a
@$(MAKE) -C ./stdme/ "LIB_NAME=$(shell realpath ./stdme)/" "BUILD_DIR=$(BUILD_DIR)" "CFLAGS_ADDITIONAL=$(CFLAGS_ADDITIONAL)" libme.a
@$(MAKE) -C ./allocator/ "LIB_NAME=$(shell realpath ./allocator)/" "BUILD_DIR=$(BUILD_DIR)" "CFLAGS_ADDITIONAL=$(CFLAGS_ADDITIONAL)" libaq.a
@$(MAKE) -C ./ast/ "LIB_NAME=$(shell realpath ./ast)/" "BUILD_DIR=$(BUILD_DIR)" "CFLAGS_ADDITIONAL=$(CFLAGS_ADDITIONAL)" libast.a
@$(MAKE) -C ./exec/ "LIB_NAME=$(shell realpath ./exec)/" "BUILD_DIR=$(BUILD_DIR)" "CFLAGS_ADDITIONAL=$(CFLAGS_ADDITIONAL)" libexec.a
@$(MAKE) -C ./line/ "LIB_NAME=$(shell realpath ./line)/" "BUILD_DIR=$(BUILD_DIR)" "CFLAGS_ADDITIONAL=$(CFLAGS_ADDITIONAL)" libline.a
@$(MAKE) -C ./parser/ -f ./Grammar.mk "LIB_NAME=$(shell realpath ./parser)/" "BUILD_DIR=$(BUILD_DIR)" "CFLAGS_ADDITIONAL=$(CFLAGS_ADDITIONAL)" libgmr.a
@$(MAKE) -C ./parser/ -f ./Parser.mk "LIB_NAME=$(shell realpath ./parser)/" "BUILD_DIR=$(BUILD_DIR)" "CFLAGS_ADDITIONAL=$(CFLAGS_ADDITIONAL)" libparser.a
@$(MAKE) -f./Minishell.mk $(NAME)
@ -83,9 +79,24 @@ $(NAME): $(OBJ) $(LIBS_FILES)
@$(CC) $(CFLAGS) -o $(NAME) $(OBJ) -L$(BUILD_DIR) $(call link_group,$(LIBS_FLAGS))
# Creating the objects
$(BUILD_DIR)/sh/%.o: %.c
$(BUILD_DIR)/$(ANAME)/%.o: $(SRC_DIR)/%.c
@mkdir -p $(dir $@)
@echo -e '$(GREY) Building\t$(END)$(GREEN)$<$(END)'
@$(CC) $(CFLAGS) -o $@ -c $<
-include ${OBJ:.o=.d}
$(BUILD_DIR)/$(ANAME)/%.o: $(GEN_DIR)/%.c
@mkdir -p $(dir $@)
@echo -e '$(GREY) Building\t$(END)$(GREEN)$<$(END)'
@$(CC) $(CFLAGS) -o $@ -c $<
build_filelist:
@rm -f Filelist.$(ANAME).mk
@printf '%-78s\\\n' "SRC_FILES =" > Filelist.$(ANAME).mk
@tree $(SRC_DIR) -ifF | rg '$(SRC_DIR)/(.*)\.c$$' --replace '$$1' | sed -re 's/^(.*)_([0-9]+)$$/\1|\2/g' | sort -t'|' --key=1,1 --key=2,2n | sed -e's/|/_/' | xargs printf '%-78s\\\n' >> Filelist.$(ANAME).mk
@echo "" >> Filelist.$(ANAME).mk
@printf '%-78s\\\n' "GEN_FILES =" >> Filelist.$(ANAME).mk
@tree $(GEN_DIR) -ifF | rg '$(GEN_DIR)/(.*)\.c$$' --replace '$$1' | sed -re 's/^(.*)_([0-9]+)$$/\1|\2/g' | sort -t'|' --key=1,1 --key=2,2n | sed -e's/|/_/' | xargs printf '%-78s\\\n' >> Filelist.$(ANAME).mk
@echo "" >> Filelist.$(ANAME).mk
@echo -e "$(GREY) Populating $(GREEN) Filelist.$(ANAME).mk$(END)"
-include $(DEP)

19
allocator/Filelist.aq.mk Normal file
View file

@ -0,0 +1,19 @@
SRC_FILES = \
lc_alloc/functions1 \
lc_alloc/functions2 \
me_alloc/find_block \
me_alloc/functions1 \
me_alloc/functions2 \
me_alloc/internals \
me_alloc/merge_blocks \
me_alloc/pages \
me_alloc/realloc \
vg/dummy_block \
vg/dummy_mempool \
vg/dummy_mempool_bis \
vg/dummy_mem_status \
vg/valgrind_block \
vg/valgrind_mempool \
vg/valgrind_mempool_bis \
vg/valgrind_mem_status \

View file

@ -6,36 +6,34 @@
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/11/03 13:20:01 by maiboyer #+# #+# #
# Updated: 2024/07/11 18:33:48 by maiboyer ### ########.fr #
# Updated: 2024/07/23 21:52:17 by maiboyer ### ########.fr #
# #
# **************************************************************************** #
ANAME = aq
BUILD_DIR ?= ../build
SRC_DIR = src
INCLUDE_DIR = include output/include ../stdme/include
LIBS_DIR = .
GENERIC_DIR = output/src
GENERIC_INCLUDE = output/include
BASE_PATH ?= $(shell pwd)
NAME = libaq.a
NAME = lib$(ANAME).a
LIB_NAME ?=
TARGET = $(BUILD_DIR)/$(NAME)
CC ?= clang
CFLAGS = -Wno-unused-command-line-argument -Wall -Werror -Wextra -g3 -L$(BUILD_DIR) -MMD -rdynamic -DBASE_PATH='"$(BASE_PATH)/"'
# CFLAGS += -fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-return=runtime -fno-common -fsanitize-address-use-after-scope
CFLAGS += $(CFLAGS_ADD)
CFLAGS += $(CFLAGS_ADDITIONAL)
BONUS_FILES =
LIBS_NAME =
SUBJECT_URL =
SRC_FILES = $(shell cat src.list)
-include Filelist.$(ANAME).mk
SRC = $(addsuffix .c,$(addprefix $(SRC_DIR)/,$(SRC_FILES)))
OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/aq/,$(SRC_FILES)))
DEPS = $(addsuffix .d,$(addprefix $(BUILD_DIR)/aq/,$(SRC_FILES)))
OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES)))
DEPS = $(addsuffix .d,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES)))
LIBS = $(addprefix $(LIBS_DIR)/,$(LIBS_NAME))
INCLUDES = $(addprefix -I,$(foreach P,$(INCLUDE_DIR) $(LIBS) $(addsuffix /include,$(LIBS)) vendor $(addsuffix /vendor,$(LIBS)),$(realpath $(P))))
@ -46,10 +44,6 @@ COL_GREEN = \033[32m
COL_RESET = \033[0m
COL_WHITE = \033[37m
# TODO: REMOVE FOR RENDU !!!!!
CFLAGS += -DPRINT_BACKTRACE
.PHONY = all bonus clean re subject
all: $(NAME)
@ -60,15 +54,10 @@ $(TARGET): $(OBJ)
@echo -e '$(COL_GRAY) Linking \t$(COL_GOLD)$(TARGET)$(COL_RESET)'
@ar rcs $(BUILD_DIR)/$(NAME) $(OBJ)
$(BUILD_DIR)/aq/%.o: $(SRC_DIR)/%.c
$(BUILD_DIR)/$(ANAME)/%.o: $(SRC_DIR)/%.c
@mkdir -p $(dir $@)
@echo -e '$(COL_GRAY) Building\t$(COL_GREEN)$<$(COL_RESET)'
@$(CC) $(CFLAGS) $(WERROR) $(INCLUDES) -c $< -o $@
$(BUILD_DIR)/aq/%.o: $(GENERIC_DIR)/%.c
@mkdir -p $(dir $@)
@echo -e '$(COL_GRAY) Building\t$(COL_GREEN)$<$(COL_RESET)'
@$(CC) $(CFLAGS) $(WERROR) $(INCLUDES) -c $< -o $@
@$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
clean:
@- $(foreach LIB,$(LIBS), \
@ -91,8 +80,11 @@ subject: subject.txt
subject.txt:
@curl $(SUBJECT_URL) | pdftotext -layout -nopgbrk -q - subject.txt
generate_filelist::
@/usr/bin/env zsh -c "tree -iFf --noreport output | rg '^output/src/(.*)\.c\$$' --replace '\$$1' | sort -u" > ./gen.list
@/usr/bin/env zsh -c "tree -iFf --noreport src | rg '^src/(.*)\.c\$$' --replace '\$$1' | sort -u" > ./src.list
build_filelist:
@rm -f Filelist.$(ANAME).mk
@printf '%-78s\\\n' "SRC_FILES =" > Filelist.$(ANAME).mk
@tree $(SRC_DIR) -ifF | rg '$(SRC_DIR)/(.*)\.c$$' --replace '$$1' | sed -re 's/^(.*)_([0-9]+)$$/\1|\2/g' | sort -t'|' --key=1,1 --key=2,2n | sed -e's/|/_/' | xargs printf '%-78s\\\n' >> Filelist.$(ANAME).mk
@echo "" >> Filelist.$(ANAME).mk
@echo -e "$(COL_GRAY) Populating $(COL_GREEN) Filelist.$(ANAME).mk$(END)"
-include $(DEPS)

View file

View file

@ -1,17 +0,0 @@
lc_alloc/functions1
lc_alloc/functions2
me_alloc/find_block
me_alloc/functions1
me_alloc/functions2
me_alloc/internals
me_alloc/merge_blocks
me_alloc/pages
me_alloc/realloc
vg/dummy_block
vg/dummy_mem_status
vg/dummy_mempool
vg/dummy_mempool_bis
vg/valgrind_block
vg/valgrind_mem_status
vg/valgrind_mempool
vg/valgrind_mempool_bis

5
ast/Filelist.ast.mk Normal file
View file

@ -0,0 +1,5 @@
SRC_FILES = \
from_node \
not_done_function \
print_ast \

View file

@ -6,10 +6,12 @@
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/11/03 13:20:01 by maiboyer #+# #+# #
# Updated: 2024/07/14 10:18:27 by maiboyer ### ########.fr #
# Updated: 2024/07/23 21:52:27 by maiboyer ### ########.fr #
# #
# **************************************************************************** #
ANAME = ast
BUILD_DIR ?= ../build
SRC_DIR = src
INCLUDE_DIR = include output/include ../includes ../output/include/ ../stdme/output/include/
@ -19,22 +21,19 @@ GENERIC_INCLUDE = output/include
BASE_PATH ?= $(shell pwd)
NAME = libast.a
NAME = lib$(ANAME).a
LIB_NAME ?=
TARGET = $(BUILD_DIR)/$(NAME)
CC ?= clang
CFLAGS = -Wno-unused-command-line-argument -Wall -Werror -Wextra -g3 -L$(BUILD_DIR) -MMD -rdynamic -DBASE_PATH='"$(BASE_PATH)/"'
# CFLAGS += -fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-return=runtime -fno-common -fsanitize-address-use-after-scope
CFLAGS += -O2
BONUS_FILES =
LIBS_NAME =
SUBJECT_URL =
CFLAGS += $(CFLAGS_ADDITIONAL)
SRC_FILES = $(shell cat src.list)
-include Filelist.$(ANAME).mk
SRC = $(addsuffix .c,$(addprefix $(SRC_DIR)/,$(SRC_FILES)))
OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/ast/,$(SRC_FILES)))
DEPS = $(addsuffix .d,$(addprefix $(BUILD_DIR)/ast/,$(SRC_FILES)))
OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES)))
DEPS = $(addsuffix .d,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES)))
LIBS = $(addprefix $(LIBS_DIR)/,$(LIBS_NAME))
INCLUDES = $(addprefix -I,$(foreach P,$(INCLUDE_DIR) $(LIBS) $(addsuffix /include,$(LIBS)) vendor $(addsuffix /vendor,$(LIBS)),$(realpath $(P))))
@ -45,10 +44,6 @@ COL_GREEN = \033[32m
COL_BOLD = \033[1m
COL_RESET = \033[0m
# TODO: REMOVE FOR RENDU !!!!!
CFLAGS += -DPRINT_BACKTRACE
.PHONY = all bonus clean re subject
all: $(NAME)
@ -59,15 +54,10 @@ $(TARGET): $(OBJ)
@echo -e '$(COL_GRAY) Linking \t$(COL_GOLD)$(TARGET)$(COL_RESET)'
@ar rcs $(BUILD_DIR)/$(NAME) $(OBJ)
$(BUILD_DIR)/ast/%.o: $(SRC_DIR)/%.c
$(BUILD_DIR)/$(ANAME)/%.o: $(SRC_DIR)/%.c
@mkdir -p $(dir $@)
@echo -e '$(COL_GRAY) Building\t$(COL_GREEN)$<$(COL_RESET)'
@$(CC) $(CFLAGS) $(WERROR) $(INCLUDES) -c $< -o $@
$(BUILD_DIR)/ast/%.o: $(GENERIC_DIR)/%.c
@mkdir -p $(dir $@)
@echo -e '$(COL_GRAY) Building\t$(COL_GREEN)$<$(COL_RESET)'
@$(CC) $(CFLAGS) $(WERROR) $(INCLUDES) -c $< -o $@
@$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
clean:
@- $(foreach LIB,$(LIBS), \
@ -90,8 +80,11 @@ subject: subject.txt
subject.txt:
@curl $(SUBJECT_URL) | pdftotext -layout -nopgbrk -q - subject.txt
generate_filelist::
@/usr/bin/env zsh -c "tree -iFf --noreport output | rg '^output/src/(.*)\.c\$$' --replace '\$$1' | sort -u" > ./gen.list
@/usr/bin/env zsh -c "tree -iFf --noreport src | rg '^src/(.*)\.c\$$' --replace '\$$1' | sort -u" > ./src.list
build_filelist:
@rm -f Filelist.$(ANAME).mk
@printf '%-78s\\\n' "SRC_FILES =" > Filelist.$(ANAME).mk
@tree src -ifF | rg 'src/(.*)\.c$$' --replace '$$1' | sed -re 's/^(.*)_([0-9]+)$$/\1|\2/g' | sort -t'|' --key=1,1 --key=2,2n | sed -e's/|/_/' | xargs printf '%-78s\\\n' >> Filelist.$(ANAME).mk
@echo "" >> Filelist.$(ANAME).mk
@echo -e "$(COL_GRAY) Populating $(COL_GREEN) Filelist.$(ANAME).mk$(END)"
-include $(DEPS)

View file

View file

@ -1,3 +0,0 @@
from_node
not_done_function
print_ast

3
exec/Filelist.exec.mk Normal file
View file

@ -0,0 +1,3 @@
SRC_FILES = \
run_ast \

View file

@ -6,34 +6,30 @@
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/11/03 13:20:01 by maiboyer #+# #+# #
# Updated: 2024/07/14 10:18:49 by maiboyer ### ########.fr #
# Updated: 2024/07/23 21:52:40 by maiboyer ### ########.fr #
# #
# **************************************************************************** #
ANAME = exec
BUILD_DIR ?= ../build
SRC_DIR = src
INCLUDE_DIR = include/ output/include/ ../includes/ ../output/include/ ../stdme/output/include/
LIBS_DIR = .
GENERIC_DIR = output/src
GENERIC_INCLUDE = output/include
BASE_PATH ?= $(shell pwd)
NAME = libexec.a
NAME = lib$(ANAME).a
LIB_NAME ?=
TARGET = $(BUILD_DIR)/$(NAME)
CC ?= clang
CFLAGS = -Wno-unused-command-line-argument -Wall -Werror -Wextra -g3 -L$(BUILD_DIR) -MMD -rdynamic -DBASE_PATH='"$(BASE_PATH)/"'
# CFLAGS += -fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-return=runtime -fno-common -fsanitize-address-use-after-scope
BONUS_FILES =
LIBS_NAME =
SUBJECT_URL =
CFLAGS = $(CFLAGS_ADDITIONAL)
SRC_FILES = $(shell cat src.list)
-include Filelist.$(ANAME).mk
SRC = $(addsuffix .c,$(addprefix $(SRC_DIR)/,$(SRC_FILES)))
OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/exec/,$(SRC_FILES)))
DEPS = $(addsuffix .d,$(addprefix $(BUILD_DIR)/exec/,$(SRC_FILES)))
OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES)))
DEPS = $(addsuffix .d,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES)))
LIBS = $(addprefix $(LIBS_DIR)/,$(LIBS_NAME))
INCLUDES = $(addprefix -I,$(foreach P,$(INCLUDE_DIR) $(LIBS) $(addsuffix /include,$(LIBS)) vendor $(addsuffix /vendor,$(LIBS)),$(realpath $(P))))
@ -44,8 +40,6 @@ COL_GREEN = \033[32m
COL_RESET = \033[0m
COL_WHITE = \033[37m
# TODO: REMOVE FOR RENDU !!!!!
CFLAGS += -DPRINT_BACKTRACE
.PHONY = all bonus clean re subject
@ -58,12 +52,7 @@ $(TARGET): $(OBJ)
@echo -e '$(COL_GRAY) Linking \t$(COL_GOLD)$(TARGET)$(COL_RESET)'
@ar rcs $(BUILD_DIR)/$(NAME) $(OBJ)
$(BUILD_DIR)/exec/%.o: $(SRC_DIR)/%.c
@mkdir -p $(dir $@)
@echo -e '$(COL_GRAY) Building\t$(COL_GREEN)$<$(COL_RESET)'
@$(CC) $(CFLAGS) $(WERROR) $(INCLUDES) -c $< -o $@
$(BUILD_DIR)/exec/%.o: $(GENERIC_DIR)/%.c
$(BUILD_DIR)/$(ANAME)/%.o: $(SRC_DIR)/%.c
@mkdir -p $(dir $@)
@echo -e '$(COL_GRAY) Building\t$(COL_GREEN)$<$(COL_RESET)'
@$(CC) $(CFLAGS) $(WERROR) $(INCLUDES) -c $< -o $@
@ -89,8 +78,11 @@ subject: subject.txt
subject.txt:
@curl $(SUBJECT_URL) | pdftotext -layout -nopgbrk -q - subject.txt
generate_filelist::
@/usr/bin/env zsh -c "tree -iFf --noreport output | rg '^output/src/(.*)\.c\$$' --replace '\$$1' | sort -u" > ./gen.list
@/usr/bin/env zsh -c "tree -iFf --noreport src | rg '^src/(.*)\.c\$$' --replace '\$$1' | sort -u" > ./src.list
build_filelist:
@rm -f Filelist.$(ANAME).mk
@printf '%-78s\\\n' "SRC_FILES =" > Filelist.$(ANAME).mk
@tree src -ifF | rg 'src/(.*)\.c$$' --replace '$$1' | sed -re 's/^(.*)_([0-9]+)$$/\1|\2/g' | sort -t'|' --key=1,1 --key=2,2n | sed -e's/|/_/' | xargs printf '%-78s\\\n' >> Filelist.$(ANAME).mk
@echo "" >> Filelist.$(ANAME).mk
@echo -e "$(COL_GRAY) Populating $(COL_GREEN) Filelist.$(ANAME).mk$(END)"
-include $(DEPS)

View file

View file

@ -1 +0,0 @@
run_ast

View file

@ -1,9 +0,0 @@
src/hashmap/env/env.c
src/hashmap/env/env_iter.c
src/hashmap/env/env_utils.c
src/vec/ast/ast.c
src/vec/ast/ast_functions2.c
src/vec/ast/ast_functions3.c
src/vec/str/str.c
src/vec/str/str_functions2.c
src/vec/str/str_functions3.c

12
line/Filelist.line.mk Normal file
View file

@ -0,0 +1,12 @@
SRC_FILES = \
line \
line_edit_actions \
line_edit_actions2 \
line_editing \
line_editing2 \
line_edit_mode \
line_globals \
line_history \
line_internals \
line_no_tty \

View file

@ -6,35 +6,30 @@
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/11/03 13:20:01 by maiboyer #+# #+# #
# Updated: 2024/07/05 17:57:25 by maiboyer ### ########.fr #
# Updated: 2024/07/23 21:53:05 by maiboyer ### ########.fr #
# #
# **************************************************************************** #
ANAME = line
BUILD_DIR ?= ../build
SRC_DIR = src
INCLUDE_DIR = include output/include ../includes ../output/include/
LIBS_DIR = .
GENERIC_DIR = output/src
GENERIC_INCLUDE = output/include
BASE_PATH ?= $(shell pwd)
NAME = libline.a
NAME = lib$(ANAME).a
LIB_NAME ?=
TARGET = $(BUILD_DIR)/$(NAME)
CC ?= clang
CFLAGS = -Wno-unused-command-line-argument -Wall -Werror -Wextra -g3 -L$(BUILD_DIR) -MMD -rdynamic -DBASE_PATH='"$(BASE_PATH)/"'
# CFLAGS += -fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-return=runtime -fno-common -fsanitize-address-use-after-scope
CFLAGS += -O2
BONUS_FILES =
LIBS_NAME =
SUBJECT_URL =
CFLAGS = $(CFLAGS_ADDITIONAL)
SRC_FILES = $(shell cat src.list)
-include Filelist.$(ANAME).mk
SRC = $(addsuffix .c,$(addprefix $(SRC_DIR)/,$(SRC_FILES)))
OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/line/,$(SRC_FILES)))
DEPS = $(addsuffix .d,$(addprefix $(BUILD_DIR)/line/,$(SRC_FILES)))
OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES)))
DEPS = $(addsuffix .d,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES)))
LIBS = $(addprefix $(LIBS_DIR)/,$(LIBS_NAME))
INCLUDES = $(addprefix -I,$(foreach P,$(INCLUDE_DIR) $(LIBS) $(addsuffix /include,$(LIBS)) vendor $(addsuffix /vendor,$(LIBS)),$(realpath $(P))))
@ -45,10 +40,6 @@ COL_GREEN = \033[32m
COL_BOLD = \033[1m
COL_RESET = \033[0m
# TODO: REMOVE FOR RENDU !!!!!
CFLAGS += -DPRINT_BACKTRACE
.PHONY = all bonus clean re subject
all: $(NAME)
@ -59,15 +50,10 @@ $(TARGET): $(OBJ)
@echo -e '$(COL_GRAY) Linking \t$(COL_GOLD)$(TARGET)$(COL_RESET)'
@ar rcs $(BUILD_DIR)/$(NAME) $(OBJ)
$(BUILD_DIR)/line/%.o: $(SRC_DIR)/%.c
$(BUILD_DIR)/$(ANAME)/%.o: $(SRC_DIR)/%.c
@mkdir -p $(dir $@)
@echo -e '$(COL_GRAY) Building\t$(COL_GREEN)$<$(COL_RESET)'
@$(CC) $(CFLAGS) $(WERROR) $(INCLUDES) -c $< -o $@
$(BUILD_DIR)/line/%.o: $(GENERIC_DIR)/%.c
@mkdir -p $(dir $@)
@echo -e '$(COL_GRAY) Building\t$(COL_GREEN)$<$(COL_RESET)'
@$(CC) $(CFLAGS) $(WERROR) $(INCLUDES) -c $< -o $@
@$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
clean:
@- $(foreach LIB,$(LIBS), \
@ -90,8 +76,11 @@ subject: subject.txt
subject.txt:
@curl $(SUBJECT_URL) | pdftotext -layout -nopgbrk -q - subject.txt
generate_filelist::
@/usr/bin/env zsh -c "tree -iFf --noreport output | rg '^output/src/(.*)\.c\$$' --replace '\$$1' | sort -u" > ./gen.list
@/usr/bin/env zsh -c "tree -iFf --noreport src | rg '^src/(.*)\.c\$$' --replace '\$$1' | sort -u" > ./src.list
build_filelist:
@rm -f Filelist.$(ANAME).mk
@printf '%-78s\\\n' "SRC_FILES =" > Filelist.$(ANAME).mk
@tree src -ifF | rg 'src/(.*)\.c$$' --replace '$$1' | sed -re 's/^(.*)_([0-9]+)$$/\1|\2/g' | sort -t'|' --key=1,1 --key=2,2n | sed -e's/|/_/' | xargs printf '%-78s\\\n' >> Filelist.$(ANAME).mk
@echo "" >> Filelist.$(ANAME).mk
@echo -e "$(COL_GRAY) Populating $(COL_GREEN) Filelist.$(ANAME).mk$(END)"
-include $(DEPS)

View file

View file

@ -1,10 +0,0 @@
line
line_edit_actions
line_edit_actions2
line_edit_mode
line_editing
line_editing2
line_globals
line_history
line_internals
line_no_tty

View file

@ -114,6 +114,28 @@ primary_state_ids/primary_state_ids_18 \
primary_state_ids/primary_state_ids_19 \
primary_state_ids/primary_state_ids_20 \
primary_state_ids/primary_state_ids_21 \
small_parse_table_map/small_parse_table_map_0 \
small_parse_table_map/small_parse_table_map_1 \
small_parse_table_map/small_parse_table_map_2 \
small_parse_table_map/small_parse_table_map_3 \
small_parse_table_map/small_parse_table_map_4 \
small_parse_table_map/small_parse_table_map_5 \
small_parse_table_map/small_parse_table_map_6 \
small_parse_table_map/small_parse_table_map_7 \
small_parse_table_map/small_parse_table_map_8 \
small_parse_table_map/small_parse_table_map_9 \
small_parse_table_map/small_parse_table_map_10 \
small_parse_table_map/small_parse_table_map_11 \
small_parse_table_map/small_parse_table_map_12 \
small_parse_table_map/small_parse_table_map_13 \
small_parse_table_map/small_parse_table_map_14 \
small_parse_table_map/small_parse_table_map_15 \
small_parse_table_map/small_parse_table_map_16 \
small_parse_table_map/small_parse_table_map_17 \
small_parse_table_map/small_parse_table_map_18 \
small_parse_table_map/small_parse_table_map_19 \
small_parse_table_map/small_parse_table_map_20 \
small_parse_table_map/small_parse_table_map_21 \
small_parse_table/small_parse_table_0 \
small_parse_table/small_parse_table_1 \
small_parse_table/small_parse_table_2 \
@ -946,28 +968,6 @@ small_parse_table/small_parse_table_828 \
small_parse_table/small_parse_table_829 \
small_parse_table/small_parse_table_830 \
small_parse_table/small_parse_table_831 \
small_parse_table_map/small_parse_table_map_0 \
small_parse_table_map/small_parse_table_map_1 \
small_parse_table_map/small_parse_table_map_2 \
small_parse_table_map/small_parse_table_map_3 \
small_parse_table_map/small_parse_table_map_4 \
small_parse_table_map/small_parse_table_map_5 \
small_parse_table_map/small_parse_table_map_6 \
small_parse_table_map/small_parse_table_map_7 \
small_parse_table_map/small_parse_table_map_8 \
small_parse_table_map/small_parse_table_map_9 \
small_parse_table_map/small_parse_table_map_10 \
small_parse_table_map/small_parse_table_map_11 \
small_parse_table_map/small_parse_table_map_12 \
small_parse_table_map/small_parse_table_map_13 \
small_parse_table_map/small_parse_table_map_14 \
small_parse_table_map/small_parse_table_map_15 \
small_parse_table_map/small_parse_table_map_16 \
small_parse_table_map/small_parse_table_map_17 \
small_parse_table_map/small_parse_table_map_18 \
small_parse_table_map/small_parse_table_map_19 \
small_parse_table_map/small_parse_table_map_20 \
small_parse_table_map/small_parse_table_map_21 \
symbols_metadata/symbols_metadata_0 \
symbols_metadata/symbols_metadata_1 \
symbols_names/symbols_names_0 \

20
parser/Filelist.parser.mk Normal file
View file

@ -0,0 +1,20 @@
SRC_FILES = \
create_language \
input \
language \
length \
lex \
lexer \
lib \
node \
parser \
point \
reduce_action \
scanner \
stack \
subtree \
tree \
GEN_FILES = \
\

View file

@ -6,7 +6,7 @@
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/11/03 13:20:01 by maiboyer #+# #+# #
# Updated: 2024/06/30 18:45:33 by maiboyer ### ########.fr #
# Updated: 2024/07/23 21:53:40 by maiboyer ### ########.fr #
# #
# **************************************************************************** #
@ -23,13 +23,10 @@ LIB_NAME ?=
TARGET = $(BUILD_DIR)/$(NAME)
CC ?= cc
CFLAGS = -Wall -Wextra -Werror -MMD -I./includes -I../includes -I../output/include -I../tree-sitter-sh/src
CFLAGS += $(CFLAGS_ADDITIONAL)
#CFLAGS += -fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-return=runtime -fno-common -fsanitize-address-use-after-scope
include ./Filelist.mk
#SRC_FILES = parser
#scanner
#parser
-include Filelist.$(ANAME).mk
SRC = $(addsuffix .c,$(addprefix $(SRC_DIR)/,$(SRC_FILES)))
OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES)))
@ -76,4 +73,11 @@ re:
@$(MAKE) --no-print-directory fclean
@$(MAKE) --no-print-directory all
build_filelist:
@rm -f Filelist.$(ANAME).mk
@printf '%-78s\\\n' "SRC_FILES =" > Filelist.$(ANAME).mk
@tree static -ifF | rg 'static/(.*)\.c$$' --replace '$$1' | sed -re 's/^(.*)_([0-9]+)$$/\1|\2/g' | sort -t'|' --key=1,1 --key=2,2n | sed -e's/|/_/' | xargs printf '%-78s\\\n' >> Filelist.$(ANAME).mk
@echo "" >> Filelist.$(ANAME).mk
@echo -e "$(GREY) Populating $(GREEN) Filelist.$(ANAME).mk$(END)"
-include $(DEPS)

View file

@ -6,7 +6,7 @@
# By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/11/12 11:05:05 by rparodi #+# #+# #
# Updated: 2024/06/09 19:14:28 by maiboyer ### ########.fr #
# Updated: 2024/07/23 20:58:57 by maiboyer ### ########.fr #
# #
# **************************************************************************** #
@ -23,9 +23,8 @@ libgmr.a:
@$(MAKE) --no-print-directory -f Grammar.mk "LIB_NAME=$(shell realpath .)/" "BUILD_DIR=$(shell realpath $(BUILD_DIR))" libgmr.a
build_filelist:
@rm Filelist.mk
@printf '%-78s\\\n' "SRC_FILES =" > Filelist.mk
@tree static -ifF | rg 'static/(.*)\.c$$' --replace '$$1' | sed -re 's/^(.*)_([0-9]+)$$/\1|\2/g' | sort -t'|' --key=1,1 --key=2,2n | sed -e's/|/_/' | xargs printf '%-78s\\\n' >> Filelist.mk
@echo "" >> Filelist.mk
@$(MAKE) --no-print-directory -f Parser.mk build_filelist
@$(MAKE) --no-print-directory -f Grammar.mk build_filelist
.PHONY: all bonus clean fclean re libparser.a libgmr.a build_filelist

View file

@ -6,7 +6,7 @@
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/11/03 13:20:01 by maiboyer #+# #+# #
# Updated: 2024/06/30 16:23:47 by maiboyer ### ########.fr #
# Updated: 2024/07/23 21:53:53 by maiboyer ### ########.fr #
# #
# **************************************************************************** #
@ -22,12 +22,16 @@ LIB_NAME ?=
TARGET = $(BUILD_DIR)/$(NAME)
CC ?= cc
CFLAGS = -Wall -Wextra -Werror -MMD -I./includes -I../includes -I../output/include -g3 -I$(SRC_DIR)
CFLAGS += $(CFLAGS_ADDITIONAL)
#CFLAGS += -fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-return=runtime -fno-common -fsanitize-address-use-after-scope
SRC_FILES = lib
GEN_FILES =
SRC = $(addsuffix .c,$(addprefix $(SRC_DIR)/,$(SRC_FILES))) $(addsuffix .c,$(addprefix $(GEN_DIR)/,$(GEN_FILES)))
# TODO: change from only lib.c to filelist
#-include Filelist.$(ANAME).mk
SRC = $(addsuffix .c,$(addprefix $(SRC_DIR)/,$(SRC_FILES)) $(addprefix $(GEN_DIR)/,$(GEN_FILES)))
OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES))) $(addsuffix .o,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(GEN_FILES)))
DEPS = $(addsuffix .d,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES))) $(addsuffix .d,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(GEN_FILES)))
@ -54,6 +58,11 @@ $(BUILD_DIR)/$(ANAME)/%.o: $(SRC_DIR)/%.c
@echo -e '$(GREY) Building\t$(END)$(GREEN)$<$(END)'
@$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
$(BUILD_DIR)/$(ANAME)/%.o: $(GEN_DIR)/%.c
@mkdir -p $(dir $@)
@echo -e '$(GREY) Building\t$(END)$(GREEN)$<$(END)'
@$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
clean:
@- $(foreach LIB,$(LIBS), \
make clean LIB_NAME=$(LIB)/ BUILD_DIR=$(realpath $(BUILD_DIR)) -C $(LIB) --no-print-directory || true;\
@ -72,4 +81,14 @@ re:
@$(MAKE) --no-print-directory fclean
@$(MAKE) --no-print-directory all
build_filelist:
@rm -f Filelist.$(ANAME).mk
@printf '%-78s\\\n' "SRC_FILES =" > Filelist.$(ANAME).mk
@tree $(SRC_DIR) -ifF | rg '$(SRC_DIR)/(.*)\.c$$' --replace '$$1' | sed -re 's/^(.*)_([0-9]+)$$/\1|\2/g' | sort -t'|' --key=1,1 --key=2,2n | sed -e's/|/_/' | xargs printf '%-78s\\\n' >> Filelist.$(ANAME).mk
@echo "" >> Filelist.$(ANAME).mk
@printf '%-78s\\\n' "GEN_FILES =" >> Filelist.$(ANAME).mk
@tree $(GEN_DIR) -ifF | rg '$(GEN_DIR)/(.*)\.c$$' --replace '$$1' | sed -re 's/^(.*)_([0-9]+)$$/\1|\2/g' | sort -t'|' --key=1,1 --key=2,2n | sed -e's/|/_/' | xargs printf '%-78s\\\n' >> Filelist.$(ANAME).mk
@echo "" >> Filelist.$(ANAME).mk
@echo -e "$(GREY) Populating $(GREEN) Filelist.$(ANAME).mk$(END)"
-include $(DEPS)

View file

@ -1,10 +0,0 @@
env.c
ft_cmd.c
ft_echo.c
ft_exit.c
ft_pwd.c
main.c
node/node.c
operation/ft_classic_op.c
operation/ft_hard_op.c
signal_handler.c

147
stdme/Filelist.me.mk Normal file
View file

@ -0,0 +1,147 @@
SRC_FILES = \
blx/blx \
blx/blx_create_fontsheet \
blx/blx_handlers \
blx/blx_keycode \
blx/colors \
blx/draw/draw \
blx/draw/draw_sprite \
blx/draw/draw_string \
blx/inputs \
blx/logic \
blx/sprite/draw_image \
blx/sprite/draw_pixel_onto \
blx/sprite/draw_string \
blx/sprite/free_image \
blx/sprite/get_pixel \
blx/sprite/new_image \
blx/sprite/sprite_draw_onto_sprite \
char/isalnum \
char/isalpha \
char/isascii \
char/isdigit \
char/islower \
char/isprint \
char/isspace \
char/isupper \
char/tolower \
char/toupper \
convert/numbers_to_str \
fs/close \
fs/fs_internal \
fs/open \
fs/putchar_fd \
fs/putendl_fd \
fs/putnbr_fd \
fs/putstr_fd \
fs/read \
fs/read_to_vec \
fs/write \
gnl/get_next_line \
hash/hasher \
hash/hash_signed \
hash/hash_str \
hash/hash_unsigned \
hash/sip/sip13 \
hash/sip/sip_utils \
hash/sip/sip_utils2 \
img/qoi/qoi_decode \
img/qoi/qoi_encode \
img/qoi/qoi_fs \
img/qoi/qoi_utils \
mem/allocator \
mem/mem_alloc \
mem/mem_alloc_array \
mem/mem_compare \
mem/mem_copy \
mem/mem_find \
mem/mem_find_bytes \
mem/mem_move \
mem/mem_realloc \
mem/mem_set \
mem/mem_set_zero \
num/u16/rotate \
num/u32/rotate \
num/u64/from_bytes \
num/u64/rotate \
num/u8/rotate \
num/usize/rotate \
num/usize/round_up \
os/abort \
os/exit \
os/pipe \
os/process \
os/process_inner \
os/process_inner2 \
printf/callbacks \
printf/formatter/char \
printf/formatter/decimal \
printf/formatter/hex \
printf/formatter/oct \
printf/formatter/ptr \
printf/formatter/unsigned_decimal \
printf/formatter/utils \
printf/formatter/utils2 \
printf/formatter/utils3 \
printf/formatter/utils_numbers \
printf/matchers \
printf/printf \
printf/printf_fd \
printf/printf_str \
printf/vprintf \
string/mod \
string/string_insert \
string/string_remove \
string/string_reserve \
str/str_clone \
str/str_compare \
str/str_find_chr \
str/str_find_rev_chr \
str/str_find_str \
str/str_iter \
str/str_join \
str/str_l_cat \
str/str_l_copy \
str/str_len \
str/str_map \
str/str_n_compare \
str/str_n_find_str \
str/str_split \
str/str_substring \
str/str_trim \
GEN_FILES = \
convert/i16_to_str \
convert/i32_to_str \
convert/i64_to_str \
convert/i8_to_str \
convert/str_to_i16 \
convert/str_to_i16_utils \
convert/str_to_i32 \
convert/str_to_i32_utils \
convert/str_to_i64 \
convert/str_to_i64_utils \
convert/str_to_i8 \
convert/str_to_i8_utils \
convert/str_to_u16 \
convert/str_to_u16_utils \
convert/str_to_u32 \
convert/str_to_u32_utils \
convert/str_to_u64 \
convert/str_to_u64_utils \
convert/str_to_u8 \
convert/str_to_u8_utils \
convert/u16_to_str \
convert/u32_to_str \
convert/u64_to_str \
convert/u8_to_str \
vec/buf_str/buf_str \
vec/buf_str/buf_str_functions2 \
vec/buf_str/buf_str_functions3 \
vec/str/str \
vec/str/str_functions2 \
vec/str/str_functions3 \
vec/u8/u8 \
vec/u8/u8_functions2 \
vec/u8/u8_functions3 \

View file

@ -6,18 +6,18 @@
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/11/03 13:20:01 by maiboyer #+# #+# #
# Updated: 2024/07/03 22:39:36 by maiboyer ### ########.fr #
# Updated: 2024/07/23 21:49:24 by maiboyer ### ########.fr #
# #
# **************************************************************************** #
ANAME = me
BUILD_DIR ?= build
BUILD_DIR ?= ../build
SRC_DIR = src
INCLUDE_DIR = include output/include ../allocator/include
LIBS_DIR = .
GENERIC_DIR = output/src
GENERIC_INCLUDE = output/include
GEN_DIR = output/src
GEN_INCLUDE = output/include
BASE_PATH ?= $(shell pwd)
@ -26,24 +26,16 @@ LIB_NAME ?=
TARGET = $(BUILD_DIR)/$(NAME)
CC ?= clang
CFLAGS = -Wno-unused-command-line-argument -Wall -Werror -Wextra -g3 -L$(BUILD_DIR) -MMD -rdynamic -DBASE_PATH='"$(BASE_PATH)/"'
#CFLAGS += -fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-return=runtime -fno-common -fsanitize-address-use-after-scope
BONUS_FILES =
LIBS_NAME =
SUBJECT_URL =
CFLAGS += $(CFLAGS_ADDITIONAL)
GENERIC_FILES = $(shell cat gen.list)
SRC_FILES = $(shell cat src.list)
-include ./Filelist.$(ANAME).mk
SRC = $(addsuffix .c,$(addprefix $(SRC_DIR)/,$(GEN_FILES)) $(addprefix $(GEN_DIR)/,$(GEN_FILES)))
OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES) $(GEN_FILES)))
DEPS = $(addsuffix .d,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES) $(GEN_FILES)))
BONUS = $(addsuffix .c,$(addprefix $(SRC_DIR)/,$(BONUS_FILES)))
SRC = $(addsuffix .c,$(addprefix $(SRC_DIR)/,$(SRC_FILES))) \
$(addsuffix .c,$(addprefix $(GENERIC_DIR)/,$(GENERIC_FILES)))
BONUS_OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/me/,$(BONUS_FILES)))
OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/me/,$(SRC_FILES) )) \
$(addsuffix .o,$(addprefix $(BUILD_DIR)/me/,$(GENERIC_FILES)))
DEPS = $(addsuffix .d,$(addprefix $(BUILD_DIR)/me/,$(SRC_FILES))) \
$(addsuffix .d,$(addprefix $(BUILD_DIR)/me/,$(GENERIC_FILES)))
LIBS = $(addprefix $(LIBS_DIR)/,$(LIBS_NAME))
INCLUDES = $(addprefix -I,$(foreach P,$(INCLUDE_DIR) $(GENERIC_INCLUDE) $(LIBS) $(addsuffix /include,$(LIBS)) vendor $(addsuffix /vendor,$(LIBS)),$(realpath $(P))))
INCLUDES = $(addprefix -I,$(foreach P,$(INCLUDE_DIR) $(GEN_INCLUDE) $(LIBS) $(addsuffix /include,$(LIBS)) vendor $(addsuffix /vendor,$(LIBS)),$(realpath $(P))))
COL_GRAY = \033[90m
COL_WHITE = \033[37m
COL_GREEN = \033[32m
@ -51,9 +43,6 @@ COL_BOLD = \033[1m
COL_RESET = \033[0m
COL_GOLD = \033[93m
# TODO: REMOVE FOR RENDU !!!!!
CFLAGS += -DPRINT_BACKTRACE
.PHONY = all bonus clean re subject
@ -66,15 +55,15 @@ $(TARGET): $(OBJ)
@#$(CC) $(INCLUDES) $(OBJ) $(CFLAGS) -o $(NAME)
@ar rcs $(BUILD_DIR)/$(NAME) $(OBJ)
$(BUILD_DIR)/me/%.o: $(SRC_DIR)/%.c
$(BUILD_DIR)/$(ANAME)/%.o: $(SRC_DIR)/%.c
@mkdir -p $(dir $@)
@echo -e '$(COL_GRAY) Building\t$(COL_GREEN)$<$(COL_RESET)'
@$(CC) $(CFLAGS) $(WERROR) $(INCLUDES) -c $< -o $@
@$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
$(BUILD_DIR)/me/%.o: $(GENERIC_DIR)/%.c
$(BUILD_DIR)/$(ANAME)/%.o: $(GEN_DIR)/%.c
@mkdir -p $(dir $@)
@echo -e '$(COL_GRAY) Building\t$(COL_GREEN)$<$(COL_RESET)'
@$(CC) $(CFLAGS) $(WERROR) $(INCLUDES) -c $< -o $@
@$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
clean:
@- $(foreach LIB,$(LIBS), \
@ -101,8 +90,14 @@ subject: subject.txt
subject.txt:
@curl $(SUBJECT_URL) | pdftotext -layout -nopgbrk -q - subject.txt
generate_filelist::
@/usr/bin/env zsh -c "tree -iFf --noreport output | rg '^output/src/(.*)\.c\$$' --replace '\$$1' | sort -u" > ./gen.list
@/usr/bin/env zsh -c "tree -iFf --noreport src | rg '^src/(.*)\.c\$$' --replace '\$$1' | sort -u" > ./src.list
build_filelist:
@rm -f Filelist.$(ANAME).mk
@printf '%-78s\\\n' "SRC_FILES =" > Filelist.$(ANAME).mk
@tree $(SRC_DIR) -ifF | rg '$(SRC_DIR)/(.*)\.c$$' --replace '$$1' | sed -re 's/^(.*)_([0-9]+)$$/\1|\2/g' | sort -t'|' --key=1,1 --key=2,2n | sed -e's/|/_/' | xargs printf '%-78s\\\n' >> Filelist.$(ANAME).mk
@echo "" >> Filelist.$(ANAME).mk
@printf '%-78s\\\n' "GEN_FILES =" >> Filelist.$(ANAME).mk
@tree $(GEN_DIR) -ifF | rg '$(GEN_DIR)/(.*)\.c$$' --replace '$$1' | sed -re 's/^(.*)_([0-9]+)$$/\1|\2/g' | sort -t'|' --key=1,1 --key=2,2n | sed -e's/|/_/' | xargs printf '%-78s\\\n' >> Filelist.$(ANAME).mk
@echo "" >> Filelist.$(ANAME).mk
-include $(DEPS)

View file

@ -1,33 +0,0 @@
convert/i16_to_str
convert/i32_to_str
convert/i64_to_str
convert/i8_to_str
convert/str_to_i16
convert/str_to_i16_utils
convert/str_to_i32
convert/str_to_i32_utils
convert/str_to_i64
convert/str_to_i64_utils
convert/str_to_i8
convert/str_to_i8_utils
convert/str_to_u16
convert/str_to_u16_utils
convert/str_to_u32
convert/str_to_u32_utils
convert/str_to_u64
convert/str_to_u64_utils
convert/str_to_u8
convert/str_to_u8_utils
convert/u16_to_str
convert/u32_to_str
convert/u64_to_str
convert/u8_to_str
vec/buf_str/buf_str
vec/buf_str/buf_str_functions2
vec/buf_str/buf_str_functions3
vec/str/str
vec/str/str_functions2
vec/str/str_functions3
vec/u8/u8
vec/u8/u8_functions2
vec/u8/u8_functions3

View file

@ -26,7 +26,7 @@ t_error C__PREFIX___to_str_base_prefix(C__TYPE__ val, t_str base, t_str prefix,
if (out == NULL || base == NULL || prefix == NULL)
return (ERROR);
value.C__FIELD__ = val;
is_nonnegative = val < 0;
is_nonnegative = val & C__NEG__BITMASK__;
if (is_nonnegative)
value.C__UFIELD__ = ~value.C__UFIELD__ + 1;
return (_format_u64((t_num_str){.value = value.u64, \

View file

@ -44,6 +44,7 @@ replace.C__TYPE__ = "type"
replace.C__PREFIX__ = "prefix"
replace.C__FIELD__ = "type"
replace.C__UFIELD__ = "type"
replace.C__NEG__BITMASK__ = "value"
[[create.num_to_str]]
@ -53,6 +54,7 @@ replace.C__TYPE__ = "t_i64"
replace.C__UFIELD__ = "u64"
replace.C__FIELD__ = "i64"
replace.C__PREFIX__ = "i64"
replace.C__NEG__BITMASK__ = "0x8000000000000000"
[[create.num_to_str]]
sources_output = "src/convert/"
@ -61,6 +63,7 @@ replace.C__TYPE__ = "t_u64"
replace.C__UFIELD__ = "u64"
replace.C__FIELD__ = "u64"
replace.C__PREFIX__ = "u64"
replace.C__NEG__BITMASK__ = "0x0000000000000000"
[[create.num_to_str]]
sources_output = "src/convert/"
@ -69,6 +72,7 @@ replace.C__TYPE__ = "t_i32"
replace.C__UFIELD__ = "u32"
replace.C__FIELD__ = "i32"
replace.C__PREFIX__ = "i32"
replace.C__NEG__BITMASK__ = "0x80000000"
[[create.num_to_str]]
sources_output = "src/convert/"
@ -77,6 +81,7 @@ replace.C__TYPE__ = "t_u32"
replace.C__UFIELD__ = "u32"
replace.C__FIELD__ = "u32"
replace.C__PREFIX__ = "u32"
replace.C__NEG__BITMASK__ = "0x00000000"
[[create.num_to_str]]
sources_output = "src/convert/"
@ -85,6 +90,7 @@ replace.C__TYPE__ = "t_i16"
replace.C__UFIELD__ = "u16"
replace.C__FIELD__ = "i16"
replace.C__PREFIX__ = "i16"
replace.C__NEG__BITMASK__ = "0x8000"
[[create.num_to_str]]
sources_output = "src/convert/"
@ -93,6 +99,7 @@ replace.C__TYPE__ = "t_u16"
replace.C__UFIELD__ = "u16"
replace.C__FIELD__ = "u16"
replace.C__PREFIX__ = "u16"
replace.C__NEG__BITMASK__ = "0x0000"
[[create.num_to_str]]
sources_output = "src/convert/"
@ -101,6 +108,7 @@ replace.C__TYPE__ = "t_i8"
replace.C__UFIELD__ = "u8"
replace.C__FIELD__ = "i8"
replace.C__PREFIX__ = "i8"
replace.C__NEG__BITMASK__ = "0x80"
[[create.num_to_str]]
sources_output = "src/convert/"
@ -109,6 +117,7 @@ replace.C__TYPE__ = "t_u8"
replace.C__UFIELD__ = "u8"
replace.C__FIELD__ = "u8"
replace.C__PREFIX__ = "u8"
replace.C__NEG__BITMASK__ = "0x00"
[[create.str_to_num]]
sources_output = "src/convert/"

View file

@ -26,7 +26,7 @@ t_error i16_to_str_base_prefix(t_i16 val, t_str base, t_str prefix,
if (out == NULL || base == NULL || prefix == NULL)
return (ERROR);
value.i16 = val;
is_nonnegative = val < 0;
is_nonnegative = val & 0x8000;
if (is_nonnegative)
value.u16 = ~value.u16 + 1;
return (_format_u64((t_num_str){.value = value.u64, \

View file

@ -26,7 +26,7 @@ t_error i32_to_str_base_prefix(t_i32 val, t_str base, t_str prefix,
if (out == NULL || base == NULL || prefix == NULL)
return (ERROR);
value.i32 = val;
is_nonnegative = val < 0;
is_nonnegative = val & 0x80000000;
if (is_nonnegative)
value.u32 = ~value.u32 + 1;
return (_format_u64((t_num_str){.value = value.u64, \

View file

@ -26,7 +26,7 @@ t_error i64_to_str_base_prefix(t_i64 val, t_str base, t_str prefix,
if (out == NULL || base == NULL || prefix == NULL)
return (ERROR);
value.i64 = val;
is_nonnegative = val < 0;
is_nonnegative = val & 0x8000000000000000;
if (is_nonnegative)
value.u64 = ~value.u64 + 1;
return (_format_u64((t_num_str){.value = value.u64, \

View file

@ -26,7 +26,7 @@ t_error i8_to_str_base_prefix(t_i8 val, t_str base, t_str prefix,
if (out == NULL || base == NULL || prefix == NULL)
return (ERROR);
value.i8 = val;
is_nonnegative = val < 0;
is_nonnegative = val & 0x80;
if (is_nonnegative)
value.u8 = ~value.u8 + 1;
return (_format_u64((t_num_str){.value = value.u64, \

View file

@ -26,7 +26,7 @@ t_error u16_to_str_base_prefix(t_u16 val, t_str base, t_str prefix,
if (out == NULL || base == NULL || prefix == NULL)
return (ERROR);
value.u16 = val;
is_nonnegative = val < 0;
is_nonnegative = val & 0x0000;
if (is_nonnegative)
value.u16 = ~value.u16 + 1;
return (_format_u64((t_num_str){.value = value.u64, \

View file

@ -26,7 +26,7 @@ t_error u32_to_str_base_prefix(t_u32 val, t_str base, t_str prefix,
if (out == NULL || base == NULL || prefix == NULL)
return (ERROR);
value.u32 = val;
is_nonnegative = val < 0;
is_nonnegative = val & 0x00000000;
if (is_nonnegative)
value.u32 = ~value.u32 + 1;
return (_format_u64((t_num_str){.value = value.u64, \

View file

@ -26,7 +26,7 @@ t_error u64_to_str_base_prefix(t_u64 val, t_str base, t_str prefix,
if (out == NULL || base == NULL || prefix == NULL)
return (ERROR);
value.u64 = val;
is_nonnegative = val < 0;
is_nonnegative = val & 0x0000000000000000;
if (is_nonnegative)
value.u64 = ~value.u64 + 1;
return (_format_u64((t_num_str){.value = value.u64, \

View file

@ -26,7 +26,7 @@ t_error u8_to_str_base_prefix(t_u8 val, t_str base, t_str prefix,
if (out == NULL || base == NULL || prefix == NULL)
return (ERROR);
value.u8 = val;
is_nonnegative = val < 0;
is_nonnegative = val & 0x00;
if (is_nonnegative)
value.u8 = ~value.u8 + 1;
return (_format_u64((t_num_str){.value = value.u64, \

View file

@ -1,110 +0,0 @@
blx/blx
blx/blx_create_fontsheet
blx/blx_handlers
blx/blx_keycode
blx/colors
blx/draw/draw
blx/draw/draw_sprite
blx/draw/draw_string
blx/inputs
blx/logic
blx/sprite/draw_image
blx/sprite/draw_pixel_onto
blx/sprite/draw_string
blx/sprite/free_image
blx/sprite/get_pixel
blx/sprite/new_image
blx/sprite/sprite_draw_onto_sprite
char/isalnum
char/isalpha
char/isascii
char/isdigit
char/islower
char/isprint
char/isspace
char/isupper
char/tolower
char/toupper
convert/numbers_to_str
fs/close
fs/fs_internal
fs/open
fs/putchar_fd
fs/putendl_fd
fs/putnbr_fd
fs/putstr_fd
fs/read
fs/read_to_vec
fs/write
gnl/get_next_line
hash/hash_signed
hash/hash_str
hash/hash_unsigned
hash/hasher
hash/sip/sip13
hash/sip/sip_utils
hash/sip/sip_utils2
img/qoi/qoi_decode
img/qoi/qoi_encode
img/qoi/qoi_fs
img/qoi/qoi_utils
mem/allocator
mem/mem_alloc
mem/mem_alloc_array
mem/mem_compare
mem/mem_copy
mem/mem_find
mem/mem_find_bytes
mem/mem_move
mem/mem_realloc
mem/mem_set
mem/mem_set_zero
num/u16/rotate
num/u32/rotate
num/u64/from_bytes
num/u64/rotate
num/u8/rotate
num/usize/rotate
num/usize/round_up
os/abort
os/exit
os/pipe
os/process
os/process_inner
os/process_inner2
printf/callbacks
printf/formatter/char
printf/formatter/decimal
printf/formatter/hex
printf/formatter/oct
printf/formatter/ptr
printf/formatter/unsigned_decimal
printf/formatter/utils
printf/formatter/utils2
printf/formatter/utils3
printf/formatter/utils_numbers
printf/matchers
printf/printf
printf/printf_fd
printf/printf_str
printf/vprintf
str/str_clone
str/str_compare
str/str_find_chr
str/str_find_rev_chr
str/str_find_str
str/str_iter
str/str_join
str/str_l_cat
str/str_l_copy
str/str_len
str/str_map
str/str_n_compare
str/str_n_find_str
str/str_split
str/str_substring
str/str_trim
string/mod
string/string_insert
string/string_remove
string/string_reserve