summaryrefslogtreecommitdiff
blob: d990a2ea443fed8cfcc43ee356de7af442aef432 (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
Respect host build env

--- matrixssl/src/Makefile
+++ matrixssl/src/Makefile
@@ -15,7 +15,7 @@
 E       =
 
 LIBRARY	= libmatrixssl$(SO)
-STATIC	= libmatrixsslstatic$(A)
+STATIC	= libmatrixssl$(A)
 
 OBJECTS	= \
 		cipherSuite$(O) \
@@ -51,5 +51,6 @@
 else
 #DFLAGS	= -Os
-DFLAGS	= -O3
+DFLAGS	:= $(CFLAGS)
+STRIP	= test
 endif
 
@@ -62,6 +63,6 @@
 #	Override variables for compilation on x86-64 (AMD64, Nacona, etc)
 #
-ifeq ($(shell uname -m),x86_64)
-DFLAGS  += -march=k8 -fPIC -DFP_64BIT -DTFM_X86_64 -DRDTSC
+ifeq ($(findstring x86_64-,$(CHOST)),x86_64-)
+DFLAGS  += -fPIC -DFP_64BIT -DTFM_X86_64 -DRDTSC
 endif
 
@@ -69,17 +70,17 @@
 #	Compile options
 #
-SHARED	= -shared
+SHARED	= -shared -Wl,-soname=$(LIBRARY)
 CFLAGS  = $(DFLAGS) -DLINUX -I./
-LDFLAGS = -lc -lpthread
+LDFLAGS += -lc -lpthread
 
 #
 #	Override variables for compilation on Mac OS X (Darwin)
 #
-ifeq ($(shell uname),Darwin)
+ifeq ($(findstring -darwin,$(CHOST)),-darwin)
 CC	= cc
 SO	= .dylib
 SHARED	= -dynamiclib
 CFLAGS += -DOSX -isystem -I/usr/include
-LDFLAGS = -flat_namespace -install_name @executable_path/../src/$(LIBRARY)
+LDFLAGS += -flat_namespace -install_name @executable_path/../src/$(LIBRARY)
 STRIP = test
 endif
@@ -122,6 +122,20 @@
 	$(RANLIB) $@
 
 #
+# Install the package
+#
+DESTDIR =
+PREFIX  = /usr
+LIBDIR  = $(PREFIX)/lib
+INCDIR  = $(PREFIX)/include
+MKDIR   = mkdir -p
+
+install: $(LIBRARY) $(STATIC)
+	$(MKDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(INCDIR)
+	install -m 0644 $(LIBRARY) $(STATIC) $(DESTDIR)$(LIBDIR)
+	install -m 0644 ../*.h $(DESTDIR)$(INCDIR)
+
+#
 #	Clean up all generated files
 #
 clean: