################################################################ # Makefile template for SWI-Prolog CLIB package # # This template is used by configure to create Makefile. See # the file INSTALL for further installation instructions. # # License: LGPL # # Author: Jan Wielemaker (wielemak@science.uva.nl) ################################################################ PACKAGE=clib DOC=clib PKGCFLAGS=-I$(srcdir) -I$(srcdir)/maildrop/rfc2045 -I$(srcdir)/maildrop/rfc822 include ../Makefile.defs NETLIBS=@CLIB_NETLIBS@ CRYPTLIBS=@CLIB_CRYPTLIBS@ MIMELIBS=maildrop/rfc2045/librfc2045.a maildrop/rfc822/librfc822.a LIBPL= @CLIB_PLTARGETS@ streaminfo.pl process.pl prolog_server.pl sha.pl \ uri.pl TARGETS= @CLIB_TARGETS@ readutil.@SO@ streaminfo.@SO@ process.@SO@ \ sha4pl.@SO@ uri.@SO@ UNXOBJ= error.o unix.o SOCKOBJ= error.o socket.o nonblockio.o CGIOBJ= error.o form.o cgi.o CRYPTOBJ= error.o crypt.o md5.o md5passwd.o MEMOBJ= error.o memfile.o MIMEOBJ= error.o mime.o TIMEOBJ= error.o time.o FILESOBJ= error.o files.o RLIMITOBJ= error.o rlimit.o URIOBJ= uri.o RANDOMOBJ= random.o READUTILOBJ= readutil.o PROCESSOBJ= error.o process.o STREAMINFOOBJ= error.o streaminfo.o SHAOBJ= error.o sha4pl.o sha1/sha1.o sha1/sha2.o \ sha1/hmac_sha1.o sha1/hmac_sha256.o all: $(TARGETS) random.@SO@: $(RANDOMOBJ) $(LD) $(LDSOFLAGS) -o $@ $(RANDOMOBJ) unix.@SO@: $(UNXOBJ) $(LD) $(LDSOFLAGS) -o $@ $(UNXOBJ) socket.@SO@: $(SOCKOBJ) $(LD) $(LDSOFLAGS) -o $@ $(SOCKOBJ) $(NETLIBS) cgi.@SO@: $(CGIOBJ) $(LD) $(LDSOFLAGS) -o $@ $(CGIOBJ) crypt.@SO@: $(CRYPTOBJ) $(LD) $(LDSOFLAGS) -o $@ $(CRYPTOBJ) $(CRYPTLIBS) memfile.@SO@: $(MEMOBJ) $(LD) $(LDSOFLAGS) -o $@ $(MEMOBJ) $(LIBS) mime.@SO@: $(MIMEOBJ) $(MIMELIBS) $(LD) $(LDSOFLAGS) -o $@ $(MIMEOBJ) $(MIMELIBS) time.@SO@: $(TIMEOBJ) $(LD) $(LDSOFLAGS) -o $@ $(TIMEOBJ) $(LIBS) files.@SO@: $(FILESOBJ) $(LD) $(LDSOFLAGS) -o $@ $(FILESOBJ) $(LIBS) rlimit.@SO@: $(RLIMITOBJ) $(LD) $(LDSOFLAGS) -o $@ $(RLIMITOBJ) $(LIBS) readutil.@SO@: $(READUTILOBJ) $(LD) $(LDSOFLAGS) -o $@ $(READUTILOBJ) process.@SO@: $(PROCESSOBJ) $(LD) $(LDSOFLAGS) -o $@ $(PROCESSOBJ) streaminfo.@SO@: $(STREAMINFOOBJ) $(LD) $(LDSOFLAGS) -o $@ $(STREAMINFOOBJ) sha4pl.@SO@: $(SHAOBJ) $(LD) $(LDSOFLAGS) -o $@ $(SHAOBJ) uri.@SO@: $(URIOBJ) $(LD) $(LDSOFLAGS) -o $@ $(URIOBJ) socket.o: $(srcdir)/socket.c $(srcdir)/sockcommon.c sha1/sha1.o: $(CC) -c $(CFLAGS) -DUSE_SHA1 -o $@ $(srcdir)/sha1/sha1.c sha1/sha2.o: $(CC) -c $(CFLAGS) -DUSE_SHA1 -o $@ $(srcdir)/sha1/sha2.c sha1/hmac_sha1.o: $(CC) -c $(CFLAGS) -DUSE_SHA1 -o $@ $(srcdir)/sha1/hmac.c sha1/hmac_sha256.o: $(CC) -c $(CFLAGS) -DUSE_SHA256 -o $@ $(srcdir)/sha1/hmac.c maildrop/rfc822/librfc822.a: (cd maildrop/rfc822 && $(MAKE)) maildrop/rfc2045/librfc2045.a: (cd maildrop/rfc2045 && $(MAKE)) install: $(TARGETS) mkdir -p $(DESTDIR)$(SOLIBDIR) for f in $(TARGETS); do \ $(INSTALL_PROGRAM) $$f $(DESTDIR)$(SOLIBDIR); \ done mkdir -p $(DESTDIR)$(PLLIBDIR) for f in $(LIBPL); do \ $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(PLLIBDIR); \ done ( cd $(srcdir) ; $(PL) -f none -g make -t halt ) ln-install:: @$(MAKE) INSTALL_DATA='../ln-install' INSTALL_PROGRAM='../ln-install' install rpm-install: install html-install:: mkdir -p $(DESTDIR)$(PKGDOC) $(INSTALL) -m 644 clib.html $(DESTDIR)$(PKGDOC) pdf-install:: mkdir -p $(DESTDIR)$(PKGDOC) $(INSTALL) -m 644 clib.pdf $(DESTDIR)$(PKGDOC) uninstall:: (cd $(PLBASE)/lib/$(PLARCH) && rm -f $(TARGETS)) (cd $(PLBASE)/library && rm -f $(LIBPL)) $(PL) -f none -g make -t halt ################################################################ # Testing ################################################################ check: check-socket check-memfile check-unit check-process \ check-read check-uri check-cgi torture: torture-socket check-socket:: ( cd $(srcdir) && $(PL) -q -f test_socket.pl -F none -g test_socket,halt -t 'halt(1)' ) torture-socket:: ( cd $(srcdir) && $(PL) -q -f stresssocket.pl -F none -g test,halt -t 'halt(1)' ) check-memfile:: ( cd $(srcdir) && $(PL) -q -f test_memfile.pl -F none -g test_memfile,halt -t 'halt(1)' ) check-unit:: ( cd $(srcdir) && $(PL) -q -f test.pl -g run_tests,halt -t 'halt(1)' ) check-uri:: ( cd $(srcdir) && $(PL) -q -f test_uri.pl -g true -t test_uri ) check-cgi:: ( cd $(srcdir) && $(PL) -q -f test_cgi.pl -g true -t test_cgi ) check-process:: ( cd $(srcdir) && $(PL) -q -f test_process.pl -g true -t test_process ) check-read:: ( cd $(srcdir) && $(PL) -q -f test_readutil.pl -g true -t test_readutilw ) ################################################################ # Documentation ################################################################ TEXEXTRA=process.tex uri.tex filesex.tex $(TEX): $(TEXEXTRA) uri.tex: uri.pl $(PLTOTEX) 'library(uri)' process.tex: process.pl $(PLTOTEX) 'library(process)' filesex.tex: filesex.pl $(PLTOTEX) 'library(filesex)' ################################################################ # Clean ################################################################ clean: rm -f $(OBJ) *~ *.o *% a.out core config.log sha1/*.o rm -f $(TEX) -(cd maildrop/rfc822 && $(MAKE) clean) -(cd maildrop/rfc2045 && $(MAKE) clean) distclean: clean rm -f $(TARGETS) config.cache config.h config.status Makefile rm -f clib.aux clib.log clib.out clib.toc rm -rf html -(cd maildrop/rfc822 && $(MAKE) distclean) -(cd maildrop/rfc2045 && $(MAKE) distclean)