blob: 7da1d84bab833852ead0456499e274548035ecfc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
##
## Makefile for libkmip
##
.POSIX:
.SUFFIXES:
SRCDIR = .
BINDIR = $(SRCDIR)/bin
MAJOR = 0
MINOR = 2
MICRO = 0
VERSION = $(MAJOR).$(MINOR)
ARCNAME = libkmip.a
LINKNAME = libkmip.so
SONAME = $(LINKNAME).$(MAJOR)
LIBNAME = $(LINKNAME).$(VERSION)
LIBS = $(LIBNAME) $(ARCNAME)
CC = cc
#CFLAGS = -std=c11 -pedantic -g3 -Og -Wall -Wextra -D_POSIX_C_SOURCE
CFLAGS = -std=c11 -pedantic -g3 -Wall -Wextra -D_POSIX_C_SOURCE
LOFLAGS = -fPIC
SOFLAGS = -shared -Wl,-soname,$(SONAME)
LDFLAGS = -L/usr/local/lib
LDLIBS = -lssl -lcrypto
AR = ar csrv
DESTDIR =
PREFIX = /usr/local
KMIP = kmip
OFILES = kmip.o kmip_memset.o kmip_bio.o
LOFILES = kmip.lo kmip_memset.lo kmip_bio.lo
all: demos tests $(LIBS)
test: tests
$(SRCDIR)/tests
install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin/$(KMIP)
mkdir -p $(DESTDIR)$(PREFIX)/include/$(KMIP)
mkdir -p $(DESTDIR)$(PREFIX)/lib
mkdir -p $(DESTDIR)$(PREFIX)/src/$(KMIP)
mkdir -p $(DESTDIR)$(PREFIX)/share/doc/$(KMIP)/src
cp demo_create $(DESTDIR)$(PREFIX)/bin/$(KMIP)
cp demo_get $(DESTDIR)$(PREFIX)/bin/$(KMIP)
cp demo_destroy $(DESTDIR)$(PREFIX)/bin/$(KMIP)
cp tests $(DESTDIR)$(PREFIX)/bin/$(KMIP)
cp -r $(SRCDIR)/docs/source/. $(DESTDIR)$(PREFIX)/share/doc/$(KMIP)/src
cp $(SRCDIR)/*.c $(DESTDIR)$(PREFIX)/src/$(KMIP)
cp $(SRCDIR)/*.h $(DESTDIR)$(PREFIX)/include/$(KMIP)
cp $(SRCDIR)/$(LIBNAME) $(DESTDIR)$(PREFIX)/lib
cp $(SRCDIR)/$(ARCNAME) $(DESTDIR)$(PREFIX)/lib
cd $(DESTDIR)$(PREFIX)/lib && ln -sf $(LIBNAME) $(LINKNAME) && cd -
install_html_docs: html_docs
mkdir -p $(DESTDIR)$(PREFIX)/share/doc/$(KMIP)/html
cp -r $(SRCDIR)/docs/build/html/. $(DESTDIR)$(PREFIX)/share/doc/$(KMIP)/html
uninstall:
rm -rf $(DESTDIR)$(PREFIX)/bin/$(KMIP)
rm -rf $(DESTDIR)$(PREFIX)/include/$(KMIP)
rm -rf $(DESTDIR)$(PREFIX)/src/$(KMIP)
rm -rf $(DESTDIR)$(PREFIX)/share/doc/$(KMIP)
rm -r $(DESTDIR)$(PREFIX)/lib/$(LINKNAME)*
rm -r $(DESTDIR)$(PREFIX)/lib/$(ARCNAME)
uninstall_html_docs:
rm -rf $(DESTDIR)$(PREFIX)/share/doc/$(KMIP)/html
docs: html_docs
html_docs:
cd $(SRCDIR)/docs && make html && cd -
demos: demo_create demo_get demo_destroy
demo_get: demo_get.o $(OFILES)
$(CC) $(LDFLAGS) -o demo_get demo_get.o $(OFILES) $(LDLIBS)
demo_create: demo_create.o $(OFILES)
$(CC) $(LDFLAGS) -o demo_create demo_create.o $(OFILES) $(LDLIBS)
demo_destroy: demo_destroy.o $(OFILES)
$(CC) $(LDFLAGS) -o demo_destroy demo_destroy.o $(OFILES) $(LDLIBS)
tests: tests.o kmip.o kmip_memset.o
$(CC) $(LDFLAGS) -o tests tests.o kmip.o kmip_memset.o
demo_get.o: demo_get.c kmip_memset.h kmip.h
demo_create.o: demo_create.c kmip_memset.h kmip.h
demo_destroy.o: demo_destroy.c kmip_memset.h kmip.h
tests.o: tests.c kmip_memset.h kmip.h
$(LIBNAME): $(LOFILES)
$(CC) $(CFLAGS) $(SOFLAGS) -o $@ $(LOFILES)
$(ARCNAME): $(OFILES)
$(AR) $@ $(OFILES)
kmip.o: kmip.c kmip.h kmip_memset.h
kmip.lo: kmip.c kmip.h kmip_memset.h
kmip_memset.o: kmip_memset.c kmip_memset.h
kmip_memset.lo: kmip_memset.c kmip_memset.h
kmip_bio.o: kmip_bio.c kmip_bio.h
kmip_bio.lo: kmip_bio.c kmip_bio.h
clean:
rm -f *.o *.lo
clean_html_docs:
cd docs && make clean && cd ..
cleanest:
rm -f demo_create demo_get demo_destroy tests *.o $(LOFILES) $(LIBS)
cd docs && make clean && cd ..
.SUFFIXES: .c .o .lo .so
.c.o:
$(CC) $(CFLAGS) -c $<
.c.lo:
$(CC) $(CFLAGS) $(LOFLAGS) -c $< -o $@
#.lo.so:
# $(CC) $(CFLAGS) $(SOFLAGS) -o $@ $?
|