aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile19
1 files changed, 11 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index a73327b..76765dc 100644
--- a/Makefile
+++ b/Makefile
@@ -12,25 +12,26 @@
LIB = ar rcs
RM = rm -f
+MAKE_ARGS = --no-print-directory
CC = gcc
CCFLAGS = -I$(INCLUDE_DIR) -Wall -Wextra -Werror
NAME = libft.a
+SRC_DIR = src
+INCLUDE_DIR = include
+BUILD_DIR = build
+TEST_DIR = test
# AVAILABLE_FEATURES = get_next_line ft_printf ft_lst
CONF_FILE = libft.conf
+# ifndef (FEATURES)
+# endif
ifeq ($(wildcard $(CONF_FILE)),)
$(warning "No configuration file found with name $(CONF_FILE), using default")
- SRC_DIR = src
- BUILD_DIR = build
- INCLUDE_DIR = include
FEATURES = get_next_line
else
- SRC_DIR = $(shell sed -n 's/SRC_DIR=//p' $(CONF_FILE))
- BUILD_DIR = $(shell sed -n 's/BUILD_DIR=//p' $(CONF_FILE))
- INCLUDE_DIR = $(shell sed -n 's/INCLUDE_DIR=//p' $(CONF_FILE))
FEATURES = $(shell sed -n 's/FEATURES=//p' $(CONF_FILE))
endif
@@ -45,7 +46,6 @@ ifeq ($(findstring ft_lst,$(FEATURES)),)
endif
SRC = $(shell find $(SRC_DIR) $(FIND_ARGS) -name *.c)
-
OBJ = $(SRC:$(SRC_DIR)/%.c=$(BUILD_DIR)/%.o)
HEADER_FILES = libft.h get_next_line.h
@@ -53,6 +53,10 @@ HEADER = $(addprefix $(INCLUDE_DIR)/,$(HEADER_FILES))
all: make_build_dirs $(NAME)
+.PHONY: test
+test:
+ @$(MAKE) $(MAKE_ARGS) -C $(TEST_DIR) run_raw
+
make_build_dirs:
@for dir in $$(find $(SRC_DIR)/* $(FIND_ARGS) -type d | \
sed 's_$(SRC_DIR)/_$(BUILD_DIR)/_g'); \
@@ -73,7 +77,6 @@ clean:
@echo "Removing objects"
@$(RM) -r $(BUILD_DIR)
-
fclean: clean
@echo "Removing library"
@$(RM) $(NAME)