#-------------#
#  VARIABLES  #
#-------------#
NAME	= libtest.a
CC		= gcc
VPATH	= srcs

IDIR	= includes
_DEPS	= test.h
DEPS    = $(_DEPS:%.h=$(IDIR)/%.h)

LDIR    = .
_LIBS   = libtest.a
LIBS   	= $(_LIBS:lib%.a=%)

SRCS	= main.c to_uppercase.c putchar.c transform.c
ODIR	= ./builds
OBJS	= $(SRCS:%.c=$(ODIR)/%.o)

CFLAGS	= -I$(IDIR)
LFLAGS  = -L$(LDIR) -l$(LIBS)

#---------#
#  RULES  #
#---------#
all: $(ODIR) $(NAME)
#$(NAME): $(OBJS) $(DEPS)
#	$(CC) $(CFLAGS) -o $@ $(OBJS) $(LFLAGS)
$(NAME): $(OBJS) $(DEPS)
	ar rc $@ $(OBJS)
$(ODIR):
	mkdir -p $@
$(ODIR)/%.o: %.c
	$(CC) $(CFLAGS) -c -o $@ $<

