Merge pull request #1 in PROCESSOR-SDK/netapi from VER_UPDATE_1_1_0_8 to master
[keystone-rtos/netapi.git] / ti / runtime / netapi / test / build / Makefile
1 #
2 empty =
3 space =$(empty) $(empty)
5 export ARMV7OBJDIR ?= ./obj
6 export ARMV7BINDIR ?= ./bin
7 export ARMV7LIBDIR ?= ./lib
8 export ARMV7SALIBDIR ?= ./lib
9 export ARMV7LIBDIRLOCAL ?= ../../lib
10 # INCLUDE Directories
11 #WORKDIR ?= $(TRANS_SDK_INSTALL_PATH)
12 SA_INSTALL_PATH ?= $(PDK_INSTALL_PATH)/ti/drv/sa
13 QMSS_INC_DIR ?= $(PDK_INSTALL_PATH)/ti/drv/qmss
14 CPPI_INC_DIR ?= $(PDK_INSTALL_PATH)/ti/drv/cppi
15 RM_INC_DIR ?= $(PDK_INSTALL_PATH)/ti/drv/rm
16 HPLIB_INC_DIR ?= $(TRANS_SDK_INSTALL_PATH)
17 NETAPI_SRC_DIR ?= $(TRANS_SDK_INSTALL_PATH)/ti/runtime/netapi
18 NETAPI_INC_DIR ?=  $(TRANS_SDK_INSTALL_PATH)
19 NWAL_INSTALL_PATH ?= $(PDK_INSTALL_PATH)/ti/drv/nwal
20 PKTLIB_INSTALL_PATH ?= $(PDK_INSTALL_PATH)/ti/runtime/pktlib
22 # Set NETAPI INSTALL PATH to Transport SDK for default
24 ifeq ($(CPU),  cortex-a8)
25         CFLAGS += -DCORTEX_A8
26 endif
28 NT_RM_OBJS = $(ARMV7OBJDIR)/netapi/utils/sockutils.o  $(ARMV7OBJDIR)/netapi/utils/netapi_util_rm.o
30 TRIE_OBJS=$(ARMV7OBJDIR)/netapi/test/trie.o
31 NT_OBJS= $(ARMV7OBJDIR)/netapi/test/net_test_loopback.o $(ARMV7OBJDIR)/netapi/test/stubs.o $(ARMV7OBJDIR)/netapi/test/net_test_utils.o $(ARMV7OBJDIR)/netapi/test/net_test_sa_utils.o $(ARMV7OBJDIR)/netapi/test/net_test_thread_utils.o
32 #
33 NT_ROUTER_OBJS= $(ARMV7OBJDIR)/netapi/test/net_test_router.o  $(ARMV7OBJDIR)/netapi/test/stubs.o $(ARMV7OBJDIR)/netapi/test/net_test_utils.o $(ARMV7OBJDIR)/netapi/test/net_test_sa_utils.o $(ARMV7OBJDIR)/netapi/test/net_test_thread_utils.o
34 #
35 NT_MAX_PARAMS_OBJS= $(ARMV7OBJDIR)/netapi/test/net_test_max_params.o  $(ARMV7OBJDIR)/netapi/test/stubs.o $(ARMV7OBJDIR)/netapi/test/net_test_utils.o $(ARMV7OBJDIR)/netapi/test/net_test_sa_utils.o $(ARMV7OBJDIR)/netapi/test/net_test_thread_utils.o
36 #
38 IFDMA_OBJS= $(ARMV7OBJDIR)/netapi/test/ifdma_test.o
40 NTB_OBJS= $(ARMV7OBJDIR)/netapi/test/nt_bridge.o  $(ARMV7OBJDIR)/netapi/test/fdb.o $(ARMV7OBJDIR)/netapi/test/stubs.o
42 NT_BENCH_OBJS= $(ARMV7OBJDIR)/netapi/test/net_test_bench.o  $(ARMV7OBJDIR)/netapi/test/stubs.o
44 # Support Libraries used by NETAPI 
45 QMSS_LIB = -lqmss
46 CPPI_LIB = -lcppi
47 PKTLIB_LIB = -lpktlib
48 HP_LIB = -lhplib_$(DEVICE)
49 NETAPI_LIB = -lnetapi_$(DEVICE)
50 NWAL_LIB = -lnwalsa_$(DEVICE)
51 SA_LIB = -lsa
52 RM_LIB = -lrm
53 #
54 #with security enabled..
57 ifeq ($(DEVICE), k2h)
58 PA_LIB   = -lpa
59 endif
60 ifeq  ($(DEVICE), k2k)
61 PA_LIB   = -lpa
62 endif
63 ifeq ($(DEVICE), k2l)
64 PA_LIB   = -lpa2
65 endif
66 ifeq ($(DEVICE), k2e)
67 PA_LIB   = -lpa2
68 endif
70 #default if DEVICE not provided
71 CSL_DEVICE ?= -DDEVICE_K2L -DNSS_GEN2
72 PA_LIB ?= -lpa2
73 NETAPI_LIB?=-lnetapi_k2l
74 NWAL_LIB ?= -lnwalsa_k2l
75 HP_LIB ?= -lhplib_k2l
77 ifeq ($(USEDYNAMIC_LIB), yes)
78 #presuming ARM executable would depend on dynamic library dependency
79 EXE_EXTN = _so
80 LIBS     = $(QMSS_LIB) $(CPPI_LIB) $(PA_LIB) $(PKTLIB_LIB) $(NETAPI_LIB) $(HP_LIB) $(SA_LIB) $(NWAL_LIB) $(RM_LIB)
81 else
82 #forcing ARM executable to depend on static LLD libraries
83 LIBS = -static $(QMSS_LIB) $(CPPI_LIB) $(PA_LIB) $(PKTLIB_LIB) $(NETAPI_LIB) $(HP_LIB) $(SA_LIB) $(NWAL_LIB) $(RM_LIB) -Wl,-Bdynamic
84 EXE_EXTN =
85 endif
88 ifdef CROSS_TOOL_INSTALL_PATH
89 ## Support backwards compatibility with KeyStone1 approach
90  CC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
91  AC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)as
92  AR = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)ar
93  LD = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
94 endif
96 CFLAGS+= $(DEBUG_FLAG) -I../ -I. -I$(NETAPI_SRC_DIR) -I$(NETAPI_SRC_DIR)/src -I$(NETAPI_SRC_DIR)/util -I$(HPLIB_INC_DIR) -I$(NETAPI_INC_DIR)-I$(PDK_INSTALL_PATH) -I$(NWAL_INSTALL_PATH) -I$(PKTLIB_INSTALL_PATH) -I$(SA_INSTALL_PATH) -I$(QMSS_INC_DIR) -I$(CPPI_INC_DIR) -I$(RM_INC_DIR) $(CSL_DEVICE) -D__ARMv7 -D_VIRTUAL_ADDR_SUPPORT -D__LINUX_USER_SPACE -D_LITTLE_ENDIAN=1 -DNWAL_ENABLE_SA -DMAKEFILE_BUILD -D _GNU_SOURCE
97 # Linker options
98 INTERNALLINKDEFS = -Wl,--start-group $(LIBS) -Wl,--end-group -lrt -pthread  -L$(ARMV7LIBDIR)  -L$(ARMV7LIBDIRLOCAL) -L$(ARMV7SALIBDIR)
101 all: tests 
103 tests: $(ARMV7BINDIR)/netapi/test/.created $(ARMV7BINDIR)/netapi/test/net_test_loopback_$(DEVICE) $(ARMV7BINDIR)/netapi/test/net_test_router_$(DEVICE) $(ARMV7BINDIR)/netapi/test/net_test_bench_$(DEVICE) $(ARMV7BINDIR)/netapi/test/nt_bridge_$(DEVICE)
105 clean:  
106         rm -f $(ARMV7OBJDIR)/netapi/test/*.o
107         rm -f $(ARMV7BINDIR)/netapi/test/*
109 $(ARMV7OBJDIR)/netapi/utils/%.o: $(NETAPI_SRC_DIR)/utils/%.c $(ARMV7OBJDIR)/netapi/utils/.created
110         @echo compiling $<
111         $(CC) -c  $(CFLAGS)  $<  -o $@
113 $(ARMV7OBJDIR)/netapi/test/%.o: $(NETAPI_SRC_DIR)/test/%.c $(ARMV7OBJDIR)/netapi/test/.created
114         @echo compiling $<
115         $(CC) -c  $(CFLAGS)  $<  -o $@
117 $(ARMV7OBJDIR)/netapi/test/.created:
118         @mkdir -p $(ARMV7OBJDIR)/netapi/test/
120 $(ARMV7BINDIR)/netapi/test/.created:
121         @mkdir -p $(ARMV7BINDIR)/netapi/test/
123 $(ARMV7OBJDIR)/netapi/utils/.created:
124         @mkdir -p $(ARMV7OBJDIR)/netapi/utils/
126 $(ARMV7BINDIR)/netapi/test/net_test_loopback_$(DEVICE): $(NT_OBJS) $(TRIE_OBJS) $(NT_RM_OBJS)
127         $(CC) $(LDFLAGS)  $(NT_OBJS) $(TRIE_OBJS) $(NT_RM_OBJS) $(INTERNALLINKDEFS)  -o $(ARMV7BINDIR)/netapi/test/net_test_loopback_$(DEVICE)$(EXE_EXTN)
129 $(ARMV7BINDIR)/netapi/test/net_test_router_$(DEVICE): $(NT_ROUTER_OBJS) $(TRIE_OBJS) $(NT_RM_OBJS)
130         $(CC) $(LDFLAGS)  $(NT_ROUTER_OBJS) $(TRIE_OBJS) $(NT_RM_OBJS) $(INTERNALLINKDEFS)  -o $(ARMV7BINDIR)/netapi/test/net_test_router_$(DEVICE)$(EXE_EXTN)
132 $(ARMV7BINDIR)/netapi/test/nt_bridge_$(DEVICE): $(NTB_OBJS) $(TRIE_OBJS) $(NT_RM_OBJS)
133         $(CC) $(LDFLAGS)  $(NTB_OBJS) $(TRIE_OBJS) $(NT_RM_OBJS) $(INTERNALLINKDEFS)  -o $(ARMV7BINDIR)/netapi/test/nt_bridge_$(DEVICE)$(EXE_EXTN)
135 $(ARMV7BINDIR)/netapi/test/ifdma_test:  $(IFDMA_OBJS)
136         $(CC) $(LDFLAGS)  $(IFDMA_OBJS) $(INTERNALLINKDEFS)  -o $(ARMV7BINDIR)/netapi/test/ifdma_test$(EXE_EXTN)
138 $(ARMV7BINDIR)/netapi/test/net_test_bench_$(DEVICE):  $(NT_BENCH_OBJS) $(NT_RM_OBJS)
139         $(CC) $(LDFLAGS)  $(NT_BENCH_OBJS) $(NT_RM_OBJS) $(INTERNALLINKDEFS)  -o $(ARMV7BINDIR)/netapi/test/net_test_bench_$(DEVICE)$(EXE_EXTN)