2024-04-20 01:11:24 +00:00
|
|
|
SHELL := /bin/bash
|
|
|
|
|
2024-04-15 19:22:58 +00:00
|
|
|
CFLAGS ?= -Wall -g
|
2024-04-16 12:03:12 +00:00
|
|
|
GDBRUN = gdb --batch --ex run --ex bt --ex q --args
|
2024-04-19 12:14:39 +00:00
|
|
|
BUILD_TARGETS = $(foreach ex,$(wildcard ex*.c),$(subst .c,,$(ex)))
|
2024-04-15 19:22:58 +00:00
|
|
|
|
2024-04-15 23:59:15 +00:00
|
|
|
.PHONY: all
|
|
|
|
all: build test
|
2024-04-15 19:16:14 +00:00
|
|
|
|
2024-04-19 12:14:39 +00:00
|
|
|
.PHONY: echo
|
|
|
|
echo:
|
|
|
|
@echo BUILD_TARGETS=$(BUILD_TARGETS)
|
|
|
|
|
2024-04-15 23:59:15 +00:00
|
|
|
.PHONY: clean
|
2024-04-15 19:16:14 +00:00
|
|
|
clean:
|
2024-04-16 12:03:12 +00:00
|
|
|
rm -f $(BUILD_TARGETS)
|
2024-04-15 19:22:58 +00:00
|
|
|
|
2024-04-15 23:59:15 +00:00
|
|
|
.PHONY: build
|
2024-04-16 12:03:12 +00:00
|
|
|
build: $(BUILD_TARGETS)
|
|
|
|
|
|
|
|
.PHONY: gtest
|
2024-04-20 01:51:42 +00:00
|
|
|
gtest: $(BUILD_TARGETS)
|
2024-04-20 01:26:19 +00:00
|
|
|
@$(foreach bt, $(BUILD_TARGETS), make .gtest.$(bt) &&) printf '\ngYAY\n'
|
2024-04-15 23:59:15 +00:00
|
|
|
|
2024-04-20 01:51:42 +00:00
|
|
|
.gtest.%: %
|
2024-04-20 01:11:24 +00:00
|
|
|
@if test -f .$*.argv; then readarray -t test_argv <.$*.argv; fi && \
|
|
|
|
printf '\n==> %s\n' "$*" && $(GDBRUN) ./$* "$${test_argv[@]}"
|
2024-04-18 22:49:10 +00:00
|
|
|
|
2024-04-15 23:59:15 +00:00
|
|
|
.PHONY: test
|
2024-04-20 01:51:42 +00:00
|
|
|
test: $(BUILD_TARGETS)
|
2024-04-20 01:26:19 +00:00
|
|
|
@$(foreach bt, $(BUILD_TARGETS), make .test.$(bt) &&) printf '\nYAY\n'
|
2024-04-18 22:49:10 +00:00
|
|
|
|
2024-04-20 01:51:42 +00:00
|
|
|
.test.%: %
|
2024-04-20 01:11:24 +00:00
|
|
|
@if test -f .$*.argv; then readarray -t test_argv <.$*.argv; fi && \
|
|
|
|
printf '\n==> %s\n' "$*" && ./$* "$${test_argv[@]}"
|