mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
51 lines
1.1 KiB
Makefile
51 lines
1.1 KiB
Makefile
# make gets confused if a file with the same name exists in the sources, so some
|
|
# file are prefixed with test_
|
|
rawtests = \
|
|
quote_removal \
|
|
metacharacters \
|
|
parse_pipelines \
|
|
parse_simple_cmds \
|
|
test_env_manip \
|
|
word_splitting \
|
|
|
|
ifeq ($(CFLAGS),)
|
|
CFLAGS = -Wall -Wextra -Werror -g
|
|
endif
|
|
tests = $(addprefix test_,$(rawtests))
|
|
run_tests = $(addprefix run_test_,$(rawtests))
|
|
test_objs = $(addsuffix .o,$(tests))
|
|
objs := $(addprefix ../,$(objs)) testutil.o
|
|
all_objs = $(objs) $(test_objs)
|
|
deps = $(all_objs:.o=.d)
|
|
LDLIBS = \
|
|
-lreadline \
|
|
-lft
|
|
LIBFTDIR = ../libft/
|
|
LIBFT = $(LIBFTDIR)libft.a
|
|
IFLAGS = -I$(LIBFTDIR)
|
|
LINCLUDE = -L$(LIBFTDIR)
|
|
|
|
.PHONY: run fclean run_test_%
|
|
|
|
.NOTPARALLEL: run
|
|
run: $(run_tests)
|
|
@echo "Finished running C tests"
|
|
|
|
-include $(deps)
|
|
|
|
%.o: %.c
|
|
$(CC) -c $(CFLAGS) $(IFLAGS) -o $*.o $*.c
|
|
$(CC) -MM $(CFLAGS) $(IFLAGS) $*.c > $*.d
|
|
|
|
test_%: %.o $(objs)
|
|
$(CC) $(CFLAGS) -o $@ $*.o $(objs) $(LINCLUDE) $(LDLIBS)
|
|
|
|
run_test_%: test_%
|
|
@echo
|
|
@echo "====== Now running test: $* ======"
|
|
@echo
|
|
./test_$*
|
|
@echo "====== End of test: $* ======"
|
|
|
|
fclean:
|
|
rm -f $(tests)
|