ctr_eFuse/trunk/hsm_utils/Makefile
n2460 ef3720f6a9 hsm_utils:small fix
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_eFuse@230 ff987cc8-cf2f-4642-8568-d52cce064691
2013-10-09 11:39:01 +00:00

136 lines
4.6 KiB
Makefile

# Simple makefile for example programs under gcc
#
# Build these with 'make -f Makefile-examples'
#
# Copyright 1997-2008 nCipher Corporation Limited.
#
# This file is example source code. It is provided for your
# information and assistance. See the file LICENCE.TXT for details and the
# terms and conditions of the licence which governs the use of the
# source code. By using such source code you will be accepting these
# terms and conditions. If you do not wish to accept these terms and
# conditions, DO NOT OPEN THE FILE OR USE THE SOURCE CODE.
#
# Note that there is NO WARRANTY.
#
# -------------------------------
#
# Set NFAST_PATH to installation directory of the headers and libraries
NFAST_PATH= /opt/nfast
# Developer tools installation
NFAST_DEV_PATH= $(NFAST_PATH)/c/ctd/gcc
NFAST_EXAMPLES_PATH= $(NFAST_PATH)/c/ctd/examples
# We now have a single library directory, not one per component, in an
# installation, but may be using different paths per component in
# testing.
LIBPATH_SWORLD= $(NFAST_DEV_PATH)/lib
LIBPATH_HILIBS= $(NFAST_DEV_PATH)/lib
LIBPATH_NFLOG= $(NFAST_DEV_PATH)/lib
LIBPATH_CUTILS= $(NFAST_DEV_PATH)/lib
INC_SWORLD= $(NFAST_DEV_PATH)/include/sworld
INC_HILIBS= $(NFAST_DEV_PATH)/include/hilibs
INC_NFLOG= $(NFAST_DEV_PATH)/include/nflog
INC_CUTILS= $(NFAST_DEV_PATH)/include/cutils
EXAMPLES_SWORLD= $(NFAST_EXAMPLES_PATH)/sworld
EXAMPLES_HILIBS= $(NFAST_EXAMPLES_PATH)/hilibs
EXAMPLES_NFLOG= $(NFAST_EXAMPLES_PATH)/nflog
EXAMPLES_CUTILS= $(NFAST_EXAMPLES_PATH)/cutils
# openssl
OPENSSL_DIR = ../openssl-1.0.0-beta5
# Where the source lives
SRCPATH = .
REFPATH = $(NFAST_PATH)/c/ctd/examples/nfuser/build-gcc-lib
CC = gcc
CPPFLAGS= -I$(SRCPATH) \
-I$(INC_SWORLD) \
-I$(INC_HILIBS) \
-I$(INC_NFLOG) \
-I$(INC_CUTILS) \
-I$(EXAMPLES_SWORLD) \
-I$(EXAMPLES_HILIBS) \
-I$(EXAMPLES_NFLOG) \
-I$(EXAMPLES_CUTILS) \
$(XCPPFLAGS) \
-I$(OPENSSL_DIR)/include \
-I$(OPENSSL_DIR)/crypto/ec \
CFLAGS= -g -O2 -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -D_GNU_SOURCE -Wno-nonnull -O2 -fPIC -Wno-nonnull $(XCFLAGS)
# -Werror -> N/A
LINK= gcc
LDFLAGS= $(XLDFLAGS) -L$(OPENSSL_DIR)
LDFLAGS_THREADED= $(LDFLAGS) $(XLDFLAGS_THREADED)
LDLIBS= $(XLDLIBS) -lcrypto -lssl -ldl -lnsl
LDLIBS_THREADED= $(XLDLIBS_THREADED) -lpthread $(LDLIBS)
# Targets ------------------------
all: simple
XLDLIBS= $(LIBPATH_SWORLD)/librqcard.a \
$(LIBPATH_SWORLD)/libnfkm.a \
$(LIBPATH_HILIBS)/libnfstub.a \
$(LIBPATH_NFLOG)/libnflog.a \
$(LIBPATH_CUTILS)/libcutils.a -lm
COMMON_OBJECTS = $(REFPATH)/nfutil.o $(REFPATH)/nfopt.o $(REFPATH)/getdate.o $(REFPATH)/report.o $(REFPATH)/report-usage.o $(REFPATH)/nftypes.o $(REFPATH)/tokenise.o
EXTRA_OBJECTS = my_hsm_bignum.o my_hsm_alloc.o my_hsm_setup.o
COMMON_HEADERS= $(REFPATH)/nfutil.h $(REFPATH)/nfopt.h $(REFPATH)/nftypes.h $(REFPATH)/tokenise.h
# We supply an up-to-date getdate.c in the cutils component. Prevent it
# from being automatically rebuilt in the case where getdate.y's mtime
# is (usually accidentally) newer; if you want to modify it, do so in
# cutils.
$(SRCPATH)/getdate.c: ;
# Simple (non-threaded) programs ------------
my_hsm_bignum.o: my_hsm_bignum.c
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o my_hsm_bignum.o -c my_hsm_bignum.c
my_hsm_alloc.o: my_hsm_alloc.c
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o my_hsm_alloc.o -c my_hsm_alloc.c
my_hsm_setup.o: my_hsm_setup.c
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o my_hsm_setup.o -c my_hsm_setup.c
import_aes_key: import_aes_key.c $(EXTRA_OBJECTS)
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o import_aes_key import_aes_key.c $(COMMON_OBJECTS) $(EXTRA_OBJECTS) $(LDLIBS)
import_rsa_keypair: import_rsa_keypair.c $(EXTRA_OBJECTS)
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o import_rsa_keypair import_rsa_keypair.c $(COMMON_OBJECTS) $(EXTRA_OBJECTS) $(LDLIBS)
import_ecdsa_keypair: import_ecdsa_keypair.c $(EXTRA_OBJECTS)
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o import_ecdsa_keypair import_ecdsa_keypair.c $(COMMON_OBJECTS) $(EXTRA_OBJECTS) $(LDLIBS)
sign_verify_rsa_pkcs1_sha256: sign_verify_rsa_pkcs1_sha256.c $(EXTRA_OBJECTS)
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o sign_verify_rsa_pkcs1_sha256 sign_verify_rsa_pkcs1_sha256.c $(COMMON_OBJECTS) $(EXTRA_OBJECTS) $(LDLIBS)
# All single-threaded targets
TARGETS_SIMPLE= \
import_aes_key \
import_rsa_keypair \
import_ecdsa_keypair \
sign_verify_rsa_pkcs1_sha256 \
simple: $(TARGETS_SIMPLE)
# Secondary targets ------------------------
clean:
rm -f *.o
rm -f $(TARGETS_SIMPLE)