mirror of
https://github.com/obgm/libcoap.git
synced 2026-12-02 02:47:09 +03:00
quick hack to create shared library (use configure --with-shared)
This commit is contained in:
1 parent
72e6f738c8
commit
14270f6cea
2 files changed
+34
-3
No files matched your search
+27
-2
@@ -10,6 +10,7 @@ VERSION:=@PACKAGE_VERSION@
|
||||
|
||||
# tools
|
||||
@SET_MAKE@
|
||||
RANLIB=@RANLIB@
|
||||
SHELL = /bin/sh
|
||||
MKDIR = mkdir
|
||||
ETAGS = @ETAGS@
|
||||
@@ -31,18 +32,39 @@ DISTDIR=$(top_builddir)/$(package)
|
||||
SUBDIRS:=examples doc @TESTS@
|
||||
FILES:=ChangeLog README LICENSE.BSD LICENSE.GPL Makefile.in configure configure.in config.h.in $(SOURCES) $(HEADERS)
|
||||
LIB:=libcoap.a
|
||||
LDSOFLAGS=-shared
|
||||
LDFLAGS:=@LIBS@
|
||||
ARFLAGS:=cru
|
||||
examples:=examples
|
||||
doc:=doc
|
||||
@BUILD_SO@
|
||||
|
||||
ifdef BUILD_SO
|
||||
MACHINE?=$(shell $(CC) -dumpmachine)
|
||||
ifeq ($(findstring Darwin, $(MACHINE)), Darwin)
|
||||
LDSOFLAGS=-dynamiclib
|
||||
LIBSO=libcoap.dylib
|
||||
endif
|
||||
ifeq ($(findstring Windows, $(MACHINE)), Windows)
|
||||
LIBSO=libcoap.dll
|
||||
endif
|
||||
# more platforms go here
|
||||
ifndef LIBSO
|
||||
LIBSO=libcoap.so
|
||||
endif
|
||||
ifndef PICFLAG
|
||||
CFLAGS+=-fPIC
|
||||
else
|
||||
CFLAGS+=$(PICFLAG)
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: all dirs clean distclean .gitignore doc TAGS
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o
|
||||
|
||||
all: $(LIB) dirs
|
||||
all: $(LIB) $(LIBSO) dirs
|
||||
|
||||
check:
|
||||
echo DISTDIR: $(DISTDIR)
|
||||
@@ -56,7 +78,10 @@ dirs: $(SUBDIRS)
|
||||
|
||||
$(LIB): $(OBJECTS)
|
||||
$(AR) $(ARFLAGS) $@ $^
|
||||
ranlib $@
|
||||
$(RANLIB) $@
|
||||
|
||||
$(LIBSO): $(OBJECTS)
|
||||
$(LD) $(LDSOFLAGS) $(LDFLAGS) -o $@ $^
|
||||
|
||||
clean:
|
||||
@rm -f $(PROGRAM) main.o $(LIB) $(OBJECTS)
|
||||
|
||||
+7
-1
@@ -7,7 +7,7 @@
|
||||
# README for terms of use.
|
||||
|
||||
AC_PREREQ([2.65])
|
||||
AC_INIT([libcoap], [4.0.1])
|
||||
AC_INIT([libcoap], [4.0.2])
|
||||
AC_CONFIG_SRCDIR([coap.h])
|
||||
|
||||
# First check for Contiki build to quit configure before any other test
|
||||
@@ -65,6 +65,11 @@ AC_ARG_WITH(tests,
|
||||
[TESTS="tests"],
|
||||
[])
|
||||
|
||||
AC_ARG_WITH(shared,
|
||||
[AS_HELP_STRING([--with-shared],[build shared library])],
|
||||
[BUILD_SO="BUILD_SO=1"],
|
||||
[])
|
||||
|
||||
# Checks for header files.
|
||||
AC_CHECK_HEADERS([assert.h arpa/inet.h limits.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/socket.h sys/time.h time.h unistd.h sys/unistd.h])
|
||||
|
||||
@@ -77,6 +82,7 @@ AC_FUNC_MALLOC
|
||||
AC_CHECK_FUNCS([memset select socket strcasecmp strrchr getaddrinfo strnlen])
|
||||
|
||||
AC_SUBST(TESTS)
|
||||
AC_SUBST(BUILD_SO)
|
||||
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
|
||||
Reference in new issue
Block a user