1#
2# Copyright (C) 2013, Broadcom Corporation
3# All Rights Reserved.
4# 
5# This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
6# the contents of this file may not be disclosed to third parties, copied
7# or duplicated in any form, in whole or in part, without the prior
8# written permission of Broadcom Corporation.
9#
10# $Id: wps_enr_lib.mk 383066 2013-02-05 10:22:22Z $
11#
12# Linux Makefile
13#
14
15WLAN_ComponentsInUse := bcmwifi
16-include $(SRCBASE)/makefiles/WLAN_Common.mk
17
18BLDTYPE = release
19#BLDTYPE = debug
20
21CC = gcc
22export $(CC)
23export LD = $(CC)
24
25ifeq ($(CC), arm-linux-gcc)
26CFLAGS += -mstructure-size-boundary=8
27#LD = arm-linux-gcc
28endif
29
30#ifeq ($(CC), mipsel-uclibc-gcc)
31#LD = mipsel-uclibc-gcc
32#endif
33
34
35ifeq ($(BLDTYPE),debug)
36export CFLAGS = -Wall -Wnested-externs -g -D_TUDEBUGTRACE -DWPS_WIRELESS_ENROLLEE
37export CXXFLAGS = -Wall -Wnested-externs -g -D_TUDEBUGTRACE -DWPS_WIRELESS_ENROLLEE
38else
39export CFLAGS = -Os -Wall -Wnested-externs -DWPS_WIRELESS_ENROLLEE
40export CXXFLAGS = -Os -Wall -Wnested-externs -DWPS_WIRELESS_ENROLLEE
41endif
42
43
44export LDFLAGS = -r
45export INCLUDE = -I$(SRCBASE)/include -I$(SRCBASE)/common/include -I./include $(WLAN_ComponentIncPathR)
46
47CRYPTDIR = ../../bcmcrypto
48
49LIBDIR = .
50
51ifeq ($(EXTERNAL_OPENSSL),1)
52export INCLUDE += -DEXTERNAL_OPENSSL -include wps_openssl.h -I$(EXTERNAL_OPENSSL_INC) -I$(EXTERNAL_OPENSSL_INC)/openssl
53else
54export INCLUDE += -I$(SRCBASE)/include/bcmcrypto
55CRYPTOBJS := $(addprefix $(LIBDIR)/$(notdir $(CRYPTDIR))/, aes.o rijndael-alg-fst.o \
56	 dh.o bn.o sha256.o hmac_sha256.o random.o)
57endif
58
59
60OBJS =  $(addprefix $(LIBDIR)/, enrollee/enr_api.o \
61	sta/sta_eap_sm.o \
62	enrollee/enr_reg_sm.o \
63	registrar/reg_sm.o )
64
65#Be aware share library may has "-m32" issue.
66ifeq ($(CC), gcc)
67default: $(LIBDIR)/libwpsenr.a $(LIBDIR)/libbcmcrypto.a
68else
69default: $(LIBDIR)/libwpsenr.a $(LIBDIR)/libbcmcrypto.a $(LIBDIR)/libwpsenr.so
70endif
71
72$(LIBDIR)/libbcmcrypto.a: $(CRYPTOBJS)
73	$(AR) cr  $@ $^
74
75$(LIBDIR)/libwpsenr.a: $(OBJS)
76	$(AR) cr  $@ $^  
77
78$(LIBDIR)/libbcmcrypto.so: $(CRYPTOBJS)
79	$(LD) -shared -o $@ $^ 
80
81$(LIBDIR)/libwpsenr.so: $(OBJS)
82	$(LD) -shared -o $@ $^ 
83
84
85$(LIBDIR)/bcmcrypto/%.o :  $(CRYPTDIR)/%.c
86	$(CC) -c $(CFLAGS) -DAES_CBC_ONLY $(INCLUDE) $< -o $@
87
88
89$(LIBDIR)/shared/%.o :  shared/%.c
90	$(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@
91
92$(LIBDIR)/sta/%.o :  sta/%.c
93	$(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@
94
95$(LIBDIR)/enrollee/%.o :  enrollee/%.c
96	$(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@
97
98$(LIBDIR)/registrar/%.o :  registrar/%.c
99	$(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@
100