summaryrefslogtreecommitdiff
path: root/lib/libkeynote/Makefile.distribution
blob: 6be3e12d2f169f704ba292324a4e93357d8ee773 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# $OpenBSD: Makefile.distribution,v 1.3 1999/05/31 18:29:17 angelos Exp $
#
# The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
#
# This code was written by Angelos D. Keromytis in Philadelphia, PA, USA,
# in April-May 1998
#
# Copyright (C) 1998, 1999 by Angelos D. Keromytis.
#	
# Permission to use, copy, and modify this software without fee
# is hereby granted, provided that this entire notice is included in
# all copies of any software which is or includes a copy or
# modification of this software. 
#
# THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO
# REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
# MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
# PURPOSE.

VERSION = 2-beta2
DISTFILE = keynote-${VERSION}.tar.gz
KNSUBDIR = KeyNote-${VERSION}

RANLIB = ranlib
MKDIR = mkdir
YACC = yacc
#YACC = bison
TRUE = true
LEX = flex
TAR = tar
CC = gcc
RM = rm
AR = ar
NROFF = nroff

TARFLAGS = -cvzf ${DISTFILE}
YACCFLAGS2 = -d -p kv -b z
YACCFLAGS = -d -p kn -b k
LEXFLAGS2 = -Pkv -s -i
LEXFLAGS = -Cr -Pkn -s -i
CFLAGS = -O2 -Wall # -g
RMFLAGS2 = -rf
RMFLAGS = -f
NROFFFLAGS = -mandoc

# SSLeay/OpenSSL pointers
SSLINC = -I/usr/local/include -I/usr/local/ssl/include \
	 -I/usr/local/openssl/include
SSLLIB = -L/usr/lib -L/usr/local/lib -L/usr/local/ssl/lib \
	 -L/usr/local/openssl/lib -L/usr/local/openssl/ -lcrypto

# No-crypto compile/link flags and definitions
NOCRYPTODEFS = #-DPGPLIB -DNO_SNPRINTF -DNEED_GETOPT -DPILOT
NOCRYPTOINC = -I.
NOCRYPTOLIBS = -L. -lkeynote -lm

# Final compile/link flags and definitions
DEFS = -DCRYPTO ${NOCRYPTODEFS}
INC = $(SSLINC) ${NOCRYPTOINC}
LIBS = ${NOCRYPTOLIBS} ${SSLLIB}

TARGET = libkeynote.a
TARGET2 = keynote

#GETOPT = getopt.o
OBJS = k.tab.o lex.kn.o environment.o parse_assertion.o \
	signature.o aux.o base64.o $(GETOPT)
OBJS2 = z.tab.o lex.kv.o keynote-verify.o keynote-sign.o keynote-sigver.o \
	keynote-keygen.o keynote-main.o

crypto: all

nocrypto:
	${MAKE} LIBS="${NOCRYPTOLIBS}" INC="${NOCRYPTOINC}" \
		DEFS="${NOCRYPTODEFS}"

all: $(TARGET) $(TARGET2)

library: $(TARGET)

$(TARGET): $(OBJS)
	$(AR) -cvr $(TARGET) $(OBJS)
	$(RANLIB) $(TARGET)

$(TARGET2): $(TARGET) $(OBJS2)
	$(CC) $(CFLAGS) -o $(TARGET2) $(OBJS2) $(LIBS)

k.tab.c: keynote.y environment.h signature.h
	$(YACC) $(YACCFLAGS) keynote.y

z.tab.c: keynote-ver.y keynote.h
	$(YACC) $(YACCFLAGS2) keynote-ver.y

lex.kn.c: keynote.l k.tab.h environment.h assertion.h signature.h
	$(LEX) $(LEXFLAGS) keynote.l

lex.kv.c: keynote-ver.l z.tab.h keynote.h
	$(LEX) $(LEXFLAGS2) keynote-ver.l

.c.o:
	$(CC) $(CFLAGS) $(DEFS) $(INC) -c $<

aux.c: environment.h signature.h
parse_assertion.c: assertion.h environment.h signature.h
environment.c: environment.h
keynote-verify.c: keynote.h
environment.h: keynote.h
assertion.h: keynote.h
signature.h: assertion.h
signature.c: signature.h
keynote-keygen.c: signature.h
keynote-sign.c: signature.h
keynote-sigver.c: signature.h
base64.c: keynote.h

clean:
	$(RM) $(RMFLAGS) $(OBJS) $(OBJS2) a.out *.core *~ */*~

cleandir: cleanall

cleanall: clean
	$(RM) $(RMFLAGS) *.o k.tab.c lex.kn.c k.tab.h z.tab.c z.tab.h
	$(RM) $(RMFLAGS) lex.kv.c y.output z.output ${DISTFILE}
	$(RM) $(RMFLAGS) $(TARGET) $(TARGET2) man/*.0

test: all
	./$(TARGET2) verify -e testsuite/test-env \
		-r false,maybe,probably,true \
		-k testsuite/auth1 -k testsuite/auth2 -k testsuite/auth3 \
		-k testsuite/auth4 \
		-l testsuite/test-assertion1 -l testsuite/test-assertion2 \
		-l testsuite/test-assertion3 -l testsuite/test-assertion4 \
		-l testsuite/test-assertion5 -l testsuite/test-assertion6 \
		-l testsuite/test-assertion7 || ${TRUE}

manpages: mankeynote mansystem manutility

mankeynote:
	${NROFF} ${NROFFFLAGS} man/keynote.3 > man/keynote-library.0

mansystem:
	${NROFF} ${NROFFFLAGS} man/keynote.4 > man/keynote-system.0

manutility:
	${NROFF} ${NROFFFLAGS} man/keynote.1 > man/keynote-utility.0

distribution: test cleanall manpages
	${MKDIR} ${KNSUBDIR}
	$(TAR) cf - . | (cd ${KNSUBDIR}; ${TAR} xf -)
	${RM} ${RMFLAGS2} ${KNSUBDIR}/CVS ${KNSUBDIR}/testsuite/CVS \
			  ${KNSUBDIR}/Misc/CVS ${KNSUBDIR}/${KNSUBDIR} \
			  ${KNSUBDIR}/.cvsignore ${KNSUBDIR}/man/CVS \
			  ${KNSUBDIR}/man/.cvsignore ${KNSUBDIR}/doc/CVS
	$(TAR) $(TARFLAGS) ${KNSUBDIR}
	${RM} ${RMFLAGS2} ${KNSUBDIR}