diff --git a/Makefile b/Makefile index 919b276..454dd2a 100644 --- a/Makefile +++ b/Makefile @@ -2,108 +2,120 @@ # variables names # # - - - - - - - - - # -# each variable will expand in its value when used +NAME = libft.a +CC = gcc +VPATH = srcs -NAME = libft.a -DEP = libft.h -CC = gcc -CFLAGS = -Wall -Wextra -Werror -I. -c -SRCS = ft_atoi.c \ - ft_bzero.c \ - ft_isalnum.c \ - ft_isalpha.c \ - ft_isascii.c \ - ft_isdigit.c \ - ft_isprint.c \ - ft_memccpy.c \ - ft_memchr.c \ - ft_memcmp.c \ - ft_memcpy.c \ - ft_memmove.c \ - ft_memset.c \ - ft_strcat.c \ - ft_strchr.c \ - ft_strcmp.c \ - ft_strcpy.c \ - ft_strdup.c \ - ft_strlcat.c \ - ft_strlen.c \ - ft_strncat.c \ - ft_strncmp.c \ - ft_strncpy.c \ - ft_strnstr.c \ - ft_strrchr.c \ - ft_strstr.c \ - ft_tolower.c \ - ft_toupper.c \ - \ - ft_itoa.c \ - ft_memalloc.c \ - ft_memdel.c \ - ft_putchar.c \ - ft_putchar_fd.c \ - ft_putendl.c \ - ft_putendl_fd.c \ - ft_putnbr.c \ - ft_putnbr_fd.c \ - ft_putstr.c \ - ft_putstr_fd.c \ - ft_strclr.c \ - ft_strdel.c \ - ft_strequ.c \ - ft_striter.c \ - ft_striteri.c \ - ft_strjoin.c \ - ft_strmap.c \ - ft_strmapi.c \ - ft_strnequ.c \ - ft_strnew.c \ - ft_strsplit.c \ - ft_strsub.c \ - ft_strtrim.c \ - \ - ft_lstnew.c \ - ft_lstdelone.c \ - ft_lstdel.c \ - ft_lstadd.c \ - ft_lstiter.c \ - ft_lstmap.c \ - \ - ft_any.c \ - ft_atoibase.c \ - ft_convertbase.c \ - ft_foreach.c \ - ft_issort.c \ - ft_arraymap.c \ - ft_putnbrbase.c \ - ft_strmultisplit.c -ODIR = ./builds - -# - $(SRCS:%.c=$(ODIR)/%.o) is a built-in function called a -# "substitute reference", an abbreviation for the +IDIR = includes +_DEP = libft.h +DEPS = $(_DEP:%.h=$(IDIR)/%.h) +# - $(_DEP:%.h=$(IDIR)/%.h) is a built-in function called +# a "substitute reference", an abbreviation for the # expansion function "patsubst" : -# $(patsubst %.c,$(ODIR)/%.o,$(SRCS)) +# $(patsubst %.h,$(IDIR)/%.h,$(_DEP)) +# $(patsubst pattern,replacement,text) # - % match everything, the value of the first % in # "replacement" is replaced by the text matched by the -# first one in "pattern", it only works for the firsts +# first % in "pattern", it only works for the firsts + +CFLAGS = -I$(IDIR) +CFLAGS += -Wall -Wextra -Werror + +SRCS = ft_atoi.c \ + ft_bzero.c \ + ft_isalnum.c \ + ft_isalpha.c \ + ft_isascii.c \ + ft_isdigit.c \ + ft_isprint.c \ + ft_memccpy.c \ + ft_memchr.c \ + ft_memcmp.c \ + ft_memcpy.c \ + ft_memmove.c \ + ft_memset.c \ + ft_strcat.c \ + ft_strchr.c \ + ft_strcmp.c \ + ft_strcpy.c \ + ft_strdup.c \ + ft_strlcat.c \ + ft_strlen.c \ + ft_strncat.c \ + ft_strncmp.c \ + ft_strncpy.c \ + ft_strnstr.c \ + ft_strrchr.c \ + ft_strstr.c \ + ft_tolower.c \ + ft_toupper.c \ + \ + ft_itoa.c \ + ft_memalloc.c \ + ft_memdel.c \ + ft_putchar.c \ + ft_putchar_fd.c \ + ft_putendl.c \ + ft_putendl_fd.c \ + ft_putnbr.c \ + ft_putnbr_fd.c \ + ft_putstr.c \ + ft_putstr_fd.c \ + ft_strclr.c \ + ft_strdel.c \ + ft_strequ.c \ + ft_striter.c \ + ft_striteri.c \ + ft_strjoin.c \ + ft_strmap.c \ + ft_strmapi.c \ + ft_strnequ.c \ + ft_strnew.c \ + ft_strsplit.c \ + ft_strsub.c \ + ft_strtrim.c \ + \ + ft_lstnew.c \ + ft_lstdelone.c \ + ft_lstdel.c \ + ft_lstadd.c \ + ft_lstiter.c \ + ft_lstmap.c \ + \ + ft_any.c \ + ft_atoibase.c \ + ft_convertbase.c \ + ft_foreach.c \ + ft_issort.c \ + ft_arraymap.c \ + ft_putnbrbase.c \ + ft_strmultisplit.c +ODIR = ./builds OBJ = $(SRCS:%.c=$(ODIR)/%.o) + # - - - - - - - - - - - # # rules to execute # # - - - - - - - - - - - # + +all: $(ODIR) $(NAME) # - when you write "make" in command line it will execute # the first rule wrote in the Makefile, wich is "all" by # convention because usually when you type "make" you # expect it to build all # - it first verify if ODIR is created and if not create # it, then it calls NAME to create the library -all: $(ODIR) $(NAME) -# create the folder where all the .o files will be stored + $(ODIR): mkdir -p $(ODIR) +# create the folder where all the .o files will be stored + +$(NAME): $(OBJS) $(DEPS) + ar -rc $@ $(OBJS) + @ranlib $@ # - NAME will create the library libft.a # - first it checks if any OBJ (files.o) have more recent # date of modification than NAME (libft.a), and for each @@ -115,12 +127,12 @@ $(ODIR): # modified since last creation of NAME # - ranlib is precedeed by a "@" to avoid being print # - if DEP (libft.h) is modified the library is remade -# - $@ means everything left to ":" +# - $@ means name of the rule # - $< means first argument right to ":" -$(NAME): $(OBJ) $(DEP) - ar -rc $@ $< - @ranlib $@ + +$(ODIR)/%.o: %.c + $(CC) $(CFLAGS) -c -o $@ $< # - this rule depend of the list of files.c # - if any of these files are more recent than the file # builds/file.o equivalent then the rule will rebuild @@ -128,22 +140,55 @@ $(NAME): $(OBJ) $(DEP) # - the flag -o is there to put explicit name of the .o # files since they must be written within a directory # path (builds/) -$(ODIR)/%.o: %.c - $(CC) $(CFLAGS) -c -o $@ $< -# clean the objects file -# rm is use with it's native path to avoid using an alias + clean: /bin/rm -rf $(ODIR) +# clean the objects file +# rm is use with its native path to avoid using an alias + -# clean the objects and executable files fclean: clean /bin/rm -f $(NAME) +# clean the objects and executable files + -# remake the compilation re: fclean all +# remake the compilation + .PHONY: clean fclean re all +# all rules that are not names of a file are declared to +# be phony so that makefile knows he has to execute them +# even if a file name similarly exist and would prevent +# the rule to execute because it has not been changed + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -155,27 +200,26 @@ re: fclean all # explication complete etapes par etapes depuis le debut # # ------------------------------------------------------ # -## SOMMAIRE [140 G] -## 1 - compiler avec gcc [161 G] -# compiler un programme... [165 G] -# compiler en plusieurs fichiers... [190 G] -# les .o : pre-compiler... [238 G] +## 1 - compiler avec gcc [25 gj] +# compiler un programme [29 gj] +# compiler en plusieurs fichiers [54 gj] +# les .o : compiler et linker [102 gj] -## 2 - creer une librairie [272 G] -# ar rc [276 G] -# ar rc en plusieurs fois [301 G] -# ranlib [322 G] +## 2 - creer une librairie [135 gj] +# ar rc [139 gj] +# ar rc en plusieurs fois [164 gj] +# ranlib [185 gj] -## 3 - fichiers .h [335 G] -# a quoi sert un header [] -# ecrire un header [] -# comment ca se compile [] +## 3 - fichiers .h [198 gj] +# a quoi sert un header [202 gj] +# ecrire un header [229 gj] +# comment ca se compile [273 gj] -## 4 - ecrire un make file... [] -# makefile basique [] -# ne pas tout recompiler... [] -# fichiers .o dans un dossier... [] -# make un autre makefile [] +## 4 - ecrire un make file [305 gj] +# basic makefile [309 gj] +# makefile with subdirectories [462 gj] +# makefile making another makefile [583 gj] +# makefile for a library [690 gj] ## ---------------------- ## 1 - compiler avec gcc @@ -357,7 +401,6 @@ re: fclean all # - - - - - - - - - - - - # a quoi sert un header # - - - - - - - - - - - - - # si on utilise une librairie c'est parce qu'on peut avoir # souvent besoin des memes fonctions dans un programme # mais si a chaque fois qu'on utilise une fonction de la @@ -435,10 +478,10 @@ re: fclean all # # par exemple pour l'architecture de dossier suivante : # -# # file -# # -> main.c -# # -> ft_putchar.c -# # -> libtest.h +# # file/ +# # main.c +# # ft_putchar.c +# # libtest.h # # il faut ecrire : # @@ -496,19 +539,19 @@ re: fclean all # # #---------# # # all: $(ODIR) $(NAME) # # $(NAME): $(OBJS) $(DEPS) -# # $(CC) $(CFLAGS) -o $@ $(OBJS) $(LFLAGS) +# # $(CC) $(CFLAGS) -o $@ $(OBJS) $(LFLAGS) # # %.o: %.c -# # $(CC) $(CFLAGS) -c -o $@ $< +# # $(CC) $(CFLAGS) -c -o $@ $< # # clean: -# # /bin/rm -rf $(ODIR) +# # /bin/rm -rf $(ODIR) # # fclean: clean -# # /bin/rm -f $(NAME) +# # /bin/rm -f $(NAME) # # re: fclean all # # .PHONY: all clean fclean re # # # prompt "make" execute the first rule ("all") # -# [archtecture] +# [architecture] # # main.c # # main.o # # function01.c @@ -627,7 +670,7 @@ re: fclean all # # have multiples .a files # -# [archtecture] +# [architecture] # # srcs/ # # main.c # # function01.c @@ -670,21 +713,21 @@ re: fclean all # # #---------# # # all: $(ODIR) $(NAME) # # $(NAME): $(OBJS) $(DEPS) -# # $(CC) $(CFLAGS) -o $@ $(OBJS) $(LFLAGS) +# # $(CC) $(CFLAGS) -o $@ $(OBJS) $(LFLAGS) # # $(ODIR): -# # mkdir -p $@ +# # mkdir -p $@ # # $(ODIR)/%.o: %.c -# # $(CC) $(CFLAGS) -c -o $@ $< +# # $(CC) $(CFLAGS) -c -o $@ $< # # clean: -# # /bin/rm -rf $(ODIR) +# # /bin/rm -rf $(ODIR) # # fclean: clean -# # /bin/rm -f $(NAME) +# # /bin/rm -f $(NAME) # # re: fclean all # # .PHONY: all clean fclean re # # # prompt "make" execute the first rule ("all") # -# [archtecture] +# [architecture] # # srcs/ # # main.c # # function01.c @@ -692,21 +735,30 @@ re: fclean all # # includes/ # # header01.h # # header02.h -# # builds/ -# # main.o -# # function01.o -# # function02.o +# # builds/ ++ +# # main.o ++ +# # function01.o ++ +# # function02.o ++ # # libtest.a # # liboption.a # # Makefile -# # program_test +# # program_test ++ +# +# ----- +# +# VPATH = srcs +# +# build-in variable VPATH is a list of directories where +# makefile looks for files that it doesn't find in the +# first place, so it let you easily put .c files into +# subdirectories # # ----- # # LIBS = $(_LIBS:lib%.a=%) # -# from "libtest.a" abd "liboption.a" it creates "test" -# and option +# from "libtest.a" and "liboption.a" it creates "test" +# and "option" # # as said, the value of the % in "replacement" is # replaced with the text matched by the % in "pattern" @@ -720,253 +772,200 @@ re: fclean all # # ----- # -# all: $(ODIR) $(NAME) -# $(ODIR): -# mkdir -p $@ -# -# ALL call the rull ODIR wich verify if the objects files -# directory already exist and if not, create it -# -# ----- -# # $(NAME): $(OBJS) $(DEPS) # $(CC) $(CFLAGS) -o $@ $(OBJS) $(LFLAGS) # # NAME depends on OBJS and DEPS, so if any .o or any .h # have more recent date of modification NAME will execute -# only for them +# again only for them + +# - - - - - - - - - - - - - - - - - +# makefile making another makefile +# - - - - - - - - - - - - - - - - - + +# compiling a makefile with compiling another makefile in +# a subdirectory wich contain the library used by the +# roots makefile # -# ----- +# [architecture] +# # srcs/ +# # main.c +# # function01.c +# # function02.c +# # includes/ +# # header01.h +# # header02.h +# # libtest/ +# # Makefile +# # header_lib.h +# # function_lib01.c +# # function_lib02.c +# # libtest.a +# # Makefile # -# clean: -# /bin/rm -rf $(ODIR) -# -# "make clean" suppress all the .o files -# -# ----- -# -# -# -# -# -# -# -# -# -# -# - -# - - - - - - - - - - - - - - - - - - - -# makefile qui make un autre makefile -# - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - -# makefile pour une librairie -# - - - - - - - - - - - - - - - - - - -# # create the folder where all the .o files will be stored -# $(ODIR): -# mkdir -p $(ODIR) -# -# # - NAME will create the library libft.a -# # - first it checks if any OBJ (files.o) have more recent -# # date of modification than NAME (libft.a), and for each -# # it will execute -# # - $(OBJ) will expand in the list of files.o and each of -# # them will call the rule "$(ODIR)/%.o:" below because it -# # has its exact pattern -# # - NAME will execute only for the .c that has been -# # modified since last creation of NAME -# # - ranlib is precedeed by a "@" to avoid being print -# # - if DEP (libft.h) is modified the library is remade -# # - $@ means everything left to ":" -# # - $< means first argument right to ":" -# $(NAME): $(OBJ) $(DEP) -# ar -rc $@ $< -# @ranlib $@ -# -# # - this rule depend of the list of files.c -# # - if any of these files are more recent than the file -# # builds/file.o equivalent then the rule will rebuild -# # this .o file -# # - the flag -o is there to put explicit name of the .o -# # files since they must be written within a directory -# # path (builds/) -# $(ODIR)/%.o: %.c -# $(CC) $(CFLAGS) -c -o $@ $< -# -# # clean the objects file -# # rm is use with it's native path to avoid using an alias -# clean: -# /bin/rm -rf $(ODIR) -# -# # clean the objects and executable files -# fclean: clean -# /bin/rm -f $(NAME) -# -# # remake the compilation -# re: fclean all -# -# .PHONY: clean fclean - - - - - - - - - - - - - - - - -# Make a des built-in pattern rules : -# https://www.gnu.org/software/make/manual/html_node/Catalogue-of-Rules.html -# par exemple pour construire des .o a partir de .c -# qui sont utilisees par défaut si les variables -# sont bien nomee (genre CC ou CFLAGS) - -# - - - - - - - - - - - - - - - - - - - - - - - - - -# ne pas tout recompiler a la moindre modification -# - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - - - - - - -# mettre les fichiers .o dans un dossier -# - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - -# make un autre makefile -# - - - - - - - - - - - - - -# -# cependant si on veut mettre les fichiers .o dans un -# sous-fichier BUILDS il n'y a pas de built-in pattern -# il faut donc l'ecrire nous-meme : -# -# # NAME = libtest.h -# # CC = gcc -# # CFLAGS = -I. -# # SRCS = example01.c \ -# # example02.c -# # ODIR = ./builds -# # OBJS = $(addprefix $(ODIR)/, $(SRCS:.c=.o)) -# # -# # all: $(NAME) -# # $(NAME): $(OBJS) -# # ar -rc $@ $< +# # #-------------# +# # # VARIABLES # +# # #-------------# +# # NAME = program_test +# # CC = gcc +# # VPATH = srcs # # -# # $(ODIR)/%.o : %.c -# # $(COMPILE.c) -o $@ $< +# # IDIR = includes +# # _DEPS = header01.h \ +# # header02.h +# # DEPS = $(_DEPS:%.h=$(IDIR)/%.h) +# # +# # LDIR = ./libtest/ +# # _LIBS = libtest.a \ +# # LIBS = $(_LIBS:lib%.a=%) +# # +# # SRCS = main.c \ +# # function01.c +# # function02.c +# # ODIR = ./builds +# # OBJS = $(SRCS:%.c=$(ODIR)/%.o) +# # +# # CFLAGS = -I$(IDIR) +# # LFLAGS = -L$(LDIR) -l$(LIBS) +# # +# # #---------# +# # # RULES # +# # #---------# +# # all: $(ODIR) $(NAME) +# # $(NAME): $(OBJS) $(DEPS) +# # make -C $(LDIR) +# # $(CC) $(CFLAGS) -o $@ $(OBJS) $(LFLAGS) +# # $(ODIR): +# # mkdir -p $@ +# # $(ODIR)/%.o: %.c +# # $(CC) $(CFLAGS) -c -o $@ $< +# # clean: +# # make clean -C $(LDIR) +# # /bin/rm -rf $(ODIR) +# # fclean: clean +# # make fclean -C $(LDIR) +# # /bin/rm -f $(NAME) +# # re: fclean all +# # .PHONY: all clean fclean re # -# cette regle est appellee par $(OBJS) puisque -# cette variable appelle la regle $(ODIR/file.o) +# # prompt "make" execute the first rule ("all") # -# COMPILE est une built-in variable qui execute -# les regles CC et CFLAGS avec l'option -c +# [archtecture] +# # srcs/ +# # main.c +# # function01.c +# # function02.c +# # includes/ +# # header01.h +# # header02.h +# # builds/ ++ +# # main.o ++ +# # function01.o ++ +# # function02.o ++ +# # libtest/ +# # Makefile +# # header_lib.h +# # function_lib01.c +# # function_lib02.c +# # libtest.a +# # Makefile +# # program_test ++ # -# % = "tout" -# $@ = "la valeur a gauche de :" -# $< = "la premiere valeur a droite de :" -# $^ = "toutes les valeurs a droite de :" +# ----- +# +# make -C $(LDIR) +# +# make -C +# +# the -C option says to makefile it should first go to the +# path location and then do "make" +# +# it's similar to : +# +# rule: +# cd $(LDIR) && make # +# - - - - - - - - - - - - +# makefile for a library +# - - - - - - - - - - - - - -# shape of a rule : # -# target: prerequisites -# recipe +# exemple of a makefile used not for a compilation into a +# binary executable, but to create a library +# +# [architecture] +# # srcs/ +# # function01.c +# # function02.c +# # includes/ +# # header.h +# # Makefile +# +# # #-------------# +# # # VARIABLES # +# # #-------------# +# # NAME = libtest.a +# # CC = gcc +# # VPATH = srcs +# # +# # IDIR = includes +# # _DEPS = header.h +# # DEPS = $(_DEPS:%.h=$(IDIR)/%.h) +# # +# # SRCS = function01.c \ +# # function02.c +# # ODIR = ./builds +# # OBJS = $(SRCS:%.c=$(ODIR)/%.o) +# # +# # CFLAGS = -I$(IDIR) +# # +# # #---------# +# # # RULES # +# # #---------# +# # all: $(ODIR) $(NAME) +# # $(NAME): $(OBJS) $(DEP) +# # ar -rc $@ $(OBJS) +# # @ranlib $@ +# # $(ODIR): +# # mkdir -p $@ +# # $(ODIR)/%.o: %.c +# # $(CC) $(CFLAGS) -c -o $@ $< +# # clean: +# # /bin/rm -rf $(ODIR) +# # fclean: clean +# # /bin/rm -f $(NAME) +# # re: fclean all +# # .PHONY: all clean fclean re +# +# # prompt "make" execute the first rule ("all") +# +# [archtecture] +# # srcs/ +# # function01.c +# # function02.c +# # includes/ +# # header.h +# # builds/ +# # function01.o +# # function02.o +# # libtest.a +# # Makefile +# +# ----- +# +# NAME = libtest.a +# +# name is now the name of the library to be built +# +# ----- +# +# @ranlib $@ +# +# @ tells makefile not to show the line in prompt # -# before executing its recipes, makefile verify if any of -# the prerequisites has been more recently modify than -# the target, and if so execute the recipes - - - -# NAME = fdf -# CC = gcc -g3 -# SRCDIR = srcs -# INCLUDESDIR = includes -# LIBFTDIR = libft -# VPATH = $(INCLUDESDIR) \ -# $(SRCDIR) \ -# $(SRCDIR)/init \ -# $(SRCDIR)/print \ -# $(SRCDIR)/calcul \ -# $(SRCDIR)/projection/isometrique \ -# $(SRCDIR)/projection/parallel \ -# $(SRCDIR)/parser \ -# $(SRCDIR)/loop_and_event -# LIBFT = $(LIBFTDIR)/libft.a -# INCLUDES = fdf.h \ -# init.h \ -# print.h \ -# calcul.h \ -# projection.h \ -# parser.h \ -# loop.h -# SRCS = main.c \ -# create_header.c \ -# create_map.c \ -# color_map.c \ -# color_line.c \ -# color_map_pixel.c \ -# print_3d.c \ -# create_mapping.c \ -# straight_line.c \ -# add_point.c \ -# quadrant_one.c \ -# quadrant_two.c \ -# quadrant_three.c \ -# get_points.c \ -# zoom.c \ -# shift.c \ -# alpha_omega.c \ -# increase_z.c \ -# key_dispatcher.c \ -# set_new_color.c \ -# set_projection.c -# ODIR = objs/ -# OBJS = $(addprefix $(OBJDIR), $(SRCS:.c=.o)) -# INC = -I $(INCLUDESDIR) -I $(LIBFTDIR)/$(INCLUDESDIR) -# all: -# @$(MAKE) -C $(MLX_DIR); -# @$(MAKE) -C $(LIBFTDIR) -# @$(ECHO) "$(FLAGS_COLOR)Compiling with flags $(CFLAGS) $(EOC)" -# @$(MAKE) $(NAME) -# debug: -# @$(MAKE) re DEBUG=1 -# $(LIBFT): -# @$(MAKE) -C $(LIBFTDIR) -# $(NAME): $(LIBFT) $(OBJDIR) $(OBJECTS) -# @$(CC) -o $@ $(OBJECTS) $(CFLAGS) $(LFLAGS) $(MLX_LIB) -# @$(ECHO) "$(OK_COLOR)$(NAME) linked with success !$(EOC)" -# $(OBJDIR): -# @$(MKDIR) $@ -# $(OBJDIR)%.o: $(SRC_DIR)%.c $(INCLUDES) -# @$(CC) -c $< -o $@ $(CFLAGS) -# @$(ECHO) "${COMP_COLOR}$< ${EOC}" -# clean: -# @$(MAKE) clean -C $(MLX_DIR) -# @$(MAKE) clean -C $(LIBFTDIR) -# @$(RM) $(OBJECTS) -# @$(RM) -r $(OBJDIR) && $(ECHO) "${OK_COLOR}Successfully cleaned $(NAME) objects files ${EOC}" -# fclean: clean -# @$(MAKE) fclean -C $(MLX_DIR) -# @$(MAKE) fclean -C $(LIBFTDIR) -# @$(RM) $(NAME) && $(ECHO) "${OK_COLOR}Successfully cleaned $(NAME) ${EOC}" -# re: fclean all -# rere: -# @$(RM) $(OBJECTS) -# @$(RM) -r $(OBJDIR) -# @$(RM) $(BINDIR)/$(NAME) -# @$(MAKE) all -# .PHONY: all clean fclean re debug +# +# THE END +# enjoy, futur me +# diff --git a/test/Makefile b/test/Makefile index 6b0b884..e920490 100644 --- a/test/Makefile +++ b/test/Makefile @@ -13,7 +13,7 @@ LDIR = ./ _LIBS = libtest.a LIBS = $(_LIBS:lib%.a=%) # FUNCTIONS et OBJETS # -SRCS = main.c to_uppercase.c #putchar.c transform.c +SRCS = main.c to_uppercase.c putchar.c transform.c ODIR = ./builds OBJS = $(SRCS:%.c=$(ODIR)/%.o) # OPTIONS de GCC # @@ -24,8 +24,10 @@ LFLAGS = -L$(LDIR) -l$(LIBS) # RULES # #---------# all: $(ODIR) $(NAME) +#$(NAME): $(OBJS) $(DEPS) +# $(CC) $(CFLAGS) -o $@ $(OBJS) $(LFLAGS) $(NAME): $(OBJS) $(DEPS) - $(CC) $(CFLAGS) -o $@ $(OBJS) $(LFLAGS) + ar rc $@ $(OBJS) $(ODIR): mkdir -p $@ $(ODIR)/%.o: %.c diff --git a/test/builds/main.o b/test/builds/main.o index 78735ef..fa0b8d0 100644 Binary files a/test/builds/main.o and b/test/builds/main.o differ diff --git a/test/builds/putchar.o b/test/builds/putchar.o new file mode 100644 index 0000000..27a2a24 Binary files /dev/null and b/test/builds/putchar.o differ diff --git a/test/builds/to_uppercase.o b/test/builds/to_uppercase.o index e8f61a5..eb31766 100644 Binary files a/test/builds/to_uppercase.o and b/test/builds/to_uppercase.o differ diff --git a/test/builds/transform.o b/test/builds/transform.o new file mode 100644 index 0000000..d35bfb8 Binary files /dev/null and b/test/builds/transform.o differ diff --git a/test/libtest.a b/test/libtest.a deleted file mode 100644 index d07faf3..0000000 Binary files a/test/libtest.a and /dev/null differ diff --git a/test/srcs/putchar.c b/test/srcs/putchar.c new file mode 100644 index 0000000..07d8c03 --- /dev/null +++ b/test/srcs/putchar.c @@ -0,0 +1,6 @@ +#include "test.h" + +void ft_putchar(char c) +{ + write(1, &c, 1); +} diff --git a/test/srcs/transform.c b/test/srcs/transform.c new file mode 100644 index 0000000..744c097 --- /dev/null +++ b/test/srcs/transform.c @@ -0,0 +1,6 @@ +#include "test.h" + +int transform(int a) +{ + return (--a); +} diff --git a/test/test b/test/test new file mode 100644 index 0000000..c7262cb Binary files /dev/null and b/test/test differ