aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/Makefile24
-rw-r--r--common/inc/common.h (renamed from common/common.h)3
-rw-r--r--common/src/args.c (renamed from common/args.c)0
-rw-r--r--common/src/helper.c (renamed from common/helper.c)0
-rw-r--r--common/src/io.c (renamed from common/io.c)0
5 files changed, 18 insertions, 9 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
diff --git a/common/common.h b/common/inc/common.h
index 09fdf79..6d36e35 100644
--- a/common/common.h
+++ b/common/inc/common.h
@@ -6,13 +6,14 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/08 22:58:35 by cacharle #+# #+# */
-/* Updated: 2021/01/04 11:52:30 by cacharle ### ########.fr */
+/* Updated: 2021/01/04 13:06:52 by charles ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef COMMON_H
# define COMMON_H
+# define _XOPEN_SOURCE 500
# include <unistd.h>
# include <stdlib.h>
# include <stdbool.h>
diff --git a/common/args.c b/common/src/args.c
index 2070e46..2070e46 100644
--- a/common/args.c
+++ b/common/src/args.c
diff --git a/common/helper.c b/common/src/helper.c
index a9d0652..a9d0652 100644
--- a/common/helper.c
+++ b/common/src/helper.c
diff --git a/common/io.c b/common/src/io.c
index c01accd..c01accd 100644
--- a/common/io.c
+++ b/common/src/io.c