bsdmake for cw
This commit is contained in:
parent
6929741620
commit
718dcbd45c
@ -1,5 +1,8 @@
|
||||
#.ifndef ARCH
|
||||
|
||||
ARCH!=uname -m
|
||||
KERNEL!=uname -s
|
||||
|
||||
#.endif
|
||||
|
||||
|
||||
|
@ -1,41 +1,6 @@
|
||||
include ../Defs.mak
|
||||
include ../CWConfig.mak
|
||||
-include ../Config.local.mak
|
||||
include ../Macros.mak
|
||||
|
||||
|
||||
LIBDIR := ../../lib
|
||||
LIBARCHDIR := $(LIBDIR)/$(ARCH)
|
||||
OBJDIR := ../../obj/cw/$(ARCH)
|
||||
|
||||
SNAME := $(LIBARCHDIR)/libcw.a
|
||||
DNAME := $(LIBARCHDIR)/libcw.so
|
||||
|
||||
LIBS=
|
||||
|
||||
ifeq ($(WITH_OPENSSL),1)
|
||||
CFLAGS+=$(OPENSSL_CFLAGS)
|
||||
CFLAGS+=-DWITH_OPENSSL
|
||||
DTLSSRC += dtls_openssl.c \
|
||||
dtls_openssl_accept.c \
|
||||
dtls_openssl_connect.c \
|
||||
dtls_openssl_get_cipher.c \
|
||||
dtls_openssl_bio.c
|
||||
LIBS+=-lssl
|
||||
endif
|
||||
|
||||
ifeq ($(WITH_GNUTLS),1)
|
||||
CFLAGS+=$(GNUTLS_CFLAGS)
|
||||
CFLAGS+=-DWITH_GNUTLS
|
||||
DTLSSRC+= dtls_gnutls.c \
|
||||
dtls_gnutls_accept.c \
|
||||
dtls_gnutls_connect.c \
|
||||
dtls_gnutls_bio.c \
|
||||
dtls_gnutls_get_cipher.c \
|
||||
dtls_gnutls_get_peers_cert.c
|
||||
LIBS+=-lgnutls
|
||||
endif
|
||||
|
||||
|
||||
CWSRC=\
|
||||
cw_check_missing_mand.c\
|
||||
@ -277,58 +242,21 @@ RADIOSRC=\
|
||||
|
||||
|
||||
#SRC=$(wildcard *.c)
|
||||
SRC = $(CWSRC) $(LWSRC) $(MAVLSRC) $(MLISTSRC) $(SOCKSRC) $(LOGSRC) $(DTLSSRC) $(RADIOSRC) $(KTVSRC) $(MISCSRC)
|
||||
|
||||
OBJS=$(patsubst %.c,%.o,$(SRC))
|
||||
OBJS:=$(patsubst %.o,$(OBJDIR)/%.o,$(OBJS))
|
||||
|
||||
|
||||
all: $(SNAME) $(DNAME)
|
||||
|
||||
|
||||
CFLAGS += $(GNUTLS_CFLAGS) \
|
||||
-DWITH_CW_LOG \
|
||||
-DWITH_CW_LOG_DEBUG \
|
||||
-DWITH_DTLS
|
||||
|
||||
|
||||
$(OBJDIR)/%.o:%.c
|
||||
@mkdir -p $(OBJDIR)
|
||||
@echo " $(CC) "$<
|
||||
@$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
$(SNAME) : $(OBJS)
|
||||
@mkdir -p $(LIBARCHDIR)
|
||||
@echo " $(AR) $(SNAME)"
|
||||
@$(AR) rcs $(SNAME) $(OBJS)
|
||||
|
||||
$(DNAME) : $(OBJS)
|
||||
@mkdir -p $(LIBARCHDIR)
|
||||
@echo " $(LD) $(DNAME)"
|
||||
@$(LD) $(LDFLAGS) -shared -o $(DNAME) $(OBJS) $(LIBS)
|
||||
|
||||
|
||||
SRCS = $(OBJS:.o=.c)
|
||||
DEPS := $(OBJS:.o=.d)
|
||||
|
||||
|
||||
.PHONY: deps clean clean_libs libs
|
||||
SOURCES = $(CWSRC) $(LWSRC) $(MAVLSRC) $(MLISTSRC) $(SOCKSRC) $(LOGSRC) $(DTLSSRC) $(RADIOSRC) $(KTVSRC) $(MISCSRC)
|
||||
|
||||
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJDIR)/*
|
||||
$(RM) $(DNAME)
|
||||
$(RM) $(SNAME)
|
||||
|
||||
|
||||
clean_deps:
|
||||
$(DEPS)
|
||||
|
||||
deps:
|
||||
echo "# DO NOT DELETE THIS LINE -- make depend depends on it." > .depend
|
||||
makedepend $(SRC) -f.depend -p$(OBJDIR)/
|
||||
LIBDIR := ../../lib
|
||||
LIBARCHDIR := $(LIBDIR)/$(KERNEL)/$(ARCH)
|
||||
OBJDIR := ../../obj/cw/$(KERNEL)/$(ARCH)
|
||||
|
||||
SNAME := $(LIBARCHDIR)/libcw.a
|
||||
DNAME := $(LIBARCHDIR)/libcw.so
|
||||
|
||||
-include .depend
|
||||
CFLAGS+=-fPIC
|
||||
|
||||
all: $(SNAME) $(DNAME)
|
||||
|
||||
include ../lib.mk
|
||||
|
||||
|
49
src/lib.mk
Normal file
49
src/lib.mk
Normal file
@ -0,0 +1,49 @@
|
||||
MF=Mf-$(KERNEL)-$(ARCH).mk
|
||||
|
||||
LIBTARGET=$(OBJDIR)/$(PROG)
|
||||
|
||||
|
||||
$(SNAME): $(MF) $(SOURCES)
|
||||
@mkdir -p $(OBJDIR)
|
||||
@mkdir -p $(LIBARCHDIR)
|
||||
@$(MAKE) -f $(MF) $(SNAME)
|
||||
|
||||
$(DNAME): $(MF) $(SOURCES)
|
||||
@mkdir -p $(OBJDIR)
|
||||
@mkdir -p $(LIBARCHDIR)
|
||||
@$(MAKE) -f $(MF) $(DNAME)
|
||||
|
||||
$(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 "$(SNAME) : \$$(OBJS)" >> $(MF)
|
||||
@echo " \$$(AR) rcs $(SNAME) \$$(OBJS)" >> $(MF)
|
||||
@echo "" >> $(MF)
|
||||
@echo "$(DNAME) : \$$(OBJS)" >> $(MF)
|
||||
@echo " \$$(LD) \$$(LDFLAGS) -shared -o $(DNAME) \$$(OBJS) $(LIBS)" >> $(MF)
|
||||
@echo "" >> $(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 $(SNAME)
|
||||
rm -f $(DNAME)
|
||||
rm -f $(MF)
|
||||
|
||||
install: $(PROGTARGET)
|
||||
mkdir -p $(INSTALL_BINDIR)
|
||||
install $(PROGTARGET) $(INSTALL_BINDIR)/$(PROG)
|
||||
|
Loading…
Reference in New Issue
Block a user