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

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