$NetBSD: patch-ab,v 1.10 2009/02/16 19:16:57 joerg Exp $ --- Makefile.orig 1999-08-20 23:14:07.000000000 +0200 +++ Makefile 2006-11-12 02:49:34.000000000 +0100 @@ -14,25 +14,31 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. -CFLAGS = -I. -Wall -O2 -g +MANDIR?= ${PREFIX}/man + +CFLAGS += -I. -Wall -O2 LDFLAGS = -L. -LIBS = -lcgi +LIBS = libcgi.la OBJS = cgi.o cookies.o -libcgi.a: $(OBJS) - ar rc $@ $^ +all: libcgi.la cgitest jumpto + +.SUFFIXES: .lo -cgitest: cgitest.o libcgi.a - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) +.c.lo: + ${LIBTOOL} --mode=compile ${CC} ${CFLAGS} -o $@ -c $< -jumpto: jumpto.o libcgi.a - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) +libcgi.la: $(OBJS:.o=.lo) + ${LIBTOOL} --mode=link ${CC} -o $@ ${OBJS:.o=.lo} \ + -rpath ${PREFIX}/lib \ + -version-info 0:0 -all: libcgi.a cgitest jumpto +cgitest: cgitest.lo libcgi.la + ${LIBTOOL} --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ cgitest.lo $(LIBS) -install: cgitest - install -m 755 cgitest /usr/lib/cgi-bin +jumpto: jumpto.lo libcgi.la + ${LIBTOOL} --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ jumpto.lo $(LIBS) clean: rm -f cgitest cgitest.o jumpto jumpto.o libcgi.a $(OBJS) *.[35].html @@ -41,3 +47,19 @@ htmlman: for f in *.[35]; do \ man -l $$f|rman -f HTML --title $$f -r "%s.%s.html" > $$f.html; \ done + +install: + ${BSD_INSTALL_PROGRAM_DIR} ${DESTDIR}${PREFIX}/libexec/cgi-bin + ${BSD_INSTALL_DATA_DIR} ${DESTDIR}${PREFIX}/share/examples/cgilib + ${BSD_INSTALL_DATA} cgitest.c ${DESTDIR}${PREFIX}/share/examples/cgilib + ${BSD_INSTALL_DATA} jumpto.c ${DESTDIR}${PREFIX}/share/examples/cgilib + ${LIBTOOL} --mode=install ${BSD_INSTALL_LIB} libcgi.la ${DESTDIR}${PREFIX}/lib + ${LIBTOOL} --mode=install ${BSD_INSTALL_PROGRAM} cgitest ${DESTDIR}${PREFIX}/libexec/cgi-bin + ${LIBTOOL} --mode=install ${BSD_INSTALL_PROGRAM} jumpto ${DESTDIR}${PREFIX}/libexec/cgi-bin + ${BSD_INSTALL_DATA} cgi.h ${DESTDIR}${PREFIX}/include + for i in *.3; do \ + ${BSD_INSTALL_MAN} $$i ${DESTDIR}${MANDIR}/man3/; \ + done + for i in *.5; do \ + ${BSD_INSTALL_MAN} $$i ${DESTDIR}${MANDIR}/man5/; \ + done