Debian Codegraph @

Makefile

raw ◀ ▶
1 Debian patch touch this file
1 top_srcdir=.
2 stagedir=$(shell pwd)
3 package=canl-c
4 PREFIX=
5 prefix=/usr
6 libdir=lib
7
8 default: all
9
10 -include Makefile.inc
11 -include ${top_srcdir}/project/version.properties
12
13 version=${module.version}
14 docdir?=${prefix}/share/doc/${package}-${version}
15
16 VPATH=${top_srcdir}/src/:${top_srcdir}/src/proxy/:${top_srcdir}/examples:${top_srcdir}/doc/src
17 KPATH = TEXINPUTS=".:${top_srcdir}/doc/src//:"
18 KPATHBIB = BIBINPUTS=".:$(VPATH)//:"
19 LIBCARES_LIBS?=-lcares
20 LIBSSL_LIBS?=-lssl -lcrypto
21 LIBDL_LIBS?=-ldl
22
23 CC=gcc
24 YACC=bison -y
25 LEX=flex
26 PDFLATEX = $(KPATH) pdflatex
27 BIBTEX = $(KPATHBIB) bibtex
28
29 COMPILE=libtool --mode=compile ${CC} ${CFLAGS}
30 LINK=libtool --mode=link ${CC} ${LDFLAGS}
31 INSTALL=libtool --mode=install install
32
33 SOURCES=\
34 doc/src/*.cls doc/src/*.tex doc/src/images/*.pdf \
35 examples/*.c \
36 src/canl_error_* src/*.c src/*.h src/*.pl \
37 src/proxy/*.c src/proxy/*.h src/proxy/*.in src/proxy/*.y src/proxy/*.l \
38 Makefile README
39 SOURCES_EXEC=src/*.pl
40
41 CFLAGS_LIB=-fPIC -I${top_srcdir}/src ${LIBCARES_CFLAGS} ${LIBSSL_CFLAGS} -I.
42 LFLAGS_LIB=${LIBCARES_LIBS} ${LIBSSL_LIBS} ${LIBDL_LIBS} -lpthread
43
44 CFLAGS_CLI=-I${top_srcdir}/src -I.
45 LFLAGS_CLI=-L. -lcanl_c
46
47 CFLAGS_SER=-Wall -g -I${top_srcdir}/src -I.
48 LFLAGS_SER=-L. -lcanl_c
49
50 CFLAGS_PRX=-Wall -g -I${top_srcdir}/src -I.
51 LFLAGS_PRX=-L. -lcanl_c
52
53 CFLAGS_DEL=-Wall -g -I${top_srcdir}/src -I.
54 LFLAGS_DEL=-L. -lcanl_c -lcrypto
55
56 HEAD_CANL=canl.h canl_locl.h canl_err.h canl_cred.h canl_ssl.h canl_mech_ssl.h canl_ocsp.h
57
58 SRC_CLI=canl_sample_client.c
59 HEAD_CLI=canl.h
60 OBJ_CLI=canl_sample_client.lo
61
62 SRC_SER=canl_sample_server.c
63 HEAD_SER=canl.h
64 OBJ_SER=canl_sample_server.lo
65
66 SRC_PRX=grid-proxy-init.c
67 HEAD_PRX=canl.h canl_cred.h
68 OBJ_PRX=canl_proxy_init.lo
69
70 SRC_DEL=delegation.c
71 HEAD_DEL=canl.h canl_cred.h
72 OBJ_DEL=canl_delegation.lo
73
74 CFLAGS:=-Wall -g -I${top_srcdir}/src/proxy -I. ${CFLAGS}
75
76 LIBCANL=libcanl_c.la
77
78 # In order to use libtool versioning correcty, we must have:
79 #
80 # current = major + minor + offset
81 # revision = patch
82 # age = minor
83 #
84 # where offset is a sum of maximal released minor's of all previous major's
85 #
86 # counted minors: 1.0, 2.1
87 offset=1
88 version_info:=-version-info ${shell \
89 perl -e '$$,=":"; @F=split "\\.","${version}"; print $$F[0]+$$F[1]+${offset},$$F[2],$$F[1]' }
90 major:=${shell \
91 perl -e '$$,=":"; @F=split "\\.","${version}"; print $$F[0]+$$F[1]+${offset}' }
92
93 all: ${LIBCANL} server client proxy delegation doc
94
95 doc: canl.pdf
96
97 ${LIBCANL}:\
98 canl_err_desc.lo canl.lo canl_err.lo canl_dns.lo canl_ssl.lo \
99 canl_cert.lo canl_cred.lo canl_ocsp.lo\
100 doio.lo evaluate.lo list.lo normalize.lo \
101 scutils.lo sslutils.lo data.lo namespaces_parse.lo namespaces_lex.lo\
102 signing_policy_parse.lo signing_policy_lex.lo
103 ${LINK} -rpath ${stagedir}${prefix}/${libdir} ${version_info} $+ ${LFLAGS_LIB} -o $@
104
105 %.c: %.y
106 -mkdir $*
107 (cd $*; \
108 ${YACC} -d ${YFLAGS} ../$< && \
109 mv y.tab.c ../$*.c && \
110 mv y.tab.h ../$*.h)
111 rm -r $*
112
113 %.c: %.l
114 # ${LEX} -t $< > $@
115 cp `echo $< | sed -e 's/\.l$$/.c.in/'` $@
116
•117 namespaces_lex.c: namespaces_parse.h
118 signing_policy_lex.c: signing_policy_parse.h
119 namespaces_parse.h: namespaces_parse.c
120 signing_policy_parse.h: signing_policy_parse.c
121
122 %.lo: %.c ${HEAD_CANL}
123 ${COMPILE} -c $< ${CFLAGS_LIB} -o $@
124
125 %.pdf: %.tex
126 $(PDFLATEX) $<
127 # $(BIBTEX) `basename $< .tex`
128 $(PDFLATEX) $<
129 $(PDFLATEX) $<
130
131 canl.tex: ver.tex
132
133 client: ${OBJ_CLI}
134 ${LINK} $< ${LFLAGS_CLI} -o $@
135
136 ${OBJ_CLI}: ${SRC_CLI} ${HEAD_CLI} ${LIBCANL}
137 ${COMPILE} -c ${top_srcdir}/examples/${SRC_CLI} ${CFLAGS_CLI} -o $@
138
139 server: ${OBJ_SER}
140 ${LINK} $< ${LFLAGS_SER} -o $@
141
142 ${OBJ_SER}: ${SRC_SER} ${HEAD_SER} ${LIBCANL}
143 ${COMPILE} -c ${top_srcdir}/examples/${SRC_SER} ${CFLAGS_SER} -o $@
144
145 proxy: ${OBJ_PRX}
146 ${LINK} $< ${LFLAGS_PRX} -o $@
147
148 ${OBJ_PRX}: ${SRC_PRX} ${HEAD_PRX} ${LIBCANL}
149 ${COMPILE} -c ${top_srcdir}/examples/${SRC_PRX} ${CFLAGS_PRX} -o $@
150
151 delegation: ${OBJ_DEL}
152 ${LINK} $< ${LFLAGS_DEL} -o $@
153
154 ${OBJ_DEL}: ${SRC_DEL} ${HEAD_DEL} ${LIBCANL}
155 ${COMPILE} -c ${top_srcdir}/examples/${SRC_DEL} ${CFLAGS_DEL} -o $@
156
157 canl_err.h: canl_error_codes
158 ${top_srcdir}/src/gen_err_codes.pl < $^ > $@
159
160 canl_err_desc.c: canl_error_codes canl_error_desc
161 ${top_srcdir}/src/gen_err_desc.pl $^ > $@
162
163 ver.tex:
164 printf "\134def\134version{${version}}\n" > ver.tex
165
166 check:
167
168 install: all
169 mkdir -p ${DESTDIR}${PREFIX}${prefix}/bin
170 mkdir -p ${DESTDIR}${PREFIX}${prefix}/${libdir}
171 mkdir -p ${DESTDIR}${PREFIX}${prefix}/include
172 mkdir -p ${DESTDIR}${PREFIX}${docdir}
173 ${INSTALL} -m 755 server ${DESTDIR}${PREFIX}${prefix}/bin/emi-canl-server
174 ${INSTALL} -m 755 client ${DESTDIR}${PREFIX}${prefix}/bin/emi-canl-client
175 ${INSTALL} -m 755 proxy \
176 ${DESTDIR}${PREFIX}${prefix}/bin/emi-canl-proxy-init
177 ${INSTALL} -m 755 delegation \
178 ${DESTDIR}${PREFIX}${prefix}/bin/emi-canl-delegation
179 ${INSTALL} -m 755 ${LIBCANL} ${DESTDIR}${PREFIX}${prefix}/${libdir}
180 ${INSTALL} -m 644 ${top_srcdir}/src/canl.h \
181 ${top_srcdir}/src/canl_ssl.h canl_err.h \
182 ${top_srcdir}/src/canl_cred.h \
183 ${DESTDIR}${PREFIX}${prefix}/include
184 ${INSTALL} -m 644 canl.pdf ${DESTDIR}${PREFIX}${docdir}
185 ${INSTALL} -m 644 README ${DESTDIR}${PREFIX}${docdir}
186
187 stage: all
188 $(MAKE) install PREFIX=${stagedir}
189
190 clean:
191 rm -rfv *.o *.lo ${LIBCANL} .libs client server proxy delegation \
192 *.c *.h lex.backup stage \
193 canl.aux canl.log canl.pdf canl.out canl.toc ver.tex \
194 canl.bbl canl.blg
195 rm -rvf dist ${package}-*.tar.gz
196
197 distclean:
198 rm -rvf Makefile.inc config.status project/changelog *.spec debian/
199
200 .PHONY: default all doc check install stage clean distclean dist distcheck