explication makefil en cours

This commit is contained in:
Hugo LAMY
2019-11-14 17:05:54 +01:00
parent ac4a5e088c
commit 28e08d8238
15 changed files with 261 additions and 28 deletions

Binary file not shown.

View File

@@ -1,9 +1,33 @@
SRC = main.c putchar.c transform.c
DEP = test.h
OBJ = $(SRC:.c=.o)
#-------------#
# VARIABLES #
#-------------#
NAME = test
CC = gcc
VPATH = srcs
# HEADERS #
IDIR = includes
_DEPS = test.h
DEPS = $(_DEPS:%.h=$(IDIR)/%.h)
# LIBRAIRIES #
LDIR = ./
_LIBS = libtest.a
LIBS = $(_LIBS:lib%.a=%)
# FUNCTIONS et OBJETS #
SRCS = main.c #putchar.c transform.c
ODIR = ./builds
OBJS = $(SRCS:%.c=$(ODIR)/%.o)
# OPTIONS de GCC #
CFLAGS = -I$(IDIR)
LFLAGS = -L$(LDIR) -l$(LIBS)
test: $(OBJ)
gcc -I. -o test $(OBJ)
%.o: %.c $(DEP)
gcc -I. -c $<
#---------#
# RULES #
#---------#
all: $(ODIR) $(NAME)
$(NAME): $(OBJS) $(DEPS)
$(CC) $(CFLAGS) -o test $(OBJS) $(LFLAGS)
$(ODIR):
mkdir -p $@
$(ODIR)/%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<

Binary file not shown.

Binary file not shown.

View File

@@ -2,5 +2,5 @@
int transform(int a)
{
return(--a);
return (--a);
}

BIN
test/test

Binary file not shown.

Binary file not shown.