6 uname_S
:= $(shell sh
-c
'uname -s 2>/dev/null || echo no')
16 HDRS
= $(wildcard ..
/src
/*.h
)
17 PUBLIC_HEADERS
= $(wildcard ..
/src
/git
/*.h
)
18 HDRS
+= $(PUBLIC_HEADERS
)
20 TEST_OBJ
= $(patsubst %.c
,%.o
,\
21 $(wildcard t
[0-9][0-9][0-9][0-9]-*.c
))
22 TEST_EXE
= $(patsubst %.o
,%.exe
,$(TEST_OBJ
))
23 TEST_RUN
= $(patsubst %.exe
,%.run
,$(TEST_EXE
))
26 EXTRA_LIBS
+= $(CRYPTO_LIB
)
29 BASIC_CFLAGS
:= -I..
/src
31 ALL_CFLAGS
= $(CFLAGS
) $(BASIC_CFLAGS
)
44 $(CC
) $(ALL_CFLAGS
) -c
$< -o
$@
46 T_HDR
= test_lib.h test_helpers.h
47 T_LIB
= test_lib.o test_helpers.o
48 T_MAIN_C
= test_main.c
50 $(T_LIB
): $(T_HDR
) $(HDRS
)
51 $(TEST_OBJ
): $(T_HDR
) $(HDRS
)
53 $(patsubst %.exe
,%.toc
,$(TEST_EXE
)): %.toc
: %.c
54 grep BEGIN_TEST
$< >$@
+
58 $(CC
) $(ALL_CFLAGS
) -c
$< -o
$@
60 $(patsubst %.exe
,%_main.o
,$(TEST_EXE
)): %_main.o
: $(HDRS
)
61 $(patsubst %.exe
,%_main.o
,$(TEST_EXE
)): %_main.o
: $(T_MAIN_C
)
62 $(patsubst %.exe
,%_main.o
,$(TEST_EXE
)): %_main.o
: %.toc
63 $(CC
) $(ALL_CFLAGS
) '-DTEST_TOC="$<"' \
67 $(TEST_EXE
): %.exe
: $(T_LIB
)
68 $(TEST_EXE
): %.exe
: %.o
%_main.o
70 $(patsubst %.exe
,%_main.o
,$@
) \
71 $(patsubst %.exe
,%.o
,$@
) \
74 $(TEST_RUN
): %.run
: %.exe
77 if
(cd
$$t && ..
/$<); \
79 else rmdir
$$t; exit
1; \
84 .PHONY
: test $(TEST_RUN
)