ksgi
/
Makefile
601 строка · 17.7 Кб
1.SUFFIXES: .3 .3.html .8 .8.html .dot .svg .xml .html .in.pc .pc
2.PHONY: regress afl
3
4include Makefile.configure
5
6# Uncomment this to disable -static linking.
7# This is set to -static only for supporting systems.
8# This is only for the sample program!
9
10#LDADD_STATIC =
11
12# If running Linux and seccomp is causing issues, cause violators to trap and
13# output a debug message instead of just failing. This is disabled by default
14# so that violations are properly killed instead of providing an escape hatch.
15#CPPFLAGS += -DSANDBOX_SECCOMP_DEBUG
16
17# You probably don't need to change anything else...
18
19WWWDIR = /var/www/vhosts/kristaps.bsd.lv/htdocs/kcgi
20DATADIR = $(SHAREDIR)/kcgi
21TXMLS = tutorial0.xml \
22tutorial1.xml \
23tutorial2.xml \
24tutorial3.xml \
25tutorial4.xml \
26tutorial5.xml \
27tutorial6.xml
28PCS = kcgi.pc \
29kcgi-html.pc \
30kcgi-json.pc \
31kcgi-regress.pc \
32kcgi-xml.pc
33THTMLS = tutorial0.html \
34tutorial1.html \
35tutorial2.html \
36tutorial3.html \
37tutorial4.html \
38tutorial5.html \
39tutorial6.html
40SBLGS = archive.html \
41index.html \
42sample.c.html \
43samplepp.cc.html
44MAN3DIR = $(MANDIR)/man3
45MAN8DIR = $(MANDIR)/man8
46VMAJOR != grep 'define KCGI_VMAJOR' kcgi.h | cut -f3
47VMINOR != grep 'define KCGI_VMINOR' kcgi.h | cut -f3
48VBUILD != grep 'define KCGI_VBUILD' kcgi.h | cut -f3
49VERSION := $(VMAJOR).$(VMINOR).$(VBUILD)
50LIBVER = 1
51LIBOBJS = auth.o \
52child.o \
53datetime.o \
54fcgi.o \
55httpauth.o \
56kcgi.o \
57logging.o \
58output.o \
59parent.o \
60sandbox.o \
61sandbox-capsicum.o \
62sandbox-darwin.o \
63sandbox-pledge.o \
64sandbox-seccomp-filter.o \
65template.o \
66wrappers.o
67MAN3S = man/kcgi.3 \
68man/kcgihtml.3 \
69man/kcgijson.3 \
70man/kcgiregress.3 \
71man/kcgixml.3 \
72man/kcgi_buf_printf.3 \
73man/kcgi_buf_putc.3 \
74man/kcgi_buf_puts.3 \
75man/kcgi_buf_write.3 \
76man/kcgi_writer_disable.3 \
77man/kcgi_writer_free.3 \
78man/kcgi_writer_get.3 \
79man/kcgi_writer_putc.3 \
80man/kcgi_writer_puts.3 \
81man/kcgi_writer_write.3 \
82man/kcgi_strerror.3 \
83man/khtml_attr.3 \
84man/khtml_close.3 \
85man/khtml_closeelem.3 \
86man/khtml_closeto.3 \
87man/khtml_double.3 \
88man/khtml_elem.3 \
89man/khtml_elemat.3 \
90man/khtml_entity.3 \
91man/khtml_int.3 \
92man/khtml_ncr.3 \
93man/khtml_open.3 \
94man/khtml_printf.3 \
95man/khtml_putc.3 \
96man/khtml_puts.3 \
97man/khtml_write.3 \
98man/khttp_body.3 \
99man/khttp_datetime2epoch.3 \
100man/khttp_epoch2datetime.3 \
101man/khttp_epoch2str.3 \
102man/khttp_epoch2tms.3 \
103man/khttp_fcgi_free.3 \
104man/khttp_fcgi_getfd.3 \
105man/khttp_fcgi_init.3 \
106man/khttp_fcgi_parse.3 \
107man/khttp_fcgi_test.3 \
108man/khttp_free.3 \
109man/khttp_head.3 \
110man/khttp_parse.3 \
111man/khttp_printf.3 \
112man/khttp_putc.3 \
113man/khttp_puts.3 \
114man/khttp_template.3 \
115man/khttp_templatex.3 \
116man/khttp_urlabs.3 \
117man/khttp_urldecode.3 \
118man/khttp_urlencode.3 \
119man/khttp_urlpart.3 \
120man/khttp_write.3 \
121man/khttpbasic_validate.3 \
122man/khttpdigest_validate.3 \
123man/kjson_array_close.3 \
124man/kjson_array_open.3 \
125man/kjson_close.3 \
126man/kjson_obj_close.3 \
127man/kjson_obj_open.3 \
128man/kjson_open.3 \
129man/kjson_putbool.3 \
130man/kjson_putdouble.3 \
131man/kjson_putint.3 \
132man/kjson_putnull.3 \
133man/kjson_putstring.3 \
134man/kjson_string_close.3 \
135man/kjson_string_open.3 \
136man/kjson_string_write.3 \
137man/kmalloc.3 \
138man/kutil_invalidate.3 \
139man/kutil_log.3 \
140man/kutil_openlog.3 \
141man/kvalid_string.3 \
142man/kxml_close.3 \
143man/kxml_open.3 \
144man/kxml_pop.3 \
145man/kxml_popall.3 \
146man/kxml_prologue.3 \
147man/kxml_push.3 \
148man/kxml_pushnull.3 \
149man/kxml_putc.3 \
150man/kxml_puts.3 \
151man/kxml_write.3
152MAN8S = man/kfcgi.8
153MANHTMLS =
154.for f in $(MAN3S) $(MAN8S)
155MANHTMLS += ${f}.html
156HTMLS += ${f}.html
157.endfor
158MANS = $(MAN3S) \
159$(MAN8S)
160SRCS = auth.c \
161child.c \
162compats.c \
163extern.h \
164datetime.c \
165fcgi.c \
166httpauth.c \
167logging.c \
168kcgi.c \
169kcgihtml.c \
170kcgijson.c \
171kcgiregress.c \
172kcgixml.c \
173kcgi.h \
174kcgihtml.h \
175kcgijson.h \
176kcgiregress.h \
177kcgixml.h \
178kfcgi.c \
179output.c \
180parent.c \
181sample.c \
182sample-cgi.c \
183sample-fcgi.c \
184samplepp.cc \
185sandbox.c \
186sandbox-capsicum.c \
187sandbox-darwin.c \
188sandbox-pledge.c \
189sandbox-seccomp-filter.c \
190template.c \
191tests.c \
192wrappers.c \
193$(MANS)
194AFL = afl/afl-multipart \
195afl/afl-plain \
196afl/afl-template \
197afl/afl-urlencoded
198REGRESS = regress/test-abort-validator \
199regress/test-basic \
200regress/test-basic-curl \
201regress/test-bearer \
202regress/test-bearer-curl \
203regress/test-bearer-empty \
204regress/test-bearer-validate \
205regress/test-bigfile \
206regress/test-buf \
207regress/test-date2epoch \
208regress/test-datetime2epoch \
209regress/test-datetime-deprecated \
210regress/test-debug-read \
211regress/test-debug-read-long \
212regress/test-debug-write \
213regress/test-debug-write-long \
214regress/test-digest \
215regress/test-digest-auth-int \
216regress/test-digest-auth-int-bad \
217regress/test-epoch2datetime \
218regress/test-epoch2str \
219regress/test-epoch2tm \
220regress/test-epoch2tms \
221regress/test-epoch2ustr \
222regress/test-fcgi-abort-validator \
223regress/test-fcgi-bigfile \
224regress/test-fcgi-file-get \
225regress/test-fcgi-header \
226regress/test-fcgi-header-bad \
227regress/test-fcgi-path-check \
228regress/test-fcgi-ping \
229regress/test-fcgi-ping-double \
230regress/test-fcgi-upload \
231regress/test-file-get \
232regress/test-fork \
233regress/test-gzip \
234regress/test-gzip-bigfile \
235regress/test-header \
236regress/test-header-bad \
237regress/test-header-builtin \
238regress/test-html-disabled \
239regress/test-html-noscope \
240regress/test-html-null-strings \
241regress/test-html-simple \
242regress/test-html-void-elems \
243regress/test-httpdate \
244regress/test-invalidate \
245regress/test-json-controlchars \
246regress/test-json-simple \
247regress/test-logging \
248regress/test-logging-errors \
249regress/test-nogzip \
250regress/test-nullqueryval \
251regress/test-path-check \
252regress/test-ping \
253regress/test-ping-double \
254regress/test-post \
255regress/test-returncode \
256regress/test-template \
257regress/test-upload \
258regress/test-urlencode \
259regress/test-urlencode-deprecated \
260regress/test-urldecode \
261regress/test-urldecode-deprecated \
262regress/test-urlabs \
263regress/test-urlpart \
264regress/test-urlpartx \
265regress/test-urlpart-deprecated \
266regress/test-urlpartx-deprecated \
267regress/test-valid-date \
268regress/test-valid-double \
269regress/test-valid-email \
270regress/test-write
271SVGS = figure1.svg \
272figure4.svg \
273extending01-a.svg \
274extending01-b.svg \
275extending01-c.svg \
276extending01-d.svg \
277tutorial6.svg
278CSSS = archive.css \
279index.css \
280tutorial.css
281LIBS = libkcgi.a \
282libkcgihtml.a \
283libkcgijson.a \
284libkcgixml.a \
285libkcgiregress.a
286SOLIBS = libkcgi.so.$(LIBVER) \
287libkcgihtml.so.$(LIBVER) \
288libkcgijson.so.$(LIBVER) \
289libkcgixml.so.$(LIBVER) \
290libkcgiregress.so.$(LIBVER)
291CURL_LIBS_PKG != curl-config --libs 2>/dev/null || echo "-lcurl"
292CURL_CFLAGS_PKG != curl-config --cflags 2>/dev/null || echo ""
293LIBS_PKG != pkg-config --libs zlib 2>/dev/null || echo "-lz"
294CFLAGS_PKG != pkg-config --cflags zlib 2>/dev/null || echo ""
295# Because the objects will be compiled into a shared library:
296CFLAGS += -fPIC
297# To avoid exporting internal functions (kcgi.h etc. have default visibility).
298CFLAGS += -fvisibility=hidden
299VALGRIND_ARGS = -q --leak-check=full --leak-resolution=high --show-reachable=yes
300VALGRIND_ARGS += --suppressions=valgrind.suppressions
301
302REGRESS_LIBS = $(CURL_LIBS_PKG) $(LIBS_PKG) $(LDADD_MD5) -lm
303
304# The -Wno-deprecated is because the regression tests still check
305# functions that have been since deprecated.
306
307REGRESS_CFLAGS = $(CURL_CFLAGS_PKG) $(CFLAGS_PKG) -Wno-deprecated-declarations
308
309all: kfcgi $(LIBS) $(SOLIBS) $(PCS)
310
311afl: $(AFL)
312
313samples: sample samplepp sample-fcgi sample-cgi
314
315regress: $(REGRESS)
316@for f in $(REGRESS) ; do \
317printf "%s" "./$${f}... " ; \
318./$$f >/dev/null 2>/dev/null || { echo "fail" ; exit 1 ; } ; \
319echo "ok" ; \
320done
321
322valgrind: $(REGRESS)
323@tmp=`mktemp` ; \
324err=0 ; \
325for f in $(REGRESS) ; do \
326echo "valgrind $$f... " ; \
327valgrind $(VALGRIND_ARGS) --log-fd=3 ./$$f 1>&2 2>/dev/null 3>>$$tmp ; \
328done ; \
329cat $$tmp ; \
330if [ -s $$tmp ] ; then \
331err=1 ; \
332else \
333err=0 ; \
334fi ; \
335rm -f $$tmp ; \
336exit $$err
337
338installcgi: sample samplepp sample-fcgi sample-cgi
339$(INSTALL_PROGRAM) sample $(PREFIX)/sample.cgi
340$(INSTALL_PROGRAM) samplepp $(PREFIX)/samplepp.cgi
341$(INSTALL_PROGRAM) sample-cgi $(PREFIX)/sample-simple.cgi
342$(INSTALL_PROGRAM) sample-fcgi $(PREFIX)/sample-fcgi.cgi
343$(INSTALL_DATA) template.xml $(PREFIX)
344
345install: all
346mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
347mkdir -p $(DESTDIR)$(INCLUDEDIR)
348mkdir -p $(DESTDIR)$(DATADIR)
349mkdir -p $(DESTDIR)$(MAN3DIR)
350mkdir -p $(DESTDIR)$(MAN8DIR)
351mkdir -p $(DESTDIR)$(SBINDIR)
352$(INSTALL_LIB) $(LIBS) $(DESTDIR)$(LIBDIR)
353$(INSTALL_LIB) $(SOLIBS) $(DESTDIR)$(LIBDIR)
354for f in $(SOLIBS) ; do \
355( cd $(DESTDIR)$(LIBDIR) && ln -sf $$f `basename $$f .$(LIBVER)` ) ; \
356done
357$(INSTALL_DATA) kcgi.h kcgihtml.h kcgijson.h kcgixml.h kcgiregress.h $(DESTDIR)$(INCLUDEDIR)
358$(INSTALL_DATA) $(PCS) $(DESTDIR)$(LIBDIR)/pkgconfig
359$(INSTALL_MAN) $(MAN3S) $(DESTDIR)$(MAN3DIR)
360$(INSTALL_MAN) $(MAN8S) $(DESTDIR)$(MAN8DIR)
361$(INSTALL_PROGRAM) kfcgi $(DESTDIR)$(SBINDIR)
362$(INSTALL_DATA) template.xml sample.c samplepp.cc sample-fcgi.c sample-cgi.c $(DESTDIR)$(DATADIR)
363
364www: $(SVGS) $(SBLGS) kcgi.tgz kcgi.tgz.sha512 $(HTMLS) $(THTMLS) extending01.html atom.xml
365
366installwww: www
367mkdir -p $(WWWDIR)/snapshots
368$(INSTALL_DATA) $(SBLGS) $(CSSS) extending01.html $(THTMLS) $(SVGS) $(HTMLS) atom.xml $(WWWDIR)
369$(INSTALL_DATA) sample.c $(WWWDIR)/sample.c.txt
370$(INSTALL_DATA) sample-fcgi.c $(WWWDIR)/sample-fcgi.c.txt
371$(INSTALL_DATA) kcgi.tgz kcgi.tgz.sha512 $(WWWDIR)/snapshots/
372$(INSTALL_DATA) kcgi.tgz $(WWWDIR)/snapshots/kcgi-$(VERSION).tgz
373$(INSTALL_DATA) kcgi.tgz.sha512 $(WWWDIR)/snapshots/kcgi-$(VERSION).tgz.sha512
374
375distcheck: kcgi.tgz.sha512
376mandoc -Tlint -Werror $(MANS)
377newest=`grep "<h1>" versions.xml | head -1 | sed 's![ ]*!!g'` ; \
378[ "$$newest" = "<h1>$(VERSION)</h1>" ] || \
379{ echo "Version $(VERSION) not newest in versions.xml" 1>&2 ; exit 1 ; }
380rm -rf .distcheck
381[ "`openssl dgst -sha512 -hex kcgi.tgz`" = "`cat kcgi.tgz.sha512`" ] || \
382{ echo "Checksum does not match." 1>&2 ; exit 1 ; }
383mkdir -p .distcheck
384( cd .distcheck && tar -zvxpf ../kcgi.tgz )
385( cd .distcheck/kcgi-$(VERSION) && ./configure PREFIX=prefix )
386( cd .distcheck/kcgi-$(VERSION) && $(MAKE) )
387( cd .distcheck/kcgi-$(VERSION) && $(MAKE) regress )
388( cd .distcheck/kcgi-$(VERSION) && $(MAKE) install )
389rm -rf .distcheck
390
391clean:
392rm -f kcgi.tgz kcgi.tgz.sha512 $(SVGS) $(HTMLS)
393rm -f sample samplepp samplepp.o sample-fcgi sample.o sample-fcgi.o kfcgi kfcgi.o sample-cgi sample-cgi.o
394rm -f $(SBLGS) $(THTMLS) extending01.html atom.xml
395rm -f $(LIBOBJS) compats.o
396rm -f $(LIBS) *.so *.so.$(LIBVER)
397rm -f kcgihtml.o kcgijson.o kcgixml.o kcgiregress.o regress/regress.o
398rm -f *.core
399rm -f $(REGRESS) $(AFL) regress/*.o
400rm -f $(PCS)
401
402distclean: clean
403rm -f config.h config.log Makefile.configure
404
405# Our compatibility layer used throughout.
406
407compats.o: config.h
408
409# The FastCGI manager is pretty standalone.
410
411kfcgi: kfcgi.o compats.o
412$(CC) $(CFLAGS) -o $@ kfcgi.o compats.o $(LDFLAGS) $(LDADD_LIB_SOCKET)
413
414kfcgi.o: config.h
415
416# Regression targets.
417# All regress programs ("REGRESS") build in regress/regress.o.
418# Furthermore, they all link into libkcgi and libkcgiregress.
419# Some of them use the JSON library, so pull those in as well.
420# Of course, all need the config.h and headers.
421
422$(REGRESS): config.h kcgi.h regress/regress.h
423$(REGRESS): regress/regress.o
424$(REGRESS): libkcgi.a libkcgiregress.a libkcgijson.a libkcgihtml.a
425
426# -lm required by kcgi-json (on some systems---better safe than sorry)
427
428.for BIN in $(REGRESS)
429$(BIN): $(BIN).c
430$(CC) $(CFLAGS) $(REGRESS_CFLAGS) -o $@ $(BIN).c regress/regress.o \
431libkcgiregress.a libkcgijson.a libkcgihtml.a libkcgi.a \
432$(LDFLAGS) $(REGRESS_LIBS)
433.endfor
434
435regress/regress.o: regress/regress.h kcgiregress.h config.h
436
437regress/regress.o: regress/regress.c
438$(CC) $(CFLAGS) $(REGRESS_CFLAGS) -c -o $@ $<
439
440# The AFL programs call directly into libkcgi.a.
441# So require that and our configuration.
442
443.for BIN in $(AFL)
444$(BIN).o: $(BIN).c config.h kcgi.h extern.h
445$(CC) $(CFLAGS) -c -o $@ $(BIN).c
446$(BIN): $(BIN).o libkcgi.a
447$(CC) $(CFLAGS) $(CFLAGS_PKG) -o $@ $(BIN).o libkcgi.a $(LIBS_PKG) $(LDADD_MD5)
448.endfor
449
450# The main kcgi library.
451# Pulls in all objects along with the compatibility layer.
452
453libkcgi.a: $(LIBOBJS) compats.o
454$(AR) rs $@ $(LIBOBJS) compats.o
455
456libkcgi.so.$(LIBVER): $(LIBOBJS) compats.o
457$(CC) -shared -o $@ $(LIBOBJS) compats.o $(LDFLAGS) $(LDADD_MD5) \
458-Wl,${LINKER_SONAME},$@ $(LDLIBS) $(LIBS_PKG)
459ln -sf $@ `basename $@ .$(LIBVER)`
460
461$(LIBOBJS): kcgi.h config.h extern.h
462
463# Our companion libraries.
464# There are many of these.
465
466kcgihtml.o: kcgi.h config.h kcgihtml.h extern.h
467
468kcgijson.o: kcgi.h config.h kcgijson.h extern.h
469
470kcgixml.o: kcgi.h config.h kcgixml.h extern.h
471
472kcgiregress.o: config.h kcgiregress.h
473
474libkcgihtml.a: kcgihtml.o
475$(AR) rs $@ kcgihtml.o
476
477libkcgijson.a: kcgijson.o
478$(AR) rs $@ kcgijson.o
479
480libkcgixml.a: kcgixml.o
481$(AR) rs $@ kcgixml.o
482
483libkcgiregress.a: kcgiregress.o
484$(AR) rs $@ kcgiregress.o
485
486libkcgihtml.so.$(LIBVER): kcgihtml.o libkcgi.so.$(LIBVER)
487$(CC) -shared -o $@ kcgihtml.o $(LDFLAGS) \
488-Wl,${LINKER_SONAME},$@ $(LDLIBS) libkcgi.so.$(LIBVER)
489ln -sf $@ `basename $@ .$(LIBVER)`
490
491libkcgijson.so.$(LIBVER): kcgijson.o libkcgi.so.$(LIBVER)
492$(CC) -shared -o $@ kcgijson.o $(LDFLAGS) \
493-Wl,${LINKER_SONAME},$@ $(LDLIBS) libkcgi.so.$(LIBVER)
494ln -sf $@ `basename $@ .$(LIBVER)`
495
496libkcgixml.so.$(LIBVER): kcgixml.o libkcgi.so.$(LIBVER)
497$(CC) -shared -o $@ kcgixml.o $(LDFLAGS) \
498-Wl,${LINKER_SONAME},$@ $(LDLIBS) libkcgi.so.$(LIBVER)
499ln -sf $@ `basename $@ .$(LIBVER)`
500
501libkcgiregress.so.$(LIBVER): kcgiregress.o libkcgi.so.$(LIBVER)
502$(CC) -shared -o $@ kcgiregress.o $(LDFLAGS) \
503-Wl,${LINKER_SONAME},$@ $(LDLIBS) libkcgi.so.$(LIBVER)
504ln -sf $@ `basename $@ .$(LIBVER)`
505
506# Sample programs.
507# These demonstrate FastCGI, CGI, and standard.
508
509samplepp: samplepp.cc libkcgi.a libkcgihtml.a kcgi.h
510c++ $(CFLAGS) $(CFLAGS_PKG) $(LDADD_STATIC) -o $@ samplepp.cc -L. libkcgi.a $(LIBS_PKG) $(LDADD_MD5)
511
512sample: sample.o libkcgi.a libkcgihtml.a kcgi.h kcgihtml.h
513$(CC) -o $@ $(LDADD_STATIC) sample.o -L. libkcgihtml.a libkcgi.a $(LIBS_PKG) $(LDADD_MD5)
514
515sample-fcgi: sample-fcgi.o libkcgi.a kcgi.h
516$(CC) -o $@ $(LDADD_STATIC) sample-fcgi.o -L. libkcgi.a $(LIBS_PKG) $(LDADD_MD5)
517
518sample-cgi: sample-cgi.o
519$(CC) -o $@ $(LDADD_STATIC) sample-cgi.o
520
521# Now a lot of HTML and web media files.
522# These are only used with the `www' target, so we can assume
523# that they're running in-house for releases.
524
525index.html: index.xml versions.xml $(THTMLS) $(MANHTMLS)
526sblg -t index.xml -s date -o- versions.xml $(THTMLS) $(MANHTMLS) >$@
527
528sample.c.html: sample.c
529highlight -o $@ --inline-css --doc sample.c
530
531samplepp.cc.html: samplepp.cc
532highlight -o $@ --inline-css --doc samplepp.cc
533
534archive.html: archive.xml versions.xml $(THTMLS)
535sblg -t archive.xml -s date -o- versions.xml $(THTMLS) >$@
536
537$(THTMLS): tutorial.xml versions.xml $(TXMLS)
538
539extending01.html: extending01.xml tutorial.xml
540sblg -t tutorial.xml -o- -c $< | sed "s!@VERSION@!$(VERSION)!g" >$@
541
542.xml.html:
543sblg -t tutorial.xml -s date -o- -C $< versions.xml $(TXMLS) | \
544sed "s!@VERSION@!$(VERSION)!g" >$@
545
546.3.3.html .8.8.html:
547( echo "<!DOCTYPE html>" ; \
548echo "<html lang=\"en\">" ; \
549echo "<head>" ; \
550echo "<meta charset=\"utf-8\"/>" ; \
551echo "<link rel=\"stylesheet\" " \
552"href=\"https://bsd.lv/css/mandoc.css\" />" ; \
553echo "<title>`basename $<`</title>" ; \
554echo "</head>" ; \
555echo "<body>" ; \
556echo "<article data-sblg-article=\"1\"" \
557"data-sblg-tags=\"man\" " \
558"data-sblg-title=\"`basename $<`\">" ; \
559mandoc -Ofragment -Thtml $< ; \
560echo "</article>" ; \
561echo "</body>" ; \
562echo "</html>" ; ) >$@
563
564atom.xml: versions.xml
565sblg -s date -a versions.xml >$@
566
567.dot.svg:
568dot -Tsvg -o $@ $<
569
570# Distribution files.
571# Also only used with the `www' target.
572
573kcgi.tgz.sha512: kcgi.tgz
574openssl dgst -sha512 -hex kcgi.tgz >$@
575
576kcgi.tgz:
577mkdir -p .dist/kcgi-$(VERSION)
578mkdir -p .dist/kcgi-$(VERSION)/man
579mkdir -p .dist/kcgi-$(VERSION)/regress
580mkdir -p .dist/kcgi-$(VERSION)/afl
581install -m 0644 $(SRCS) *.in.pc .dist/kcgi-$(VERSION)
582install -m 0644 regress/*.c regress/*.h .dist/kcgi-$(VERSION)/regress
583install -m 0644 afl/*.c .dist/kcgi-$(VERSION)/afl
584install -m 0644 Makefile template.xml .dist/kcgi-$(VERSION)
585install -m 0644 $(MANS) .dist/kcgi-$(VERSION)/man
586install -m 0755 configure .dist/kcgi-$(VERSION)
587(cd .dist && tar zcf ../$@ kcgi-$(VERSION))
588rm -rf .dist
589
590# Catch version updates.
591
592$(PCS): kcgi.h
593
594.in.pc.pc:
595sed -e "s!@PREFIX@!$(PREFIX)!g" \
596-e "s!@LDADD_ZLIB@!$(LIBS_PKG)!g" \
597-e "s!@LDADD_LIB_SOCKET@!$(LDADD_LIB_SOCKET)!g" \
598-e "s!@LDADD_MD5@!$(LDADD_MD5)!g" \
599-e "s!@LIBDIR@!$(LIBDIR)!g" \
600-e "s!@INCLUDEDIR@!$(INCLUDEDIR)!g" \
601-e "s!@VERSION@!$(VERSION)!g" $< >$@
602