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: main:
$(MAKE) -C src main $(MAKE) -C src main
install:
$(MAKE) -C src install
$(MAKE) -C include install
uninstall:
$(MAKE) -C src uninstall
$(MAKE) -C include uninstall
clean: clean:
$(MAKE) -C src clean $(MAKE) -C src clean
$(MAKE) -C include clean
doc: doc:
doxygen $(MAKE) -C src doc
$(MAKE) -C include doc
doc-pdf: 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 endif
LDFLAGS ?= -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu LDFLAGS ?= -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu
# install variables # install/uninstall variables
RM = rm
LN_S = ln -s
INSTALL = install INSTALL = install
INSTALL_BIN = install -m755 INSTALL_BIN = install -m755
INSTALL_DIR = install -d INSTALL_DIR = install -d
@ -18,3 +20,4 @@ PREFIX = /usr/local
LIBDIR = lib64 LIBDIR = lib64
INSTALL_BINDIR = $(PREFIX)/bin INSTALL_BINDIR = $(PREFIX)/bin
INSTALL_LIBDIR = $(PREFIX)/$(LIBDIR) 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 # directories like "/usr/src/myproject". Separate the files or directories
# with spaces. # with spaces.
INPUT = src/ src/test/ INPUT =
# This tag can be used to specify the character encoding of the source files # 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 # 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 include ../common.mk
SOVER = 0
LIBVER = 0.0.1
# sources, headers, objects # sources, headers, objects
PQC_SOURCES = \ PQC_SOURCES = \
ntru_ascii_poly.c \ ntru_ascii_poly.c \
@ -29,6 +32,7 @@ PQC_HEADERS = \
ntru_rnd.h \ ntru_rnd.h \
ntru_string.h ntru_string.h
# libs # libs
LIBS += -L. -lgmp -lmpfr -lflint $(shell $(PKG_CONFIG) --libs glib-2.0) -lm 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 %.o: %.c
$(CC) -fPIC $(CFLAGS) $(CPPFLAGS) $(INCS) -c $*.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) libpqc.a: $(PQC_OBJS) $(PQC_HEADERS)
$(AR) cru libpqc.a $(PQC_OBJS) $(AR) cru libpqc.a $(PQC_OBJS)
libpqc.so: libpqc.a $(PQC_HEADERS) $(LIBFLINT) libpqc.so.$(LIBVER): libpqc.a $(PQC_HEADERS) $(LIBFLINT)
$(CC) -shared $(CFLAGS) -o $@ $(LDFLAGS) \ $(CC) -shared $(CFLAGS) -Wl,-soname,libpqc$(SOVER) -o $@ $(LDFLAGS) \
libpqc.a $(LIBFLINT) $(LIBS) libpqc.a $(LIBFLINT) $(LIBS)
main: main.o libpqc.a $(LIBFLINT) main: main.o libpqc.a $(LIBFLINT)
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) \ $(CC) $(CFLAGS) -o $@ $(LDFLAGS) \
main.o libpqc.a $(LIBFLINT) $(LIBS) main.o libpqc.a $(LIBFLINT) $(LIBS)
doc:
doxygen
doc-pdf: doc
$(MAKE) -C latex pdf
install: install:
$(INSTALL_DIR) "$(DESTDIR)$(INSTALL_BINDIR)" $(INSTALL_DIR) "$(DESTDIR)$(INSTALL_LIBDIR)"
[ -e libpqc.so ] && $(INSTALL_DIR) "$(DESTDIR)$(INSTALL_LIBDIR)" $(INSTALL_BIN) libpqc.so.$(LIBVER) "$(DESTDIR)$(INSTALL_LIBDIR)"
[ -e libpqc.so ] && $(INSTALL_BIN) libpqc.so "$(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: 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: 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