Tomato 1.26
[tomato.git] / release / src / router / matrixssl / src / Makefile
blobdb058d4f912b784535637cd6c26a0e8bb0f97c7b
2 # Makefile for MatrixSSL library
3 # Builds optimized shared library by default.
4 # See comments below for building a debug library.
5 # Copyright (c) PeerSec Networks, 2002-2009. All Rights Reserved.
8 CC = $(CROSS_COMPILE)gcc
9 STRIP = $(CROSS_COMPILE)strip
10 AR = $(CROSS_COMPILE)ar
11 RANLIB = $(CROSS_COMPILE)ranlib
12 O = .o
13 SO = .so
14 A = .a
15 E =
17 LIBRARY = libmatrixssl$(SO)
18 STATIC = libmatrixsslstatic$(A)
20 OBJECTS = \
21 cipherSuite$(O) \
22 matrixSsl$(O) \
23 sslDecode$(O) \
24 sslEncode$(O) \
25 sslv3$(O) \
26 os/debug$(O) \
27 os/linux/linux$(O) \
28 crypto/peersec/arc4$(O) \
29 crypto/peersec/base64$(O) \
30 crypto/peersec/des3$(O) \
31 crypto/peersec/md5$(O) \
32 crypto/peersec/md2$(O) \
33 crypto/peersec/mpi$(O) \
34 crypto/peersec/rsa$(O) \
35 crypto/peersec/sha1$(O) \
36 pki/asn1$(O) \
37 pki/rsaPki$(O) \
38 pki/x509$(O)
41 # Debug flags (Define MATRIXSSL_DEBUG in shell to build debug)
42 # bash: export MATRIXSSL_DEBUG=1
43 # unset MATRIXSSL_DEBUG
44 # tcsh: setenv MATRIXSSL_DEBUG 1
45 # unsetenv MATRIXSSL_DEBUG
47 #MATRIXSSL_DEBUG = 1
48 ifdef MATRIXSSL_DEBUG
49 DFLAGS = -g -Wall -Winline -Wdisabled-optimization -Wno-pointer-sign -Wno-sign-compare -DDEBUG
50 STRIP = test
51 else
52 #DFLAGS = -Os
53 DFLAGS = -O3
54 endif
56 ifdef MATRIXSSL_PROFILE
57 DFLAGS += -g -pg
58 STRIP = test
59 endif
62 # Override variables for compilation on x86-64 (AMD64, Nacona, etc)
64 # ifeq ($(shell uname -m),x86_64)
65 # DFLAGS += -march=k8 -fPIC -DFP_64BIT -DTFM_X86_64 -DRDTSC
66 # endif
69 # Compile options
71 SHARED = -shared
72 CFLAGS = $(DFLAGS) -fPIC -DLINUX -I./
73 # Add these for MPI2 -funroll-all-loops -fomit-frame-pointer
74 LDFLAGS += -lc -lpthread
77 # Override variables for compilation on Mac OS X (Darwin)
79 ifeq ($(shell uname),Darwin)
80 CC = cc
81 SO = .dylib
82 SHARED = -dynamiclib
83 CFLAGS += -DOSX -isystem -I/usr/include
84 #LDFLAGS += -install_name @rpath/$(LIBRARY)
85 LDFLAGS += -flat_namespace -install_name @executable_path/./$(LIBRARY)
86 STRIP = test
87 endif
90 # Override variables for compilation on uClinux (example only)
92 ifdef UCLINUX
93 CC = /opt/brcm/hndtools-mipsel-uclibc/bin/mipsel-uclibc-gcc
94 STRIP = /opt/brcm/hndtools-mipsel-uclibc/bin/mipsel-uclibc-strip
95 endif
97 all: compile
99 compile: $(OBJECTS) $(LIBRARY) $(STATIC)
102 # Manual dependencies
104 *.o: ../matrixSsl.h ../matrixCommon.h matrixInternal.h matrixConfig.h Makefile
105 os/*.o: matrixInternal.h matrixConfig.h Makefile os/osLayer.h os/psMalloc.h
106 os/linux/*.o: matrixInternal.h matrixConfig.h Makefile os/osLayer.h
107 crypto/peersec/*.o: matrixInternal.h matrixConfig.h Makefile \
108 crypto/peersec/mpi.h \
109 crypto/cryptoLayer.h crypto/peersec/pscrypto.h
110 pki/*.o: matrixInternal.h matrixConfig.h Makefile \
111 pki/matrixPki.h pki/pkiInternal.h
113 # Build the library
115 $(LIBRARY): $(OBJECTS)
116 $(CC) $(SHARED) -o $@ $^ $(LDFLAGS)
117 $(STRIP) $(LIBRARY)
120 # Build the static library
122 $(STATIC): $(OBJECTS)
123 $(AR) -rcuv $@ $^
124 $(RANLIB) $@
127 # Clean up all generated files
129 clean:
130 rm -f $(LIBRARY) $(OBJECTS) $(STATIC)