65 行
1.8 KiB
Makefile
65 行
1.8 KiB
Makefile
|
BORINGSSL_DIR=/home/hdc/repos/mbedtls_vs_boringssl/bssl/src
|
||
|
BORINGSSL_LIB=$(BORINGSSL_DIR)/build
|
||
|
MBEDTLS_DIR=/home/hdc/repos/mbedtls_vs_boringssl/mbedtls/src
|
||
|
MBEDTLS_LIB=$(MBEDTLS_DIR)/build
|
||
|
|
||
|
DBG?=0
|
||
|
|
||
|
ifeq ($(DBG),1)
|
||
|
DEBUG=-DDEBUG -g -O0
|
||
|
STRIP=true
|
||
|
else
|
||
|
DEBUG=-Os -fdata-sections -ffunction-sections
|
||
|
STRIP=strip
|
||
|
endif
|
||
|
|
||
|
CC=clang
|
||
|
|
||
|
CFLAGS_COMMON=-std=c99 $(DEBUG)
|
||
|
BORINGSSL_CFLAGS=$(CFLAGS_COMMON) -I$(BORINGSSL_DIR)/ -I$(BORINGSSL_DIR)/include
|
||
|
BORINGSSL_LDFLAGS=-L$(BORINGSSL_LIB)/crypto -L$(BORINGSSL_LIB)/ssl -lssl -lcrypto -lpthread -Wl,--gc-sections
|
||
|
MBEDTLS_CFLAGS=$(CFLAGS_COMMON) -I$(MBEDTLS_DIR)/include
|
||
|
MBEDTLS_LDFLAGS=-L$(MBEDTLS_DIR)/library -lmbedx509 -lmbedtls -lmbedcrypto
|
||
|
SRCDIR=src
|
||
|
OBJDIR=obj
|
||
|
|
||
|
.PHONY: print_boring_ld print_mbed_ld
|
||
|
|
||
|
all: init server b_client m_client
|
||
|
|
||
|
init:
|
||
|
mkdir -p obj
|
||
|
# Create 1MB file with random data
|
||
|
dd if=/dev/urandom of=etc/random_data bs=1024 count=1024
|
||
|
|
||
|
clean:
|
||
|
rm -rf $(OBJDIR)
|
||
|
rm b_client
|
||
|
rm m_client
|
||
|
rm server
|
||
|
|
||
|
b_client: common
|
||
|
$(CC) -c $(SRCDIR)/b_client.c -o $(OBJDIR)/b_client.o $(BORINGSSL_CFLAGS)
|
||
|
$(CC) -o b_client $(OBJDIR)/b_client.o $(OBJDIR)/common.o $(OBJDIR)/common_boring.o $(BORINGSSL_LDFLAGS)
|
||
|
$(STRIP) b_client
|
||
|
|
||
|
m_client: common
|
||
|
$(CC) -c $(SRCDIR)/m_client.c -o $(OBJDIR)/m_client.o $(MBEDTLS_CFLAGS)
|
||
|
$(CC) -o m_client $(OBJDIR)/m_client.o $(OBJDIR)/common.o $(MBEDTLS_LDFLAGS)
|
||
|
$(STRIP) m_client
|
||
|
|
||
|
server: common
|
||
|
$(CC) -c $(SRCDIR)/server.c -o $(OBJDIR)/server.o $(BORINGSSL_CFLAGS)
|
||
|
$(CC) -o server $(OBJDIR)/server.o $(OBJDIR)/common.o $(OBJDIR)/common_boring.o $(BORINGSSL_LDFLAGS)
|
||
|
$(STRIP) server
|
||
|
|
||
|
common:
|
||
|
$(CC) -c $(SRCDIR)/common.c -o $(OBJDIR)/common.o
|
||
|
$(CC) -c $(SRCDIR)/common_boring.c -o $(OBJDIR)/common_boring.o $(BORINGSSL_CFLAGS)
|
||
|
|
||
|
print_boring_ld:
|
||
|
@echo $(BORINGSSL_LIB)/crypto:$(BORINGSSL_LIB)/ssl
|
||
|
print_mbed_ld:
|
||
|
@echo $(MBEDTLS_LIB)/crypto:$(MBEDTLS_LIB)/ssl
|
||
|
|