Updates to Tomato RAF including NGINX && PHP
[tomato.git] / release / src / router / libbcmcrypto / Makefile
blob4d79fde2059e2fc8872d8593418236a53cf1dc84
2 # Linux router libbcmcrypto Makefile
4 # Copyright 2007, Broadcom Corporation
5 # All Rights Reserved.
6 #
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.
12 # $Id$
15 include ../common.mak
17 CFLAGS += -Wsign-compare -I. -I../httpd -I$(SRCBASE)/include -Wall
18 #CFLAGS += -g -DDEBUG
19 CFLAGS += -s -O2 $(EXTRACFLAGS)
20 LDFLAGS += -L.
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
28 #endif
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)
32 MAP := .map
33 UNR := .unresolved
34 SYM := .symbols
36 all: libbcmcrypto.so libbcmcrypto.a
38 install: all
39 install -d $(INSTALLDIR)/usr/lib
40 install -m 755 libbcmcrypto.so $(INSTALLDIR)/usr/lib
41 $(STRIP) $(INSTALLDIR)/usr/lib/libbcmcrypto.so
43 clean:
44 rm -f *.o *.so *.a $(MAP) $(UNR) $(SYM)
46 libbcmcrypto.so: $(OBJS)
47 $(LD) -shared -o $@ $^
49 libbcmcrypto.a: $(OBJS)
50 @rm -f $@
51 @$(AR) cruv $@ $^
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)
57 rm -rf $(SYM)
58 for symbol in `cat $(UNR)` ; do \
59 if grep -q "^$${symbol}$$" $(MAP) ; then echo "-u $${symbol}" >> $(SYM) ; \
60 fi ; done
61 # if no symbols are needed then delete the shared lib
62 if ls $(SYM) ; then \
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 ; \
67 else \
68 rm $(TARGETDIR)/usr/lib/libbcmcrypto.so ; fi