For BSDMake

shell
7u83 7 months ago
parent bef5391c9f
commit 6929741620
  1. 4
      src/CWConfig.mak
  2. 6
      src/Defs.mak
  3. 2
      src/WtpConfig.mak
  4. 4
      src/cw/dtls.h
  5. 37
      src/prog.mk
  6. 83
      src/wtp/Makefile
  7. 1
      src/wtp/join.c

@ -1,4 +1,4 @@
include ../Config.mak
include ../Config.default.mak
WITH_GNUTLS=1
WITH_OPENSSL=1
WITH_OPENSSL=0

@ -1,5 +1,5 @@
ifndef ARCH
ARCH = $(shell uname -m)
endif
#.ifndef ARCH
ARCH!=uname -m
#.endif

@ -4,7 +4,7 @@ include ../Config.mak
# Define witch SSL library to use
# OPENSSL or GNUTLS
#
SSL_LIBRARY=OPENSSL
SSL_LIBRARY=GNUTLS
CFLAGS += -I/usr/include/libnl3
CFLAGS += -I../contrib/uci

@ -24,7 +24,7 @@
#ifdef WITH_GNUTLS
#if WITH_GNUTLS
#include "dtls_gnutls.h"
#define dtls_init dtls_gnutls_init
#define dtls_accept dtls_gnutls_accept
@ -34,7 +34,7 @@
#define dtls_get_peers_cert dtls_gnutls_get_peers_cert
#endif
#ifdef WITH_OPENSSL
#if WITH_OPENSSL
#include "dtls_openssl.h"
#define dtls_init dtls_openssl_init
#define dtls_accept dtls_openssl_accept

@ -0,0 +1,37 @@
MF=stage.mk
PROGTARGET=$(OBJDIR)/$(PROG)
$(PROGTARGET): $(MF) $(SOURCES)
@mkdir -p $(OBJDIR)
@$(MAKE) -f $(MF)
$(MF): Makefile
@rm -f $(MF)
@echo "CFLAGS=$(CFLAGS)" >> $(MF)
@echo "LDFLAGS=$(LDFLAGS)" >> $(MF)
@echo -n "OBJS=" >> $(MF)
@for f in $(SOURCES) ; do \
OF=$(OBJDIR)/`basename "$${f%.*}.o"` ; \
echo -n " $${OF}" >> $(MF) ;\
done
@echo "" >> $(MF)
@echo "$(PROGTARGET): \$$(OBJS)" >> $(MF)
@echo " \$$(CC) -o $(PROGTARGET) \$$(LDFLAGS) \$$(OBJS) $(LIBS)" >> $(MF)
@for f in $(SOURCES) ; do \
OF=$(OBJDIR)/`basename "$${f%.*}.o"` ; \
echo $${OF}: $$f >> $(MF) ; \
echo " \$$(CC) -c \$$(CFLAGS) -o $${OF} $${f}" >> $(MF) ; \
done
clean:
rm -rf $(OBJDIR)
rm -f $(PROGTARGET)
rm -f $(MF)
install: $(PROGTARGET)
mkdir -p $(INSTALL_BINDIR)
install $(PROGTARGET) $(INSTALL_BINDIR)/$(PROG)

@ -1,77 +1,22 @@
#include ../Defs.mak
#include ../Config.mak
#include ../WtpConfig.mak
#-include ../Config.local.mak
#-include ../WtpConfig.local.mak
#include ../Macros.mak
include ../Config.default.mak
-include ../Config.mak
INCL_DIRS=-I../
include ../Defs.mak
PROG=wtp
OBJDIR=./o
LIBDIR := ../../lib
LIBARCHDIR := $(LIBDIR)/$(ARCH)
OBJDIR := ../../obj/wtp/$(ARCH)
EXENAME := ./wtp
LIBS := -lcw -lnettle
#STATICLIBS := $(LIBDIR)/$(ARCH)/libcw.a
LDFLAGS += -L$(LIBARCHDIR) -L/usr/local/lib
#ifeq ($(SSL_LIBRARY),GNUTLS)
#CFLAGS+=-DWITH_GNUTLS
#CFLAGS+=$(GNUTLS_CFLAGS)
#LIBS+=$(GNUTLS_LIBS)
#LDFLAGS+=$(GNUTLS_LDFLAGS)
#endif
#ifeq ($(SSL_LIBRARY),OPENSSL)
CFLAGS+=-DWITH_OPENSSL
CFLAGS+=$(OPESSL_CFLAGS)
LDFLAGS+=$(OPENSSL_LDFLAGS)
LIBS+=$(OPENSSL_LIBS)
#endif
#SRC=$(wildcard *.c)
OBJS=\
wtp_main.o\
discovery.o\
join.o\
configure.o\
run.o\
changestate.o\
#OBJS=$(patsubst %.c,%.o,$(SRC))
#OBJS:=$(patsubst %.o,$(OBJDIR)/%.o,$(OBJS))
ALL=$(EXENAME)
all: $(ALL)
#$(OBJDIR)/%.o:%.c
.c.o:
# @mkdir -p $(OBJDIR)
@echo " $(CC) "$<
@$(CC) $(INCL_DIRS) -c $(CFLAGS) $< -o $@
$(EXENAME): $(OBJS)
echo " $(CC) $(EXENAME)"
$(CC) $(LDFLAGS) -o $(EXENAME) $(OBJS) $(LIBS) $(STATICLIBS)
CFLAGS+=-I../ -DWITH_GNUTLS
LDFLAGS=-L$(LIBARCHDIR)
LIBS=-lcw -lnettle -lgnutls -ldl
clean:
rm -f *.o
# rm $(OBJDIR)/*
rm -f $(EXENAME)
SOURCES=\
wtp_main.c\
discovery.c\
join.c\
configure.c\
run.c\
changestate.c
deps:
echo "# DO NOT DELETE THIS LINE -- make depend depends on it." > .depend
makedepend $(SRC) -f.depend -p$(OBJDIR)/
-include .depend
include ../prog.mk

@ -12,7 +12,6 @@
#include "cw/log.h"
#include "cw/dbg.h"
#include "cw/sock.h"
#include "cw/dtls.h"
#include "cw/mavl.h"
#include "wtp.h"

Loading…
Cancel
Save