diff options
author | James Muir <james@openssl.org> | 2023-11-10 20:02:00 +0100 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2023-11-15 08:43:23 +0100 |
commit | 86db958835d1f8ba9ce49a9f93b5309c3d13b91c (patch) | |
tree | 39e47920c615243afc3dd7df206a54ec05fa1045 /demos/bio | |
parent | Import repro from #22708 as a test case (diff) | |
download | openssl-86db958835d1f8ba9ce49a9f93b5309c3d13b91c.tar.xz openssl-86db958835d1f8ba9ce49a9f93b5309c3d13b91c.zip |
demos: tidy up makefiles, fix warnings
Update makefiles so that consistent patterns are used. Object files
are compiled from source using an implicit rule (but using our
CFLAGS); for linking, we give an explicit rule. Ensure that "make
test" works in each subdirectory (even if it does not actually run any
applications). The top-level demo makefile now works.
The makefiles are not make-agnostic. e.g. they use the variable $(RM)
in "clean" recipes, which is defined in gnu-make but may not be
defined in others.
Part of #17806
Testing:
$ cd demo
$ make test
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22698)
Diffstat (limited to 'demos/bio')
-rw-r--r-- | demos/bio/Makefile | 38 | ||||
-rw-r--r-- | demos/bio/sconnect.c | 1 |
2 files changed, 20 insertions, 19 deletions
diff --git a/demos/bio/Makefile b/demos/bio/Makefile index ca4dee851f..5171e75e59 100644 --- a/demos/bio/Makefile +++ b/demos/bio/Makefile @@ -1,24 +1,22 @@ -# Quick instruction: -# To build against an OpenSSL built in the source tree, do this: # -# make OPENSSL_INCS_LOCATION=-I../../include OPENSSL_LIBS_LOCATION=-L../.. -# -# To run the demos when linked with a shared library (default): +# To run the demos when linked with a shared library (default) ensure that +# libcrypto and libssl are on the library path. For example: # # LD_LIBRARY_PATH=../.. ./server-arg -# LD_LIBRARY_PATH=../.. ./server-cmod -# LD_LIBRARY_PATH=../.. ./server-conf -# LD_LIBRARY_PATH=../.. ./client-arg -# LD_LIBRARY_PATH=../.. ./client-conf -# LD_LIBRARY_PATH=../.. ./saccept -# LD_LIBRARY_PATH=../.. ./sconnect -CFLAGS = $(OPENSSL_INCS_LOCATION) -LDFLAGS = $(OPENSSL_LIBS_LOCATION) -lssl -lcrypto $(EX_LIBS) +TESTS = client-arg \ + client-conf \ + saccept \ + sconnect \ + server-arg \ + server-cmod \ + server-conf -all: client-arg client-conf saccept sconnect server-arg server-cmod server-conf +CFLAGS = -I../../include -g -Wall +LDFLAGS = -L../.. +LDLIBS = -lssl -lcrypto -test: +all: $(TESTS) client-arg: client-arg.o client-conf: client-conf.o @@ -28,8 +26,12 @@ server-arg: server-arg.o server-cmod: server-cmod.o server-conf: server-conf.o -client-arg client-conf saccept sconnect server-arg server-cmod server-conf: - $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) +$(TESTS): + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS) clean: - $(RM) *.o client-arg client-conf saccept sconnect server-arg server-cmod server-conf + $(RM) $(TESTS) *.o + +test: all + @echo "\nBIO tests:" + @echo "skipped" diff --git a/demos/bio/sconnect.c b/demos/bio/sconnect.c index 18f7007ce7..ef0787c30e 100644 --- a/demos/bio/sconnect.c +++ b/demos/bio/sconnect.c @@ -30,7 +30,6 @@ int main(int argc, char *argv[]) const char *hostport = HOSTPORT; const char *CAfile = CAFILE; const char *hostname; - char *cp; BIO *out = NULL; char buf[1024 * 10], *p; SSL_CTX *ssl_ctx = NULL; |