Build a shared library as well

The ruby ffi gem doesn't seem to support static libraries.

This is a dirty hack since I don't know how GNU autotools works.

Change-Id: If1b23b770ec5f16562cde1f8874c6a4331c93929
Signed-off-by: Sören Tempel <tempel@uni-bremen.de>
Signed-off-by: Olaf Bergmann <bergmann@tzi.org>
This commit is contained in:
Sören Tempel
2018-05-05 13:50:01 +02:00
committed by Olaf Bergmann
parent 10033d20ee
commit b9c58a1f23
2 changed files with 13 additions and 7 deletions

View File

@@ -51,7 +51,8 @@ DISTSUBDIRS:=$(SUBDIRS)
DISTDIR=$(top_builddir)/$(package)
FILES:=Makefile.in configure configure.in dtls_config.h.in tinydtls.h.in \
Makefile.tinydtls $(SOURCES) $(HEADERS)
LIB:=libtinydtls.a
LIB:=libtinydtls
LIBS:=$(LIB).a $(LIB).so
LDFLAGS:=@LIBS@
ARFLAGS:=cru
doc:=doc
@@ -62,14 +63,14 @@ ifneq ("@WITH_CONTIKI@", "1")
.SUFFIXES:
.SUFFIXES: .c .o
all: $(LIB) dirs
all: $(LIBS) dirs
check:
echo DISTDIR: $(DISTDIR)
echo top_builddir: $(top_builddir)
$(MAKE) -C tests check
tests: $(LIB)
tests: $(LIBS)
dirs: $(SUBDIRS)
for dir in $^; do \
$(MAKE) -C $$dir ; \
@@ -78,7 +79,10 @@ dirs: $(SUBDIRS)
$(SUB_OBJECTS)::
$(MAKE) -C $(@D) $(@F)
$(LIB): $(OBJECTS)
$(LIB).so: $(OBJECTS)
$(LD) $(LDFLAGS) -shared $^ -o $@
$(LIB).a: $(OBJECTS)
$(AR) $(ARFLAGS) $@ $^
$(RANLIB) $@
@@ -104,10 +108,10 @@ dist: $(FILES) $(DISTSUBDIRS)
done
tar czf $(package).tar.gz $(DISTDIR)
install: $(LIB) $(HEADERS) $(SUBDIRS)
install: $(LIBS) $(HEADERS) $(SUBDIRS)
test -d $(libdir) || mkdir -p $(libdir)
test -d $(includedir) || mkdir -p $(includedir)
$(install) $(LIB) $(libdir)/
$(install) $(LIBS) $(libdir)/
$(install) $(HEADERS) $(includedir)/
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir install="$(install)" includedir=$(includedir) install; \
@@ -121,7 +125,7 @@ TAGS:
# files that should be ignored by git
GITIGNOREDS:= core \*~ \*.[oa] \*.gz \*.cap \*.pcap Makefile \
autom4te.cache/ config.h config.log config.status configure \
doc/Doxyfile doc/doxygen.out doc/html/ $(LIB) tests/ccm-test \
doc/Doxyfile doc/doxygen.out doc/html/ $(LIBS) tests/ccm-test \
tests/dtls-client tests/dtls-server tests/prf-test $(package) \
$(DISTDIR)/ TAGS \*.patch .gitignore ecc/testecc ecc/testfield \
\*.d \*.hex \*.elf \*.map obj_\* tinydtls.h dtls_config.h \

View File

@@ -33,6 +33,8 @@ m4_ifdef([AM_PROG_AR], [AM_PROG_AR], [AR=ar])
AC_C_BIGENDIAN
CFLAGS="-fPIC"
# Adding some default warning options for code QS
# see https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
# and http://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html