5571a26d4474c4623fbf0a08ab42b4edb717d6ba
[keystone-rtos/netapi.git] / ti / runtime / netapi / build / Makefile
1 # Macro definitions referenced below
2 #
3 empty =
4 space =$(empty) $(empty)
6 # INCLUDE Directories
7 QMSS_INC_DIR ?= $(PDK_INSTALL_PATH)/ti/drv/qmss
8 SA_INSTALL_PATH ?= $(PDK_INSTALL_PATH)/ti/drv/sa
9 CPPI_INC_DIR ?= $(PDK_INSTALL_PATH)/ti/drv/cppi
10 #HPLIB_INC_DIR = $(HPLIB_INSTALL_PATH)/ti/runtime/hplib
12 HPLIB_INC_DIR ?= $(PDK_INSTALL_PATH)/ti/runtime/hplib
13 INCDIR := $(PDK_INSTALL_PATH);  $(QMSS_INC_DIR); $(CPPI_INC_DIR); $(HPLIB_INC_DIR)
15 WORKDIR ?= $(TRANS_SDK_INSTALL_PATH)
16 #NETAPI_INC_DIR ?= $(NETAPI_INSTALL_PATH)/ti/runtime/netapi
17 #NETAPI_INC_DIR ?= $(PDK_INSTALL_PATH)/ti/runtime/netapi
18 NETAPI_INC_DIR ?= $(WORKDIR)
19 export PDK_VER ?= v3
20 NETAPI_NAVIG_INIT_SRC=$(NETAPI_INC_DIR)/src/pdk$(PDK_VER)
22 export CPU ?= cortex-a15
24 ifeq ($(CPU), cortex-a8)
25         CFLAGS += -DCORTEX_A8
26 endif
27 ifeq ($(CPU), cortex-a15)
28         CFLAGS += -DCORTEX_A15
29 endif
31 export DEVICE?= k2h
32 ifeq ($(PDK_VER),v3)
33 QMSS_DEV_DIR = $(PDK_INSTALL_PATH)/ti/drv/qmss/device/$(DEVICE)/src
34 CPPI_DEV_DIR = $(PDK_INSTALL_PATH)/ti/drv/cppi/device/$(DEVICE)/src
35 endif
36 ifeq ($(PDK_VER),v2)
37 QMSS_DEV_DIR = $(PDK_INSTALL_PATH)/ti/drv/qmss/device
38 CPPI_DEV_DIR = $(PDK_INSTALL_PATH)/ti/drv/cppi/device
39 endif
41 # Output for prebuilt generated libraries
42 export ARMV7LIBDIR ?= ./lib
43 export ARMV7OBJDIR ?= ./obj
44 ARMV7OBJDIR := $(ARMV7OBJDIR)/netapi/lib
45 ARMV7BINDIR ?= ./bin
47 # Set NETAPI INSTALL PATH to Transport SDK for default
48 export NETAPI_INSTALL_PATH ?= $(TRANS_SDK_INSTALL_PATH)
50 NETAPI_DOCS_DIR := $(NETAPI_INSTALL_PATH)/ti/runtime/netapi/docs
51  
52 #NETAPI dirs
53 OBJEXT = o
54 INTERNALLINKDEFS =
55 #SRCDIR = ./src;$(NETAPI_INC_DIR)/src
56 SRCDIR = ./src
57 #VPATH=$(SRCDIR):$(NETAPI_NAVIG_INIT_SRC)
58 VPATH=$(SRCDIR):./src/pdk$(PDK_VER)
60 ifdef CROSS_TOOL_INSTALL_PATH
61 ## Support backwards compatibility with KeyStone1 approach
62  CC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
63  AC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)as
64  AR = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)ar
65  LD = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
66 endif
67 #Cross tools
68 #CC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc -c
69 #AR = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)ar -r
71 CSL_DEVICE ?= -DDEVICE_K2H
73 #List the COMMONSRC Files
74 COMMONSRCC = \
75     netapi.c \
76     netapi_sec.c \
77     netapi_init.c \
78     netapi_sched.c \
79     netcp_cfg.c \
80     pktio.c \
81     netapi_navig.c\
83 CFLAGS+= $(DEBUG_FLAG) -I$(NETAPI_INC_DIR) -I.  -I $(SRCDIR) -I$(PDK_INSTALL_PATH) -I$(NWAL_INSTALL_PATH) -I$(PKTLIB_INSTALL_PATH) -I$(TRANS_SDK_INSTALL_PATH) -I$(QMSS_INC_DIR) -I$(CPPI_INC_DIR) -I$(HPLIB_INC_DIR) -I$(QMSS_DEV_DIR) -I$(CPPI_DEV_DIR) -I$(NETAPI_NAVIG_INIT_SRC) -I$(SA_INSTALL_PATH) $(CSL_DEVICE)  -D__ARMv7 -D_VIRTUAL_ADDR_SUPPORT -D__LINUX_USER_SPACE -D_LITTLE_ENDIAN=1 -DMAKEFILE_BUILD -DNWAL_ENABLE_SA -pthread -D _GNU_SOURCE
84 #CFLAGS+= $(DEBUG_FLAG) -I$(NETAPI_INC_DIR) -I.  -I $(SRCDIR) -I$(PDK_INSTALL_PATH) -I$(NWAL_INSTALL_PATH) -I$(PKTLIB_INSTALL_PATH) -I$(TRANS_SDK_INSTALL_PATH) -I$(QMSS_INC_DIR) -I$(CPPI_INC_DIR) -I$(HPLIB_INC_DIR) -I$(QMSS_DEV_DIR) -I$(CPPI_DEV_DIR) -I$(NETAPI_NAVIG_INIT_SRC) $(CSL_DEVICE)  -D__ARMv7 -D_VIRTUAL_ADDR_SUPPORT -D__LINUX_USER_SPACE -D_LITTLE_ENDIAN=1 -DMAKEFILE_BUILD -DNWAL_ENABLE_SA -pthread -D _GNU_SOURCE
88 INCS = -I$(strip $(subst ;, -I,$(subst $(space),\$(space),$(INCDIR))))
89 all: lib
91 lib: $(ARMV7LIBDIR)/libnetapi.a
94 # Make Rule for the COMMONSRC Files
95 COMMONSRCCOBJS = $(patsubst %.c, $(ARMV7OBJDIR)/netapi/lib/%.$(OBJEXT), $(COMMONSRCC))
97 $(COMMONSRCCOBJS): $(ARMV7OBJDIR)/netapi/lib/%.$(OBJEXT): %.c
98         -@echo compiling $< ........
99         -@echo vpath = $(VPATH)
100         -@echo workdir = $(WORKDIR)
101         @mkdir -p $(ARMV7OBJDIR)/netapi/lib/
102         $(CC) -c $(CFLAGS) $(INCS)  $< -o $@
104 $(ARMV7LIBDIR)/libnetapi.a: $(COMMONSRCCOBJS)
105         @mkdir -p $(ARMV7LIBDIR)
106         @echo archiving $? into $@ ...
107         @$(AR) -r $@ $?
109 clean:
110         rm -f $(ARMV7OBJDIR)/netapi/lib/*.o
111         rm -f $(ARMV7LIBDIR)/libnetapi.a
113 doxygen:
114         rm -rf $(NETAPI_DOCS_DIR)/html
115         rm -rf $(NETAPI_DOCS_DIR)/latex
116         doxygen netapi_doxygen.cfg
118 clean_doxygen:
119         rm -rf $(NETAPI_DOCS_DIR)/html
120         rm -rf $(NETAPI_DOCS_DIR)/latex