aboutsummaryrefslogtreecommitdiffstats
path: root/demos/digest
diff options
context:
space:
mode:
authorslontis <shane.lontis@oracle.com>2023-03-20 15:08:38 +1000
committerMatt Caswell <matt@openssl.org>2023-10-25 09:21:07 +0100
commit66f4782f1452d6fbfab78822b340a99aaeacc2f0 (patch)
tree063d3ad8628b8b10260b4316531f78de9d83b0c1 /demos/digest
parentdbbdb940d421daca4a65e765b5244bde6aed3f61 (diff)
downloadopenssl-66f4782f1452d6fbfab78822b340a99aaeacc2f0.tar.gz
Create hierarchical demo Makefile.
Adds a Makefile with all, clean, and test targets. This has only been added for demos that already contain Makefiles. For problematic tests that require inputs, the test target does nothing. (Note: Demos should be self contained and not require unknown external inputs. This PR does not attempt to fix this.) Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/20546)
Diffstat (limited to 'demos/digest')
-rw-r--r--demos/digest/Makefile15
1 files changed, 12 insertions, 3 deletions
diff --git a/demos/digest/Makefile b/demos/digest/Makefile
index 0bfb6dd5f0..d72a9d095b 100644
--- a/demos/digest/Makefile
+++ b/demos/digest/Makefile
@@ -7,7 +7,9 @@ CFLAGS = -I../../include -g -Wall
LDFLAGS = -L../..
LDLIBS = -lcrypto
-all: EVP_MD_demo EVP_MD_stdin EVP_MD_xof BIO_f_md
+TESTS=EVP_MD_demo EVP_MD_stdin EVP_MD_xof BIO_f_md
+
+all: $(TESTS)
%.o: %.c
$(CC) $(CFLAGS) -c $<
@@ -17,7 +19,14 @@ EVP_MD_stdin: EVP_MD_stdin.o
EVP_MD_xof: EVP_MD_xof.o
BIO_f_md: BIO_f_md.o
-test: ;
+.PHONY: test
+# Since some of these tests use stdin we use the source file as stdin when running the exes
+test: all
+ @echo "\nDigest tests:"
+ @set -e; for tst in $(TESTS); do \
+ echo "\n"$$tst; \
+ cat $$tst.c | ./$$tst; \
+ done
clean:
- $(RM) *.o EVP_MD_demo EVP_MD_stdin EVP_MD_xof BIO_f_md
+ $(RM) *.o $(TESTS)