1# Makefile for easy-tls example application (rudimentary client and server) 2# $Id: Makefile,v 1.2 2001/09/18 09:15:40 bodo Exp $ 3 4SOLARIS_CFLAGS=-Wall -pedantic -g -O2 5SOLARIS_LIBS=-lxnet 6 7LINUX_CFLAGS=-Wall -pedantic -g -O2 8LINUX_LIBS= 9 10 11auto-all: 12 case `uname -s` in \ 13 SunOS) echo Using SunOS configuration; \ 14 make SYSCFLAGS="$(SOLARIS_CFLAGS)" SYSLIBS="$(SOLARIS_LIBS)" all;; \ 15 Linux) echo Using Linux configuration; \ 16 make SYSCFLAGS="$(LINUX_CFLAGS)" SYSLIBS="$(LINUX_LIBS)" all;; \ 17 *) echo "unknown system"; exit 1;; \ 18 esac 19 20all: test TAGS 21 22# For adapting this Makefile to a different system, only the following 23# definitions should need customizing: 24 25OPENSSLDIR=../.. 26CC=gcc 27 28SYSCFLAGS=whatever 29SYSLIBS=whatever 30 31 32############################################################################# 33# 34# SSLeay/OpenSSL imports 35# 36# OPENSSLDIR (set above) can be either the directory where OpenSSL is 37# installed or the directory where it was compiled. 38 39# We rely on having a new OpenSSL release where include files 40# have names like <openssl/ssl.h> (not just <ssl.h>). 41OPENSSLINCLUDES=-I$(OPENSSLDIR)/include 42 43# libcrypto.a and libssl.a are directly in $(OPENSSLDIR) if this is 44# the compile directory, or in $(OPENSSLDIR)/lib if we use an installed 45# library. With the following definition, we can handle either case. 46OPENSSLLIBS=-L$(OPENSSLDIR) -L$(OPENSSLDIR)/lib -lssl -lcrypto 47 48 49############################################################################# 50# 51# Stuff for handling the source files 52# 53 54SOURCES=easy-tls.c test.c 55HEADERS=easy-tls.h test.h 56DOCSandEXAMPLESetc=Makefile cert.pem cacerts.pem 57EVERYTHING=$(SOURCES) $(HEADERS) $(DOCSandEXAMPLESetc) 58 59ls: ls-l 60ls-l: 61 ls -l $(EVERYTHING) 62# For RCS: 63tag: 64 -rcs -n_`date +%y%m%d`: $(EVERYTHING) 65 rcs -nMYTAG $(EVERYTHING) 66 rcs -nMYTAG: $(EVERYTHING) 67diff: 68 -rcsdiff -rMYTAG -u $(EVERYTHING) 69today: 70 -rcsdiff -r_`date +%y%m%d` -u $(EVERYTHING) 71ident: 72 for a in $(EVERYTHING); do ident $$a; done 73 74# Distribution .tar: 75easy-tls.tar.gz: $(EVERYTHING) 76 tar cvf - $(EVERYTHING) | \ 77 gzip -9 > easy-tls.tar.gz 78 79# Working .tar: 80tls.tgz: $(EVERYTHING) 81 tar cfv - `find . -type f -a ! -name '*.tgz' -a ! -name '*.tar.gz'` | \ 82 gzip -9 > tls.tgz 83 84# For emacs: 85etags: TAGS 86TAGS: $(SOURCES) $(HEADERS) 87 -etags $(SOURCES) $(HEADERS) 88 89 90############################################################################# 91# 92# Compilation 93# 94# The following definitions are system dependent (and hence defined 95# at the beginning of this Makefile, where they are more easily found): 96 97### CC=gcc 98### SYSCFLAGS=-Wall -pedantic -g -O2 99### SYSLIBS=-lxnet 100 101EXTRACFLAGS=-DTLS_APP=\"test.h\" 102# EXTRACFLAGS=-DTLS_APP=\"test.h\" -DDEBUG_TLS 103 104# 105# The rest shouldn't need to be touched. 106# 107LDFLAGS=$(SYSLIBS) $(OPENSSLLIBS) 108INCLUDES=$(OPENSSLINCLUDES) 109CFLAGS=$(SYSCFLAGS) $(EXTRACFLAGS) $(INCLUDES) 110 111OBJS=easy-tls.o test.o 112 113clean: 114 @rm -f test 115 @rm -f TAGS 116 @rm -f *.o 117 @rm -f core 118 119test: $(OBJS) 120 $(CC) $(OBJS) $(LDFLAGS) -o test 121 122test.o: $(HEADERS) 123easy-tls.o: $(HEADERS) 124