Remove unused pkg dependancy
[platform/upstream/iotivity.git] / extlibs / tinydtls / Makefile.in
1 # Makefile for tinydtls
2 #
3 # Copyright (C) 2011--2014 Olaf Bergmann <bergmann@tzi.org>
4 #
5 # Permission is hereby granted, free of charge, to any person
6 # obtaining a copy of this software and associated documentation
7 # files (the "Software"), to deal in the Software without
8 # restriction, including without limitation the rights to use, copy,
9 # modify, merge, publish, distribute, sublicense, and/or sell copies
10 # of the Software, and to permit persons to whom the Software is
11 # furnished to do so, subject to the following conditions:
12 #
13 # The above copyright notice and this permission notice shall be
14 # included in all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20 # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 # SOFTWARE.
24
25 # the library's version
26 VERSION:=@PACKAGE_VERSION@
27
28 # tools
29 @SET_MAKE@
30 SHELL = /bin/sh
31 MKDIR = mkdir
32 ETAGS = @ETAGS@
33
34 prefix = @prefix@
35 exec_prefix = @exec_prefix@
36 abs_builddir = @abs_builddir@
37 top_builddir = @top_builddir@
38 libdir = @libdir@
39 includedir = @includedir@/@PACKAGE_NAME@
40 package = @PACKAGE_TARNAME@-@PACKAGE_VERSION@
41
42 install := cp
43
44 # files and flags
45 SOURCES:= dtls.c crypto.c ccm.c hmac.c netq.c peer.c dtls_time.c session.c
46 ifneq ("@NDEBUG@", "1")
47 SOURCES += debug.c
48 endif
49 SUB_OBJECTS:=aes/rijndael.o @OPT_OBJS@
50 OBJECTS:= $(patsubst %.c, %.o, $(SOURCES)) $(SUB_OBJECTS)
51 HEADERS:=dtls.h hmac.h debug.h dtls_config.h uthash.h numeric.h crypto.h global.h ccm.h \
52  netq.h t_list.h alert.h utlist.h prng.h peer.h state.h dtls_time.h session.h \
53  tinydtls.h
54 CFLAGS:=-Wall -pedantic -std=c99 @CFLAGS@
55 CPPFLAGS:=@CPPFLAGS@ -DDTLS_CHECK_CONTENTTYPE
56 SUBDIRS:=tests doc platform-specific sha2 aes ecc
57 DISTSUBDIRS:=$(SUBDIRS) examples/contiki
58 DISTDIR=$(top_builddir)/$(package)
59 FILES:=Makefile.in configure configure.in dtls_config.h.in tinydtls.h.in \
60   Makefile.tinydtls $(SOURCES) $(HEADERS)
61 LIB:=libtinydtls.a
62 LDFLAGS:=@LIBS@
63 ARFLAGS:=cru
64 doc:=doc
65
66 .PHONY: all dirs clean install dist distclean .gitignore doc TAGS
67
68 ifneq ("@WITH_CONTIKI@", "1")
69 .SUFFIXES:
70 .SUFFIXES:      .c .o
71
72 all:    $(LIB) dirs
73
74 check:  
75         echo DISTDIR: $(DISTDIR)
76         echo top_builddir: $(top_builddir)
77         $(MAKE) -C tests check
78
79 dirs:   $(SUBDIRS)
80         for dir in $^; do \
81                 $(MAKE) -C $$dir ; \
82         done
83
84 $(SUB_OBJECTS)::
85         $(MAKE) -C $(@D) $(@F)
86
87 $(LIB): $(OBJECTS)
88         $(AR) $(ARFLAGS) $@ $^ 
89         ranlib $@
90
91 clean:
92         @rm -f $(PROGRAM) main.o $(LIB) $(OBJECTS)
93         for dir in $(SUBDIRS); do \
94                 $(MAKE) -C $$dir clean ; \
95         done
96 else  # WITH_CONTIKI
97 all:
98         $(MAKE) -C examples/contiki $@
99 endif # WITH_CONTIKI
100
101 doc:    
102         $(MAKE) -C doc
103
104 distclean:      clean
105         @rm -rf $(DISTDIR)
106         @rm -f *~ $(DISTDIR).tar.gz
107
108 dist:   $(FILES) $(DISTSUBDIRS)
109         test -d $(DISTDIR) || mkdir $(DISTDIR)
110         cp $(FILES) $(DISTDIR)
111         for dir in $(DISTSUBDIRS); do \
112                 $(MAKE) -C $$dir dist; \
113         done
114         tar czf $(package).tar.gz $(DISTDIR)
115
116 install:        $(LIB) $(HEADERS) $(SUBDIRS)
117         test -d $(libdir) || mkdir -p $(libdir)
118         test -d $(includedir) || mkdir -p $(includedir)
119         $(install) $(LIB) $(libdir)/
120         $(install) $(HEADERS) $(includedir)/
121         for dir in $(SUBDIRS); do \
122                 $(MAKE) -C $$dir install="$(install)" includedir=$(includedir) install; \
123         done
124
125 TAGS:   
126         $(ETAGS) -o $@.new $(SOURCES) 
127         $(ETAGS) -a -o $@.new $(HEADERS) 
128         mv $@.new $@
129
130 # files that should be ignored by git
131 GITIGNOREDS:= core \*~ \*.[oa] \*.gz \*.cap \*.pcap Makefile \
132  autom4te.cache/ config.h config.log config.status configure \
133  doc/Doxyfile doc/doxygen.out doc/html/ $(LIB) tests/ccm-test \
134  tests/dtls-client tests/dtls-server tests/prf-test $(package) \
135  $(DISTDIR)/ TAGS \*.patch .gitignore ecc/testecc ecc/testfield \
136  \*.d \*.hex \*.elf \*.map obj_\* tinydtls.h dtls_config.h \
137  $(addprefix \*., $(notdir $(wildcard ../../platform/*))) \
138  .project
139
140 .gitignore:
141         echo $(GITIGNOREDS) | sed 's/ /\n/g' > $@
142