# 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-0.9.8k # 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)/simplecmd.o $(REFPATH)/simplebignum.o $(REFPATH)/nfutil.o $(REFPATH)/nfopt.o $(REFPATH)/getdate.o $(REFPATH)/report.o $(REFPATH)/report-usage.o $(REFPATH)/nftypes.o $(REFPATH)/tokenise.o COMMON_HEADERS= $(REFPATH)/simplecmd.h $(REFPATH)/simplebignum.h $(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 ------------ import_common_key: import_common_key.c $(CC) $(CFLAGS) $(CPPFLAGS) -o import_common_key import_common_key.c $(COMMON_OBJECTS) $(LDLIBS) import_asymmetric_key: import_asymmetric_key.c $(CC) $(CFLAGS) $(CPPFLAGS) -o import_asymmetric_key import_asymmetric_key.c $(COMMON_OBJECTS) $(LDLIBS) # All single-threaded targets TARGETS_SIMPLE= \ import_common_key \ import_asymmetric_key \ simple: $(TARGETS_SIMPLE) # Secondary targets ------------------------ clean: rm -f *.o rm -f $(TARGETS_SIMPLE)