NETAPI integration with ipsecmgr
[keystone-rtos/netapi.git] / ti / runtime / netapi / applications / ipsec_offload / ipsecmgr / build / Makefile
1 # Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
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 SA_INSTALL_PATH ?= $(PDK_INSTALL_PATH)/ti/drv/sa
12 QMSS_INC_DIR ?= $(PDK_INSTALL_PATH)/ti/drv/qmss
13 CPPI_INC_DIR ?= $(PDK_INSTALL_PATH)/ti/drv/cppi
14 NWAL_INSTALL_PATH ?= $(PDK_INSTALL_PATH)/ti/drv/nwal
15 PKTLIB_INSTALL_PATH ?= $(PDK_INSTALL_PATH)/ti/runtime/pktlib
17 HPLIB_INC_DIR ?= $(TRANS_SDK_INSTALL_PATH)
18 NETAPI_INC_DIR ?=  $(TRANS_SDK_INSTALL_PATH)
19 NETAPI_SRC_DIR ?= $(TRANS_SDK_INSTALL_PATH)/ti/runtime/netapi
21 CSL_DEVICE ?= -DDEVICE_K2H
24 ifdef CROSS_TOOL_INSTALL_PATH
25 ## Support backwards compatibility with KeyStone1 approach
26  CC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
27  AC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)as
28  AR = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)ar
29  LD = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
30 endif
32 #QUIET_CMD=@
33 EXE_NAME_PRFX=ipsecmgr_daemon
35 ###############################################################################
36 # Set default options
37 ###############################################################################
38 CFLAGS+= $(DEBUG_FLAG) -I../ -I. $(CSL_DEVICE) -D__ARMv7 -D_VIRTUAL_ADDR_SUPPORT -D__LINUX_USER_SPACE -D_LITTLE_ENDIAN=1 -DNWAL_ENABLE_SA -DMAKEFILE_BUILD -D _GNU_SOURCE
40 OUTPUT_FILE_OPTION = -o
42 EXE_NAME = $(EXE_NAME_PRFX).out
44 ROOT_DIR = ..
45 #IPSECMGR_IFACE_DIR?= ../../../
46 IPSECMGR_UTIL_IFACE_DIR?= ../../../utils/iface
47 IPSECMGR_IFACE_DIR?= ../
50 QMSS_LIB=qmss
51 CPPI_LIB=cppi
52 PA_LIB=pa
53 HPLIB_LIB=hplib
54 SA_LIB=sa
55 PKTLIB_LIB=pktlib
56 NWAL_LIB=nwalsa
57 NETAPI_LIB=netapi
58 IPSECMGR_SNOOP_LIB=ipsecmgr_snoop
59 IPSECMGR_IPC_LIB=ipsecmgr_ipc
60 IPSECMGR_SYSLOG_LIB=ipsecmgr_syslog
62 LIBNL_LD_OPTS = -lnl-3 -lnl-xfrm -lnl-route-3
64 LD_OPTS += -pthread -lrt
66 LD_OPTS += -L $(ARMV7LIBDIR) -L $(PDK_ARMV7LIBDIR) -l$(IPSECMGR_SNOOP_LIB) -l$(IPSECMGR_IPC_LIB) -l$(IPSECMGR_SYSLOG_LIB) -l$(NETAPI_LIB) -l$(NWAL_LIB) -l$(PKTLIB_LIB) -l$(SA_LIB) -l$(QMSS_LIB) -l$(CPPI_LIB) -l$(PA_LIB) -l$(HPLIB_LIB) $(LIBNL_LD_OPTS)
67 ###############################################################################
68 # List of modules and their files
69 ###############################################################################
70 DAEMON_SRC_DIR ?= ../src/
71 DAEMON_FILES = \
72         netapi_ipsecmgr.c \
73         netapilib_interface.c
75 VPATH = $(DAEMON_SRC_DIR)
76 FILES = $(DAEMON_FILES)
78 INCL_DIRS= $(IPSECMGR_IFACE_DIR) $(IPSECMGR_UTIL_IFACE_DIR) $(NETAPI_INC_DIR) $(CPPI_INC_DIR) $(QMSS_INC_DIR) $(HPLIB_INC_DIR) $(SA_INSTALL_PATH) $(PDK_INSTALL_PATH) 
80 HEADERS = $(filter %.h, $(FILES))
81 INCL = -I. $(patsubst %,-I%,$(INCL_DIRS))
84 BIN_DIR = $(ARMV7BINDIR)/netapi/applications/ipsec_offload/ipsecmgr
85 OBJ_DIR = $(ARMV7OBJDIR)/netapi/applications/ipsec_offload/ipsecmgr
86 DAEMON_OBJS = $(patsubst %.c,$(OBJ_DIR)/%.o,$(filter %.c, $(FILES)))
89 all: app install
91 app: $(BIN_DIR)/.created $(BIN_DIR)/$(EXE_NAME)
92 ###############################################################################
93 # Normal make process                                                         
94 ###############################################################################
96 $(OBJ_DIR)/%.o: %.c $(OBJ_DIR)/.created
97         @echo compiling $<
98         $(CC) -c  $(CFLAGS) $(INCL)  $<  -o $@
100 $(OBJ_DIR)/.created:
101         $(QUIET_CMD)@echo "making $@" 
102         @mkdir -p $(OBJ_DIR)
104 $(BIN_DIR)/.created:
105         @mkdir -p $(BIN_DIR)
107 $(BIN_DIR)/$(EXE_NAME): $(DAEMON_OBJS) $(BIN_DIR)/.created
108         $(QUIET_CMD)@echo "linking $@" 
109         $(QUIET_CMD)@echo "$(LD_OPTS)" 
110         $(CC) $(DAEMON_OBJS) $(LD_OPTS) -o $(BIN_DIR)/$(EXE_NAME)
112 install:
113         install -d $(INSTALL_BIN_BASE_DIR)
114         install -c -m 755 $(BIN_DIR)/* $(INSTALL_BIN_BASE_DIR)
115         install -d $(INSTALL_INC_BASE_DIR)/ti/runtime/netapi/applications/ipsec_offload/ipsecmgr/src
116         install -c -m 644 ../src/*.h $(INSTALL_INC_BASE_DIR)/ti/runtime/netapi/applications/ipsec_offload/ipsecmgr/src
117         install -d $(INSTALL_LIB_BASE_DIR)
118         @$(CP) -r $(ARMV7LIBDIR)/*.a         $(INSTALL_LIB_BASE_DIR)
119 clean:
120         rm -rf $(OBJ_DIR)
121         rm -rf $(BIN_DIR)