diff options
Diffstat (limited to 'common/Makefile')
| -rw-r--r-- | common/Makefile | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/common/Makefile b/common/Makefile index d23cac9..e40fb30 100644 --- a/common/Makefile +++ b/common/Makefile @@ -6,27 +6,35 @@ # By: cacharle <marvin@42.fr> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/02/09 22:39:08 by cacharle #+# #+# # -# Updated: 2021/01/02 10:47:14 by cacharle ### ########.fr # +# Updated: 2021/01/08 14:32:37 by charles ### ########.fr # # # # **************************************************************************** # LIB = ar rcs -RM = rm -rf +RM = rm -f +MKDIR = mkdir -pv + +SRCDIR = src +OBJDIR = obj +INCDIR = inc CC = gcc -CCFLAGS = -std=c99 -O2 -Wall -Wextra -Werror +CCFLAGS = -std=c99 -Wall -Wextra -Werror -O2 -I$(INCDIR) NAME = libphilocommon.a -SRC = $(shell find . -type f -name "*.c") -OBJ = $(SRC:.c=.o) +SRC = $(shell find $(SRCDIR) -type f -name "*.c") +OBJ = $(SRC:$(SRCDIR)/%.c=$(OBJDIR)/%.o) + +all: prebuild $(NAME) -all: $(NAME) +prebuild: + @$(MKDIR) $(OBJDIR) $(NAME): $(OBJ) $(LIB) $(NAME) $(OBJ) -%.o: %.c +$(OBJDIR)/%.o: $(SRCDIR)/%.c $(CC) $(CCFLAGS) -c -o $@ $< clean: @@ -35,4 +43,4 @@ clean: re: clean all -.PHONY: all clean re +.PHONY: all prebuild clean re |
