1# Copyright 2017-2018 Oticon A/S
2# SPDX-License-Identifier: Apache-2.0
3
4BSIM_BASE_PATH?=$(abspath ../ )
5include ${BSIM_BASE_PATH}/common/pre.make.inc
6
7unexport
8
9SOURCE_LIB_FOLDER:=$(abspath ${COMPONENT_OUTPUT_DIR}/source-1.0.2g )
10SOURCE_LIB_TAR:=source-1.0.2g.tar.gz
11
12LIB_CRYPTO:=libcrypto.a
13
14all: install
15
16.PHONY: all install compile lib clean clean_all
17
18compile: ${SOURCE_LIB_FOLDER}/${LIB_CRYPTO}
19
20lib : ${SOURCE_LIB_FOLDER}/${LIB_CRYPTO}
21
22.INTERMEDIATE: ${SOURCE_LIB_FOLDER}  ${SOURCE_LIB_FOLDER}/${LIB_CRYPTO}
23
24${SOURCE_LIB_FOLDER}/${LIB_CRYPTO}: ${SOURCE_LIB_FOLDER}
25	@echo "Compiling..."
26	@echo "This is silent on purpose... (if you have some problem compiling it, run these by hand:"
27	cd ${SOURCE_LIB_FOLDER} && setarch i386 ./config -m32 -g -fPIC no-idea no-camellia no-seed no-bf no-cast no-rc2 no-rc4 no-rc5 \
28 no-md2 no-md4 no-ripemd no-mdc2 no-dsa no-dh no-ec no-ecdsa no-ecdh no-sock no-ssl2 no-ssl3 no-err no-krb5 no-engine no-hw >& /dev/null \
29 && make MAKEFLAGS= depend &> /dev/null && make MAKEFLAGS= build_libcrypto &> /dev/null
30	@echo "Done with the crypto library.. continuing"
31
32${SOURCE_LIB_FOLDER}: ${SOURCE_LIB_TAR}
33	@echo "Seems this is the first time you compile this BabbleSim with this libCrypto component (or the component has been updated), it will be compiled now (expect 1 minute)"
34	@echo "Unpacking source files..."
35	@if [ ! -d ${COMPONENT_OUTPUT_DIR} ]; then mkdir -p ${COMPONENT_OUTPUT_DIR}; fi
36	@tar xfz ${SOURCE_LIB_TAR} --directory ${COMPONENT_OUTPUT_DIR}/
37
38${COMPONENT_OUTPUT_DIR}/${LIB_CRYPTO}: ${SOURCE_LIB_FOLDER}/${LIB_CRYPTO}
39	@cp ${SOURCE_LIB_FOLDER}/${LIB_CRYPTO} ${COMPONENT_OUTPUT_DIR}/
40	@rm ${SOURCE_LIB_FOLDER}/ -r
41
42install: ${COMPONENT_OUTPUT_DIR}/${LIB_CRYPTO}
43
44clean:
45	rm ${SOURCE_LIB_FOLDER} -r &> /dev/null; true
46
47clean_all: clean
48