Update makefile for parallel build issue
[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
12 NETAPI_INC_DIR ?= $(TRANS_SDK_INSTALL_PATH)
13 NETAPI_SRC_DIR ?= $(TRANS_SDK_INSTALL_PATH)/ti/runtime/netapi
15 #HPLIB_INC_DIR = $(HPLIB_INSTALL_PATH)/ti/runtime/hplib
17 HPLIB_INC_DIR ?= $(PDK_INSTALL_PATH)/ti/runtime/hplib
18 INCDIR := $(PDK_INSTALL_PATH);$(QMSS_INC_DIR);$(CPPI_INC_DIR);$(HPLIB_INC_DIR);$(NETAPI_INC_DIR)
20 export PDK_VER ?= v3
21 NETAPI_NAVIG_INIT_SRC=$(NETAPI_SRC_DIR)/src/pdk$(PDK_VER)
23 ifeq ($(CPU), cortex-a8)
24         CFLAGS += -DCORTEX_A8
25 endif
27 export DEVICE?= k2h
28 ifeq ($(PDK_VER),v3)
29 QMSS_DEV_DIR = $(PDK_INSTALL_PATH)/ti/drv/qmss/device/$(DEVICE)/src
30 CPPI_DEV_DIR = $(PDK_INSTALL_PATH)/ti/drv/cppi/device/$(DEVICE)/src
31 endif
32 ifeq ($(PDK_VER),v2)
33 QMSS_DEV_DIR = $(PDK_INSTALL_PATH)/ti/drv/qmss/device
34 CPPI_DEV_DIR = $(PDK_INSTALL_PATH)/ti/drv/cppi/device
35 endif
37 # Set NETAPI INSTALL PATH to Transport SDK for default
38 export NETAPI_INSTALL_PATH ?= $(TRANS_SDK_INSTALL_PATH)
40 NETAPI_DOCS_DIR := $(NETAPI_INSTALL_PATH)/ti/runtime/netapi/docs
41  
42 #NETAPI dirs
43 OBJEXT = o
44 INTERNALLINKDEFS =
45 SRCDIR = ./src
46 #VPATH=$(SRCDIR):$(NETAPI_NAVIG_INIT_SRC)
47 VPATH=$(SRCDIR):./src/pdk$(PDK_VER)
49 ifdef CROSS_TOOL_INSTALL_PATH
50 ## Support backwards compatibility with KeyStone1 approach
51  CC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
52  AC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)as
53  AR = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)ar
54  LD = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
55 endif
56 #Cross tools
57 #CC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc -c
58 #AR = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)ar -r
61 #List the COMMONSRC Files
62 COMMONSRCC = \
63     netapi.c \
64     netapi_sec.c \
65     netapi_init.c \
66     netapi_sched.c \
67     netcp_cfg.c \
68     pktio.c \
69     netapi_navig.c\
71 CFLAGS+= $(DEBUG_FLAG) -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
75 INCS = -I$(strip $(subst ;, -I,$(subst $(space),\$(space),$(INCDIR))))
76 all: lib
78 lib: $(ARMV7LIBDIR)/libnetapi_$(DEVICE).a
81 # Make Rule for the COMMONSRC Files
82 COMMONSRCCOBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(COMMONSRCC))
83 COMMONSRCCOBJS_SO = $(patsubst %.c, $(ARMV7OBJDIR_SO)/%.$(OBJEXT), $(COMMONSRCC))
85 $(COMMONSRCCOBJS): $(ARMV7OBJDIR)/%.$(OBJEXT): %.c
86         -@echo compiling $< ........
87         -@echo vpath = $(VPATH)
88         @mkdir -p $(ARMV7OBJDIR)
89         $(CC) -c $(CFLAGS) $(INCS)  $< -o $@
91 $(COMMONSRCCOBJS_SO): $(ARMV7OBJDIR_SO)/%.$(OBJEXT): %.c
92         -@echo **** compiling this file $< ...
93         @mkdir -p $(ARMV7OBJDIR_SO)
94         $(CC) -c $(CFLAGS) -fPIC $(INCS)  $< -o $@
96 $(ARMV7LIBDIR)/libnetapi_$(DEVICE).a: $(COMMONSRCCOBJS)
97         @mkdir -p $(ARMV7LIBDIR)
98         @echo archiving $? into $@ ...
99         @$(AR) -r $@ $?
102 libnetapi_$(DEVICE).so: $(COMMONSRCCOBJS_SO)
103         -@echo archiving $? into $(ARMV7LIBDIR)/$@.1 ...
104         @$(CC) $(DEBUG_FLAG) -ggdb2 -Wl,-soname=$@.1 -shared -fPIC ${LDFLAGS} -o $@.1.0.0 $^
105         @ln -s $@.1.0.0 $@.1
106         @ln -s $@.1     $@
107         mkdir -p $(ARMV7LIBDIR)
108         @mv -f $@.1.0.0 $(ARMV7LIBDIR)/$@.1.0.0
109         @mv -f $@.1 $(ARMV7LIBDIR)/$@.1
110         @mv -f $@   $(ARMV7LIBDIR)/$@
112 clean:
113         rm -f $(ARMV7OBJDIR)/*.o
114         rm -f $(ARMV7OBJDIR_SO)/*.o
115         rm -f $(ARMV7LIBDIR)/libnetapi_$(DEVICE).a
116         rm -f $(ARMV7LIBDIR)/libnetapi_$(DEVICE).so*
118 doxygen:
119         rm -rf $(NETAPI_DOCS_DIR)/html
120         rm -rf $(NETAPI_DOCS_DIR)/latex
121         doxygen netapi_doxygen.cfg
123 clean_doxygen:
124         rm -rf $(NETAPI_DOCS_DIR)/html
125         rm -rf $(NETAPI_DOCS_DIR)/latex