5482c1932c57ee2fe42e05b6d6a5a92b22143b34
[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 HPLIB_INC_DIR ?= $(PDK_INSTALL_PATH)/ti/runtime/hplib
16 NETAPI_INC_DIR ?= $(WORKDIR)
17 NWAL_INSTALL_PATH ?= $(PDK_INSTALL_PATH)/ti/drv/nwal
18 PKTLIB_INSTALL_PATH ?= $(PDK_INSTALL_PATH)/ti/runtime/pktlib
22 #NETAPI LIB Build directory
23 NETAPI_BUILD_DIR = $(NETAPI_INC_DIR)/ti/runtime/netapi/build
26 # Set NETAPI INSTALL PATH to Transport SDK for default
28 CSL_DEVICE ?= -DDEVICE_K2H
30 ifeq ($(CPU),  cortex-a8)
31         CFLAGS += -DCORTEX_A8
32 endif
34 TRIE_OBJS=$(ARMV7OBJDIR)/netapi/test/trie.o
35 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
36 #
37 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
38 #
39 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
40 #
42 IFDMA_OBJS= $(ARMV7OBJDIR)/netapi/test/ifdma_test.o
44 NTB_OBJS= $(ARMV7OBJDIR)/netapi/test/nt_bridge.o  $(ARMV7OBJDIR)/netapi/test/stubs.o  
47 # Support Libraries used by NETAPI 
48 QMSS_LIB = -lqmss
49 CPPI_LIB = -lcppi
50 PA_LIB   = -lpa
51 #without security enabled
52 #NWAL_LIB = -lnwal
53 PKTLIB_LIB = -lpktlib
54 NETAPI_LIB = -lnetapi
55 HP_LIB = -lhplib
56 SA_LIB = -lsa
57 #
58 #with security enabled..
59 NWAL_LIB = -lnwalsa
61 ifdef CROSS_TOOL_INSTALL_PATH
62 ## Support backwards compatibility with KeyStone1 approach
63  CC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
64  AC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)as
65  AR = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)ar
66  LD = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
67 endif
69 #Cross tools
70 #CC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc -c
71 #AR = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)ar -r
73 CFLAGS+= $(DEBUG_FLAG) -I../ -I. -I$(NETAPI_INC_DIR) -I$(NETAPI_INC_DIR)/src -I$(HPLIB_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$(SA_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
74 # Linker options
75 INTERNALLINKDEFS = -Wl,--start-group $(NETAPI_LIB) $(PKTLIB_LIB) $(HP_LIB) $(QMSS_LIB) $(CPPI_LIB) $(NWAL_LIB) $(PA_LIB) $(SA_LIB) -Wl,--end-group -lrt -pthread  -L$(ARMV7LIBDIR)  -L$(ARMV7LIBDIRLOCAL) -L$(ARMV7SALIBDIR)
78 all: tests 
80 tests: $(ARMV7BINDIR)/netapi/test/.created $(ARMV7BINDIR)/netapi/test/net_test_loopback $(ARMV7BINDIR)/netapi/test/net_test_router $(ARMV7BINDIR)/netapi/test/net_test_max_params $(ARMV7BINDIR)/netapi/test/ifdma_test
83 api_clean:
84         rm -f  $(ARMV7LIBDIR)/libnetapi.a
85         rm -rf $(ARMV7OBJDIR)/netapi/lib/*.o
87 clean:  
88         rm -f $(ARMV7OBJDIR)/netapi/test/*.o
89         rm -f $(ARMV7LIBDIR)/libnetapi.a
90         rm -f $(ARMV7BINDIR)/netapi/test/net_test_loopback
91         rm -f $(ARMV7BINDIR)/netapi/test/net_test_router 
92         rm -f $(ARMV7BINDIR)/netapi/test/net_test_max_params
93         rm -f $(ARMV7BINDIR)/netapi/test/ifdma_test
96 $(ARMV7OBJDIR)/netapi/test/%.o: $(NETAPI_INC_DIR)/ti/runtime/netapi/test/%.c $(ARMV7OBJDIR)/netapi/test/.created
97         @echo compiling $<
98         @echo workdir = $(WORKDIR)
99         $(CC) -c  $(CFLAGS)  $<  -o $@
101 $(ARMV7OBJDIR)/netapi/test/.created:
102         @mkdir -p $(ARMV7OBJDIR)/netapi/test/
104 $(ARMV7BINDIR)/netapi/test/.created:
105         @mkdir -p $(ARMV7BINDIR)/netapi/test/
109 $(ARMV7BINDIR)/netapi/test/net_test_loopback:  $(NT_OBJS) $(TRIE_OBJS)
110         $(CC) $(LDFLAGS)  $(NT_OBJS) $(TRIE_OBJS) $(INTERNALLINKDEFS)  -o $(ARMV7BINDIR)/netapi/test/net_test_loopback
112 $(ARMV7BINDIR)/netapi/test/net_test_max_params:  $(NT_MAX_PARAMS_OBJS) $(TRIE_OBJS)
113         $(CC) $(LDFLAGS)  $(NT_MAX_PARAMS_OBJS) $(TRIE_OBJS) $(INTERNALLINKDEFS)  -o $(ARMV7BINDIR)/netapi/test/net_test_max_params
114 $(ARMV7BINDIR)/netapi/test/net_test_router:  $(NT_ROUTER_OBJS) $(TRIE_OBJS)
115         $(CC) $(LDFLAGS)  $(NT_ROUTER_OBJS) $(TRIE_OBJS) $(INTERNALLINKDEFS)  -o $(ARMV7BINDIR)/netapi/test/net_test_router
117 $(ARMV7BINDIR)/netapi/test/nt_bridge:  $(NTB_OBJS) $(TRIE_OBJS)
118         $(CC) $(LDFLAGS)  $(NTB_OBJS) $(TRIE_OBJS) $(INTERNALLINKDEFS)  -o $(ARMV7BINDIR)/netapi/test/nt_bridge
120 $(ARMV7BINDIR)/netapi/test/ifdma_test:  $(IFDMA_OBJS)
121         $(CC) $(LDFLAGS)  $(IFDMA_OBJS) $(INTERNALLINKDEFS)  -o $(ARMV7BINDIR)/netapi/test/ifdma_test