2 # Linux router libbcmcrypto Makefile
4 # Copyright 2007, Broadcom Corporation
7 # This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
8 # the contents of this file may not be disclosed to third parties, copied
9 # or duplicated in any form, in whole or in part, without the prior
10 # written permission of Broadcom Corporation.
17 CFLAGS
+= -Wsign-compare
-I.
-I..
/httpd
-I
$(SRCBASE
)/include -Wall
19 CFLAGS
+= -s
-O2
$(EXTRACFLAGS
)
22 vpath
%.c
$(SRCBASE
)/bcmcrypto
23 vpath
%.o
$(SRCBASE
)/bcmcrypto
/prebuilt
25 OBJS
:= aes.o aeskeywrap.o rijndael-alg-fst.o dh.o bn.o sha1.o passhash.o prf.o md5.o hmac.o rc4.o
26 #ifeq ($(CONFIG_WSCCMD), y)
27 OBJS
+= sha256.o hmac_sha256.o random.o
30 # Find all ELF binaries (including extra libraries)
31 BINARIES
:= $(shell find
$(TARGETDIR
) -path
$(TARGETDIR
)/lib
-prune
-o
-type f
-print | file
-f
- | grep ELF | cut
-d
':' -f1
)
36 all: libbcmcrypto.so libbcmcrypto.a
39 install -d
$(INSTALLDIR
)/usr
/lib
40 install -m
755 libbcmcrypto.so
$(INSTALLDIR
)/usr
/lib
41 $(STRIP
) $(INSTALLDIR
)/usr
/lib
/libbcmcrypto.so
44 rm -f
*.o
*.so
*.a
$(MAP
) $(UNR
) $(SYM
)
46 libbcmcrypto.so
: $(OBJS
)
47 $(LD
) -shared
-o
$@
$^
49 libbcmcrypto.a
: $(OBJS
)
53 # rule for removing unneeded symbols in the shared library
54 optimize
: libbcmcrypto.so
55 $(NM
) -o
--defined-only
--no-sort libbcmcrypto.so | cut
-d
' ' -f3
> $(MAP
)
56 $(NM
) --dynamic
-u
--no-sort
$(BINARIES
) |
sort -u
> $(UNR
)
58 for symbol in
`cat $(UNR)` ; do \
59 if grep
-q
"^$${symbol}$$" $(MAP
) ; then echo
"-u $${symbol}" >> $(SYM
) ; \
61 # if no symbols are needed then delete the shared lib
63 $(AR
) cr libbcmcrypto.a
$(OBJS
) ; \
64 xargs
-t
$(LD
) -shared
-o libbcmcrypto.so libbcmcrypto.a
< $(SYM
) ; \
65 install libbcmcrypto.so
$(TARGETDIR
)/usr
/lib
; \
66 $(STRIP
) $(TARGETDIR
)/usr
/lib
/libbcmcrypto.so
; \
68 rm $(TARGETDIR
)/usr
/lib
/libbcmcrypto.so
; fi