doc: add make pdf

This commit is contained in:
lohhiiccc 2026-05-05 10:37:15 +02:00 committed by lohhiiccc
parent 37f741cf06
commit 0d92a80e4c
4 changed files with 89 additions and 0 deletions

View file

@ -1,6 +1,10 @@
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
if ENABLE_DOC
SUBDIRS = src doc
else
SUBDIRS = src SUBDIRS = src
endif
pkgincludedir = $(includedir)/$(PACKAGE_NAME) pkgincludedir = $(includedir)/$(PACKAGE_NAME)
pkginclude_HEADERS = \ pkginclude_HEADERS = \

View file

@ -27,9 +27,25 @@ STRICT_CFLAGS="-Wall -Wextra -Werror -pipe -Wpedantic -Wconversion -Wshadow -Wvl
AC_SUBST([STRICT_CFLAGS]) AC_SUBST([STRICT_CFLAGS])
# --enable-doc
AC_ARG_ENABLE(
[doc],
[AS_HELP_STRING([--enable-doc], [Build PDF documentation with pdflatex (default: no)])],
[enable_doc=$enableval],
[enable_doc=no]
)
AS_IF([test "x$enable_doc" = "xyes"], [
AC_CHECK_PROG([PDFLATEX], [pdflatex], [pdflatex])
AS_IF([test -z "$PDFLATEX"],
[AC_MSG_ERROR([--enable-doc requires pdflatex but it was not found])])
])
AM_CONDITIONAL([ENABLE_DOC], [test "x$enable_doc" = "xyes"])
AC_CONFIG_FILES([ AC_CONFIG_FILES([
Makefile Makefile
src/Makefile src/Makefile
doc/Makefile
libft_ssl.pc libft_ssl.pc
]) ])
@ -43,4 +59,5 @@ AC_MSG_NOTICE([
CC : $CC CC : $CC
CFLAGS : $STRICT_CFLAGS $CFLAGS CFLAGS : $STRICT_CFLAGS $CFLAGS
debug : $enable_debug debug : $enable_debug
doc : $enable_doc
]) ])

12
doc/Makefile.am Normal file
View file

@ -0,0 +1,12 @@
EXTRA_DIST = libft_ssl.tex
if ENABLE_DOC
pdf: libft_ssl.pdf
libft_ssl.pdf: libft_ssl.tex
$(PDFLATEX) $<
$(PDFLATEX) $<
endif
clean-local:
rm -f *.aux *.log *.toc *.out *.pdf

56
doc/libft_ssl.tex Normal file
View file

@ -0,0 +1,56 @@
\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{hyperref}
\usepackage{geometry}
\geometry{margin=2.5cm}
\title{\textbf{libft\_ssl} \\ \large Cryptographic Hash Functions}
\author{lohhiiccc}
\date{}
\begin{document}
\maketitle
\tableofcontents
\newpage
\section{Introduction}
\texttt{libft\_ssl} is a C library implementing cryptographic hash functions
from scratch. A cryptographic hash function maps an arbitrary-length input to a
fixed-size digest. This operation is deterministic and one-way: it is
computationally infeasible to recover the original input from its digest.
The library currently implements the following algorithms:
\begin{itemize}
\item \textbf{MD5} - produces a 128-bit digest.
\item \textbf{SHA-256} - produces a 256-bit digest.
\item \textbf{Whirlpool} - produces a 512-bit digest.
\end{itemize}
These functions are commonly used for data integrity verification, digital
signatures, and message authentication codes (MACs).
\newpage
\section{Library core}
\newpage
\section{MD5}
\newpage
\section{SHA-256}
\newpage
\section{Whirlpool}
\end{document}