Makefile updates for install
[keystone-rtos/netapi.git] / ti / runtime / netapi / demo / 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
10 DPI_DEMO_SRC_DIR ?= $(PWD)
11 # INCLUDE Directories
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 NETAPI_SRC_DIR ?= $(TRANS_SDK_INSTALL_PATH)/ti/runtime/netapi
17 NETAPI_INC_DIR ?=  $(TRANS_SDK_INSTALL_PATH)
18 HPLIB_INC_DIR ?=  $(HPLIB_INSTALL_PATH)
19 NWAL_INSTALL_PATH ?= $(PDK_INSTALL_PATH)/ti/drv/nwal
20 PKTLIB_INSTALL_PATH ?= $(PDK_INSTALL_PATH)/ti/runtime/pktlib
23 ifndef NAVL_INSTALL_PATH
24  $(error  NAVL_INSTALL_PATH is undefined)
25 else
26 NAVL_INSTALL_PATH ?= /home/a0868410/git
27 NAVL_LIB_DIR ?= $(NAVL_INSTALL_PATH)/navl/lib
28 NAVL_INC_DIR ?= $(NAVL_INSTALL_PATH)
29 endif
31 #TRIE_OBJS=$(ARMV7OBJDIR)/netapi/test/trie.o
33 NT_RM_OBJS = $(ARMV7OBJDIR)/netapi/utils/sockutils.o  $(ARMV7OBJDIR)/netapi/utils/netapi_util_rm.o
35 DPI_DEMO_OBJS= $(ARMV7OBJDIR)/netapi/demo/src/transport_dpi_demo.o $(ARMV7OBJDIR)/netapi/demo/src/navl_wrapper.o $(ARMV7OBJDIR)/netapi/demo/src/navl_external_posix.o
37 # Support Libraries used by dpi-demo 
38 CSL_DEVICE ?= -DDEVICE_K2E -DNSS_GEN2
39 QMSS_LIB = -lqmss
40 CPPI_LIB = -lcppi
41 PA_LIB = -lpa2
42 NWAL_LIB = -lnwalsa_k2e
43 SA_LIB = -lsa
44 RM_LIB = -lrm
45 PKTLIB_LIB = -lpktlib
46 NETAPI_LIB =-lnetapi_k2e
47 HP_LIB = -lhplib_k2e
48 NAVL_LIB = -lnavl
50 local_base=/usr/local
51 LDFLAGS = -L. -L$(local_base)/lib
53 LIBS = -static $(QMSS_LIB) $(CPPI_LIB) $(PA_LIB) $(PKTLIB_LIB) $(NETAPI_LIB) $(HP_LIB) $(SA_LIB) $(NWAL_LIB) $(RM_LIB) -Wl,-Bdynamic
55 LIBS += $(NAVL_LIB) -lstdc++ -lgcc_s
57 SYSTYPE:=$(shell uname)
58 ifeq ($(SYSTYPE), Linux)
59 LIBS += -ldl -lm
60 else
61 LIBS += -lexecinfo
62 endif
64 ifdef CROSS_TOOL_INSTALL_PATH
65 ## Support backwards compatibility with KeyStone1 approach
66  CC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
67  AC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)as
68  AR = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)ar
69  LD = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
70 endif
72 INCLUDE = -I. -I$(local_base)/include -I../ -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) -I$(NAVL_INC_DIR) $(CSL_DEVICE)
74 CFLAGS += $(DEBUG_FLAG) -D__ARMv7 -D_VIRTUAL_ADDR_SUPPORT -D__LINUX_USER_SPACE -D_LITTLE_ENDIAN=1 -DNWAL_ENABLE_SA -DMAKEFILE_BUILD -D _GNU_SOURCE
75 # Linker options
76 INTERNALLINKDEFS = -Wl,--start-group $(LIBS) -Wl,--end-group -lrt -pthread  -L$(ARMV7LIBDIR) -L$(ARMV7SALIBDIR) -L$(NAVL_LIB_DIR)
78 EXE_NAME=transport_dpi_demo
79 BIN_DIR = $(ARMV7BINDIR)/netapi/demo
80 all: demo install
82 demo: $(ARMV7BINDIR)/netapi/demo/.created $(BIN_DIR)/$(EXE_NAME)
84 clean:  
85         rm -f $(ARMV7OBJDIR)/netapi/demo/src/*.o
86         rm -f $(ARMV7BINDIR)/netapi/demo/*
87         
89 #$(ARMV7OBJDIR)/netapi/demo/src/%.o: %.c $(NETAPI_SRC_DIR)/demo/src/%.c $(ARMV7OBJDIR)/netapi/demo/src/.created
90 $(ARMV7OBJDIR)/netapi/demo/src/%.o: $(NETAPI_SRC_DIR)/demo/src/%.c $(ARMV7OBJDIR)/netapi/demo/src/.created
91         @echo compiling $<
92         $(CC) -c  $(CFLAGS) $(INCLUDE) $< -o $@
94 $(ARMV7OBJDIR)/netapi/demo/src/.created:
95         @mkdir -p $(ARMV7OBJDIR)/netapi/demo/src/
97 $(ARMV7BINDIR)/netapi/demo/.created:
98         @mkdir -p $(ARMV7BINDIR)/netapi/demo/
100 $(ARMV7BINDIR)/netapi/demo/$(EXE_NAME): $(NT_RM_OBJS) $(DPI_DEMO_OBJS)
101         $(CC) $(LDFLAGS) $(DPI_DEMO_OBJS) $(NT_RM_OBJS) $(INTERNALLINKDEFS) $(INCLUDE) -o $(BIN_DIR)/$(EXE_NAME)
104 $(ARMV7OBJDIR)/netapi/utils/%.o: $(NETAPI_SRC_DIR)/utils/%.c $(ARMV7OBJDIR)/netapi/utils/.created
105         @echo compiling $<
106         $(CC) -c  $(CFLAGS) $(INCLUDE) $< -o $@
108 $(ARMV7OBJDIR)/netapi/utils/.created:
109         @mkdir -p $(ARMV7OBJDIR)/netapi/utils/
111 install:
112         install -d $(INSTALL_BIN_BASE_DIR)
113         install -c -m 755 $(BIN_DIR)/$(EXE_NAME) $(INSTALL_BIN_BASE_DIR)/$(EXE_NAME)
114         install -d $(SYSCONFDIR)/transportnetlib
115         install -c -m 755 demo/demo_setup_files/transport_dpi_demo_setup.sh    $(SYSCONFDIR)/transportnetlib
116         install -c -m 755 demo/demo_setup_files/index.html               $(SYSCONFDIR)/transportnetlib
117         install -c -m 755 demo/demo_setup_files/dpicgi1.sh               $(SYSCONFDIR)/transportnetlib
118         install -c -m 755 demo/demo_setup_files/dpicgi2.sh               $(SYSCONFDIR)/transportnetlib
119         install -c -m 755 demo/demo_setup_files/dpicgi3.sh               $(SYSCONFDIR)/transportnetlib
120         install -c demo/demo_setup_files/stats1.awk                      $(SYSCONFDIR)/transportnetlib
121         install -c demo/demo_setup_files/stats2.awk                      $(SYSCONFDIR)/transportnetlib
122         install -c demo/demo_setup_files/stats3.awk                      $(SYSCONFDIR)/transportnetlib