-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile.in
113 lines (95 loc) · 2.49 KB
/
Makefile.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Makefile for libcoap
#
# Copyright (C) 2010--2013 Olaf Bergmann <bergmann@tzi.org>
#
# This file is part of the CoAP library libcoap. Please see
# README for terms of use.
# the library's version
VERSION:=@PACKAGE_VERSION@
# tools
@SET_MAKE@
RANLIB=@RANLIB@
SHELL = /bin/sh
MKDIR = mkdir
ETAGS = @ETAGS@
abs_builddir = @abs_builddir@
top_builddir = @top_builddir@
package = @PACKAGE_TARNAME@-@PACKAGE_VERSION@
# files and flags
SOURCES:= pdu.c net.c debug.c encode.c uri.c coap_list.c resource.c hashkey.c \
str.c option.c async.c subscribe.c block.c
OBJECTS:= $(patsubst %.c, %.o, $(SOURCES))
HEADERS:=coap.h config.h debug.h pdu.h net.h encode.h uri.h coap_list.h mem.h \
str.h option.h bits.h uthash.h utlist.h resource.h hashkey.h async.h \
subscribe.h block.h address.h prng.h coap_time.h t_list.h
CFLAGS:=-Wall -Wextra -std=c99 -pedantic @CFLAGS@
CPPFLAGS:=@CPPFLAGS@
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) $(LIBSO) dirs
check:
echo DISTDIR: $(DISTDIR)
echo top_builddir: $(top_builddir)
$(MAKE) -C examples check
dirs: $(SUBDIRS)
for dir in $^; do \
$(MAKE) -C $$dir ; \
done
$(LIB): $(OBJECTS)
$(AR) $(ARFLAGS) $@ $^
$(RANLIB) $@
$(LIBSO): $(OBJECTS)
$(LD) $(LDSOFLAGS) $(LDFLAGS) -o $@ $^
clean:
@rm -f $(PROGRAM) main.o $(LIB) $(LIBSO) $(OBJECTS)
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir clean ; \
done
doc:
$(MAKE) -C doc
distclean: clean
@rm -rf $(DISTDIR)
@rm -f *~ $(DISTDIR).tar.gz
dist: $(FILES) $(SUBDIRS)
test -d $(DISTDIR) || mkdir $(DISTDIR)
cp $(FILES) $(DISTDIR)
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir dist; \
done
tar czf $(package).tar.gz $(DISTDIR)
TAGS:
$(ETAGS) -o $@.new $(SOURCES)
$(ETAGS) -a -o $@.new $(HEADERS)
mv $@.new $@
.gitignore:
echo "core\n*~\n*.[oa]\n*.gz\n*.cap\n$(PROGRAM)\n$(DISTDIR)\n.gitignore" >$@