3 # Copyright (C) 2010--2013 Olaf Bergmann <bergmann@tzi.org>
5 # This file is part of the CoAP library libcoap. Please see
6 # README for terms of use.
8 # the library's version
9 VERSION:=@PACKAGE_VERSION@
18 abs_builddir = @abs_builddir@
19 top_builddir = @top_builddir@
20 package = @PACKAGE_TARNAME@-@PACKAGE_VERSION@
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 @CFLAGS@
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)
43 MACHINE?=$(shell $(CC) -dumpmachine)
44 ifeq ($(findstring Darwin, $(MACHINE)), Darwin)
48 ifeq ($(findstring Windows, $(MACHINE)), Windows)
51 # more platforms go here
62 .PHONY: all dirs clean distclean .gitignore doc TAGS
67 all: $(LIB) $(LIBSO) dirs
70 echo DISTDIR: $(DISTDIR)
71 echo top_builddir: $(top_builddir)
72 $(MAKE) -C examples check
80 $(AR) $(ARFLAGS) $@ $^
84 $(LD) $(LDSOFLAGS) $(LDFLAGS) -o $@ $^
87 @rm -f $(PROGRAM) main.o $(LIB) $(LIBSO) $(OBJECTS)
88 for dir in $(SUBDIRS); do \
89 $(MAKE) -C $$dir clean ; \
97 @rm -f *~ $(DISTDIR).tar.gz
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; \
105 tar czf $(package).tar.gz $(DISTDIR)
108 $(ETAGS) -o $@.new $(SOURCES)
109 $(ETAGS) -a -o $@.new $(HEADERS)
113 echo "core\n*~\n*.[oa]\n*.gz\n*.cap\n$(PROGRAM)\n$(DISTDIR)\n.gitignore" >$@