Implementation of connectivity abstraction feature Release v0.3
[platform/upstream/iotivity.git] / resource / csdk / connectivity / lib / libcoap-4.1.1 / Makefile
1 # Makefile for libcoap
2 #
3 # Copyright (C) 2010--2013 Olaf Bergmann <bergmann@tzi.org>
4 #
5 # This file is part of the CoAP library libcoap. Please see
6 # README for terms of use.
7
8 # the library's version
9 VERSION:=4.1.1
10
11 # tools
12
13 RANLIB=ranlib
14 SHELL = /bin/sh
15 MKDIR = mkdir
16 ETAGS = /bin/false
17
18 abs_builddir = /connectivity/connectivity/src/bt_edr_adapter/libcoap-4.1.1
19 top_builddir = .
20 package = libcoap-4.1.1
21
22 # files and flags
23 SOURCES:= pdu.c net.c debug.c encode.c uri.c coap_list.c resource.c hashkey.c \
24          str.c option.c async.c subscribe.c block.c
25 OBJECTS:= $(patsubst %.c, %.o, $(SOURCES))
26 HEADERS:=coap.h config.h debug.h pdu.h net.h encode.h uri.h coap_list.h mem.h \
27         str.h option.h bits.h uthash.h utlist.h resource.h hashkey.h async.h \
28         subscribe.h block.h address.h prng.h coap_time.h t_list.h
29 CFLAGS:=-Wall -Wextra -std=c99 -pedantic -g -O2 -fPIC
30 CPPFLAGS:= -DWITH_POSIX
31 DISTDIR=$(top_builddir)/$(package)
32 SUBDIRS:=#examples #doc tests
33 FILES:=ChangeLog README LICENSE.BSD LICENSE.GPL Makefile.in configure configure.in config.h.in $(SOURCES) $(HEADERS)
34 LIB:=libcoap.a
35 LDSOFLAGS=-shared
36 LDFLAGS:=
37 ARFLAGS:=cru
38 examples:=examples
39 doc:=doc
40
41
42 ifdef BUILD_SO
43   MACHINE?=$(shell $(CC) -dumpmachine)
44   ifeq ($(findstring Darwin, $(MACHINE)), Darwin)
45     LDSOFLAGS=-dynamiclib
46     LIBSO=libcoap.dylib
47   endif
48   ifeq ($(findstring Windows, $(MACHINE)), Windows)
49     LIBSO=libcoap.dll
50   endif
51   # more platforms go here
52   ifndef LIBSO
53     LIBSO=libcoap.so
54   endif
55   ifndef PICFLAG
56     CFLAGS+=-fPIC
57   else
58     CFLAGS+=$(PICFLAG)
59   endif
60 endif
61
62 .PHONY: all dirs clean distclean .gitignore doc TAGS
63
64 .SUFFIXES:
65 .SUFFIXES:      .c .o
66
67 all:    $(LIB) $(LIBSO) dirs
68
69 check:
70         echo DISTDIR: $(DISTDIR)
71         echo top_builddir: $(top_builddir)
72         $(MAKE) -C examples check
73
74 dirs:   $(SUBDIRS)
75         for dir in $^; do \
76                 $(MAKE) -C $$dir ; \
77         done
78
79 $(LIB): $(OBJECTS)
80         $(AR) $(ARFLAGS) $@ $^
81         $(RANLIB) $@
82
83 $(LIBSO):       $(OBJECTS)
84         $(LD) $(LDSOFLAGS) $(LDFLAGS) -o $@ $^
85
86 clean:
87         @rm -f $(PROGRAM) main.o $(LIB) $(LIBSO) $(OBJECTS)
88         for dir in $(SUBDIRS); do \
89                 $(MAKE) -C $$dir clean ; \
90         done
91
92 doc:
93         $(MAKE) -C doc
94
95 distclean:      clean
96         @rm -rf $(DISTDIR)
97         @rm -f *~ $(DISTDIR).tar.gz
98
99 dist:   $(FILES) $(SUBDIRS)
100         test -d $(DISTDIR) || mkdir $(DISTDIR)
101         cp $(FILES) $(DISTDIR)
102         for dir in $(SUBDIRS); do \
103                 $(MAKE) -C $$dir dist; \
104         done
105         tar czf $(package).tar.gz $(DISTDIR)
106
107 TAGS:
108         $(ETAGS) -o $@.new $(SOURCES)
109         $(ETAGS) -a -o $@.new $(HEADERS)
110         mv $@.new $@
111
112 .gitignore:
113         echo "core\n*~\n*.[oa]\n*.gz\n*.cap\n$(PROGRAM)\n$(DISTDIR)\n.gitignore" >$@