BUILD: fix install rules and doc generation

Also provide proper SONAME.
This commit is contained in:
hasufell 2014-06-05 17:00:14 +02:00
parent 07cc12f649
commit 063f837588
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
6 changed files with 1940 additions and 14 deletions

View File

@ -7,14 +7,25 @@ all:
main:
$(MAKE) -C src main
install:
$(MAKE) -C src install
$(MAKE) -C include install
uninstall:
$(MAKE) -C src uninstall
$(MAKE) -C include uninstall
clean:
$(MAKE) -C src clean
$(MAKE) -C include clean
doc:
doxygen
$(MAKE) -C src doc
$(MAKE) -C include doc
doc-pdf: doc
$(MAKE) -C latex pdf
$(MAKE) -C src doc-pdf
$(MAKE) -C include doc-pdf
.PHONY: clean doc doc-pdf
.PHONY: clean doc doc-pdf install

View File

@ -10,7 +10,9 @@ CFLAGS += -Wno-unused-but-set-variable
endif
LDFLAGS ?= -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu
# install variables
# install/uninstall variables
RM = rm
LN_S = ln -s
INSTALL = install
INSTALL_BIN = install -m755
INSTALL_DIR = install -d
@ -18,3 +20,4 @@ PREFIX = /usr/local
LIBDIR = lib64
INSTALL_BINDIR = $(PREFIX)/bin
INSTALL_LIBDIR = $(PREFIX)/$(LIBDIR)
INSTALL_INCLUDEDIR = $(PREFIX)/include

View File

@ -668,7 +668,7 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = src/ src/test/
INPUT =
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is

30
include/Makefile Normal file
View File

@ -0,0 +1,30 @@
include ../common.mk
doc:
doxygen
doc-pdf: doc
$(MAKE) -C latex pdf
install:
$(INSTALL_DIR) "$(DESTDIR)$(INSTALL_INCLUDEDIR)"
$(INSTALL) ntru.h "$(DESTDIR)$(INSTALL_INCLUDEDIR)"/ntru.h
$(INSTALL) ntru_decrypt.h "$(DESTDIR)$(INSTALL_INCLUDEDIR)"/ntru_decrypt.h
$(INSTALL) ntru_encrypt.h "$(DESTDIR)$(INSTALL_INCLUDEDIR)"/ntru_encrypt.h
$(INSTALL) ntru_keypair.h "$(DESTDIR)$(INSTALL_INCLUDEDIR)"/ntru_keypair.h
$(INSTALL) ntru_rnd.h "$(DESTDIR)$(INSTALL_INCLUDEDIR)"/ntru_rnd.h
uninstall:
$(RM) "$(DESTDIR)$(INSTALL_INCLUDEDIR)"/ntru.h
$(RM) "$(DESTDIR)$(INSTALL_INCLUDEDIR)"/ntru_decrypt.h
$(RM) "$(DESTDIR)$(INSTALL_INCLUDEDIR)"/ntru_encrypt.h
$(RM) "$(DESTDIR)$(INSTALL_INCLUDEDIR)"/ntru_keypair.h
$(RM) "$(DESTDIR)$(INSTALL_INCLUDEDIR)"/ntru_rnd.h
clean:
rm -rf html/ latex/
.PHONY: clean doc doc-pdf install uninstall

1869
src/Doxyfile Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,9 @@
include ../common.mk
SOVER = 0
LIBVER = 0.0.1
# sources, headers, objects
PQC_SOURCES = \
ntru_ascii_poly.c \
@ -29,6 +32,7 @@ PQC_HEADERS = \
ntru_rnd.h \
ntru_string.h
# libs
LIBS += -L. -lgmp -lmpfr -lflint $(shell $(PKG_CONFIG) --libs glib-2.0) -lm
@ -41,29 +45,38 @@ CFLAGS += -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED
%.o: %.c
$(CC) -fPIC $(CFLAGS) $(CPPFLAGS) $(INCS) -c $*.c
all: libpqc.a libpqc.so
all: libpqc.a libpqc.so.$(LIBVER)
libpqc.a: $(PQC_OBJS) $(PQC_HEADERS)
$(AR) cru libpqc.a $(PQC_OBJS)
libpqc.so: libpqc.a $(PQC_HEADERS) $(LIBFLINT)
$(CC) -shared $(CFLAGS) -o $@ $(LDFLAGS) \
libpqc.so.$(LIBVER): libpqc.a $(PQC_HEADERS) $(LIBFLINT)
$(CC) -shared $(CFLAGS) -Wl,-soname,libpqc$(SOVER) -o $@ $(LDFLAGS) \
libpqc.a $(LIBFLINT) $(LIBS)
main: main.o libpqc.a $(LIBFLINT)
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) \
main.o libpqc.a $(LIBFLINT) $(LIBS)
doc:
doxygen
doc-pdf: doc
$(MAKE) -C latex pdf
install:
$(INSTALL_DIR) "$(DESTDIR)$(INSTALL_BINDIR)"
[ -e libpqc.so ] && $(INSTALL_DIR) "$(DESTDIR)$(INSTALL_LIBDIR)"
[ -e libpqc.so ] && $(INSTALL_BIN) libpqc.so "$(DESTDIR)$(INSTALL_LIBDIR)"
$(INSTALL_DIR) "$(DESTDIR)$(INSTALL_LIBDIR)"
$(INSTALL_BIN) libpqc.so.$(LIBVER) "$(DESTDIR)$(INSTALL_LIBDIR)"
$(LN_S) libpqc.so.$(LIBVER) "$(DESTDIR)$(INSTALL_LIBDIR)"/libpqc.so
$(LN_S) libpqc.so.$(LIBVER) "$(DESTDIR)$(INSTALL_LIBDIR)"/libpqc.so.$(SOVER)
uninstall:
[ -e "$(DESTDIR)$(INSTALL_LIBDIR)/libpqc.so" ] && rm "$(DESTDIR)$(INSTALL_LIBDIR)/libpqc.so"
$(RM) "$(DESTDIR)$(INSTALL_LIBDIR)/libpqc.so"
$(RM) "$(DESTDIR)$(INSTALL_LIBDIR)/libpqc.so.$(SOVER)"
$(RM) "$(DESTDIR)$(INSTALL_LIBDIR)/libpqc.so.$(LIBVER)"
clean:
rm -f *.o test libpqc.a libpqc.so main *.dec *.enc *.hex *.orig core
rm -rf html/ latex/ *.o test libpqc.a libpqc.so* main *.dec *.enc *.hex *.orig core
.PHONY: clean install uninstall
.PHONY: clean doc doc-pdf install uninstall