1SOURCES = dunnel.c dtls.c sock.c util.c
2OBJECTS = $(SOURCES:.c=.o)
3HEADERS = fns.h dat.h
4
5CFLAGS ?= -O0 -g
6CFLAGS += -std=c99 -Wpedantic -Wall -Wextra \
7 -D_POSIX_C_SOURCE=200112L -DSHA2_USE_INTTYPES_H -I ./tinydtls
8
9LDFLAGS += -ltinydtls -L ./tinydtls
10
11ifeq "$(findstring clang,$(shell $(CC) --version))" "clang"
12 CFLAGS += -Weverything
13endif
14
15dunnel: $(OBJECTS)
16 $(CC) -o $@ $^ $(LDFLAGS)
17$(OBJECTS): $(HEADERS) tinydtls/libtinydtls.a
18
19tinydtls/Makefile:
20 cd tinydtls && autoconf
21 cd tinydtls && autoheader
22 cd tinydtls && ./configure --without-ecc
23
24tinydtls/libtinydtls.a: tinydtls/Makefile
25 $(MAKE) CFLAGS="$(CFLAGS) -Wno-error" \
26 -C "$(shell dirname $<)" "$(shell basename $@)"
27
28%.o: %.c
29 $(CC) -c $< $(CFLAGS)