From 6e6fafa6663724240e202ee95908b476e7443075 Mon Sep 17 00:00:00 2001 From: Miloslav Trmač Date: Sat, 7 Aug 2010 07:14:40 +0200 Subject: Abstract from users Let users #include this header file alone, without caring about . To do so, set up a temporary copy of ncr.h so that the #include works at build time as well. --- .gitignore | 1 + examples/Makefile | 2 +- userspace/Makefile | 10 ++++++++-- userspace/ncrypto.h | 2 ++ userspace/ncrypto_fd.c | 2 +- userspace/ncrypto_generate_params.c | 2 +- userspace/ncrypto_key.c | 2 +- userspace/ncrypto_masterkey.c | 2 +- userspace/ncrypto_params.c | 2 +- userspace/ncrypto_session.c | 2 +- 10 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index d6b0962..e293651 100644 --- a/.gitignore +++ b/.gitignore @@ -19,5 +19,6 @@ scripts userspace/ncr-setkey userspace/libcryptodev.so userspace/libcryptodev.so.* +userspace/linux version.h tags diff --git a/examples/Makefile b/examples/Makefile index fb07989..33a67bc 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -Wall -g -O2 +CFLAGS = -Wall -g -O2 -I../userspace GNUTLS_LDFLAGS = -L/usr/local/lib -lgnutls USERSPACE_LDFLAGS = -L../userspace -lcryptodev diff --git a/userspace/Makefile b/userspace/Makefile index b87bf0c..9156205 100644 --- a/userspace/Makefile +++ b/userspace/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -Wall -g -O2 -fPIC +CFLAGS = -I. -Wall -g -O2 -fPIC progs := ncr-setkey @@ -15,5 +15,11 @@ libcryptodev.so: ${libobj} ln -sf libcryptodev.so.0.0 libcryptodev.so.0 ln -sf libcryptodev.so.0.0 libcryptodev.so +$(libobj): linux/ncr.h + +linux/ncr.h: ../ncr.h + mkdir -p linux + cp $< linux/ncr.h + clean: - rm -f *.o *~ libcryptodev.so* ncr-setkey + rm -rf *.o *~ libcryptodev.so* ncr-setkey linux diff --git a/userspace/ncrypto.h b/userspace/ncrypto.h index 9e32291..752824d 100644 --- a/userspace/ncrypto.h +++ b/userspace/ncrypto.h @@ -2,6 +2,8 @@ #ifndef __NCRYPT_H__ #define __NCRYPT_H__ +#include + #define NCR_DATA_GET_LAST 1 //#define NCR_DATA_SET_APPEND 1 #define NCR_SESSION_FINAL 1 diff --git a/userspace/ncrypto_fd.c b/userspace/ncrypto_fd.c index ce925cf..7e6741d 100644 --- a/userspace/ncrypto_fd.c +++ b/userspace/ncrypto_fd.c @@ -3,7 +3,7 @@ #include #include #include -#include "../ncr.h" +#include #include "ncrypto.h" int __ncr_file_descriptor = -1; diff --git a/userspace/ncrypto_generate_params.c b/userspace/ncrypto_generate_params.c index 5772aaf..9dd901d 100644 --- a/userspace/ncrypto_generate_params.c +++ b/userspace/ncrypto_generate_params.c @@ -2,7 +2,7 @@ #include #include #include -#include "../ncr.h" +#include #include "ncrypto.h" int diff --git a/userspace/ncrypto_key.c b/userspace/ncrypto_key.c index 924ac22..5321c78 100644 --- a/userspace/ncrypto_key.c +++ b/userspace/ncrypto_key.c @@ -3,7 +3,7 @@ #include #include #include -#include "../ncr.h" +#include #include "ncrypto.h" extern int __ncr_file_descriptor; diff --git a/userspace/ncrypto_masterkey.c b/userspace/ncrypto_masterkey.c index a5c55c3..5910ac0 100644 --- a/userspace/ncrypto_masterkey.c +++ b/userspace/ncrypto_masterkey.c @@ -3,7 +3,7 @@ #include #include #include -#include "../ncr.h" +#include #include "ncrypto.h" extern int __ncr_file_descriptor; diff --git a/userspace/ncrypto_params.c b/userspace/ncrypto_params.c index f5385f4..6fb49f2 100644 --- a/userspace/ncrypto_params.c +++ b/userspace/ncrypto_params.c @@ -3,7 +3,7 @@ #include #include #include -#include "../ncr.h" +#include #include "ncrypto.h" int diff --git a/userspace/ncrypto_session.c b/userspace/ncrypto_session.c index e37aa21..e14dba2 100644 --- a/userspace/ncrypto_session.c +++ b/userspace/ncrypto_session.c @@ -3,7 +3,7 @@ #include #include #include -#include "../ncr.h" +#include #include "ncrypto.h" extern int __ncr_file_descriptor; -- cgit