I can't generate dependencies automatically like on line 20 in the
makefile below because the variable $@ does not yet exist at that
point. How could I overcome this problem? "pattern rule redefinition"
as in the manual, section 10.5 is also not the solution, as I don't
have any "%", but specific files.

Makefile:
1 MAKEFLAGS = -s
2 CFLAGS = -Wall
3 CC = gcc
4 #Used for releases: RM = rm -f
5 RM = rm
6
7 #directories' section, more to come
8 DIR_TESTS = tests/
9
10 #We may want to specify the tests manually in order to have an "incremental"
11 #error reporting. This would help for better bug hunting and overview.
12 #However, we are ok with this for now.
13 TEST_SRCS = $(wildcard encryption/*.c) $(wildcard $(DIR_TESTS)*.c)
14 TESTS = $(TEST_SRCS:.c=)
15
16 .PHONY: tests
17 tests: $(TESTS)
18 $(eval tests_output = $(foreach test,$(addprefix
$(DIR_TESTS),$(?F)),$(shell echo "\tRUNNING TEST: $(test)\n"; $(test)
| sed -e 's/$$/\\N/g')))
19 echo -e '$(tests_output)' | sed -r -e 's/\\N/\n/g'
20 $(TESTS): $(shell $(CC) -MM -DHAVE_MAIN $@.c | sed 's/.*: //g')
21 echo "DEPS: " $(shell $(CC) -MM -DHAVE_MAIN $@.c | sed 's/.*: //g')
22 $(CC) $(CFLAGS) -DHAVE_MAIN -o $(DIR_TESTS)$(@F) $@.c
23
24 .PHONY: clean
25 clean:
26 $(RM) $(foreach test,$(TESTS),$(DIR_TESTS)$(notdir $(test)))

How would you improve this simple makefile and why?

Regards,
Flavius.