NETAPI integration with ipsecmgr
[keystone-rtos/netapi.git] / ti / runtime / netapi / applications / ipsec_offload / config-app / 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 # INCLUDE Directories
10 NETAPI_SRC_DIR ?= $(TRANS_SDK_INSTALL_PATH)/ti/runtime/netapi
12 CSL_DEVICE ?= -DDEVICE_K2H
15 ifdef CROSS_TOOL_INSTALL_PATH
16 ## Support backwards compatibility with KeyStone1 approach
17  CC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
18  AC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)as
19  AR = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)ar
20  LD = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
21 endif
23 #QUIET_CMD=@
24 EXE_NAME_PRFX=ipsecmgr_cmd_shell
26 ###############################################################################
27 # Set default options
28 ###############################################################################
29 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
31 OUTPUT_FILE_OPTION = -o
33 EXE_NAME = $(EXE_NAME_PRFX).out
35 ROOT_DIR = ..
36 IPSECMGR_UTIL_IFACE_DIR?= ../../../utils/iface
37 IPSECMGR_IFACE_DIR?= ../
40 OBJ_DIR = obj
41 NETAPI_LIB=netapi
42 IPSECMGR_IPC_LIB=ipsecmgr_ipc
43 IPSECMGR_SYSLOG_LIB=ipsecmgr_syslog
44 IPSECMGR_SNOOP_LIB=ipsecmgr_snoop
45 LD_OPTS += -pthread -lrt
46 LD_OPTS += -L $(ARMV7LIBDIR) -L $(PDK_ARMV7LIBDIR) -L $(IPSECMGR_LIB_PATH) -l$(IPSECMGR_SNOOP_LIB) -l$(IPSECMGR_IPC_LIB) -l$(IPSECMGR_SYSLOG_LIB)
48 ###############################################################################
49 # List of modules and their files
50 ###############################################################################
51 CONFIG_APP_SRC_DIR ?=../src/
52 CONFIG_APP_FILES = \
53         cmd_shell.c \
54         cmd_shell_main.c \
55         cmd_shell_loc.h
57 VPATH = $(CONFIG_APP_SRC_DIR)
58 FILES = $(CONFIG_APP_FILES)
60 INCL_DIRS= $(IPSECMGR_IFACE_DIR) $(IPSECMGR_UTIL_IFACE_DIR)
62 HEADERS = $(filter %.h, $(FILES))
63 INCL = -I. $(patsubst %,-I%,$(INCL_DIRS))
65 BIN_DIR = $(ARMV7BINDIR)/netapi/applications/ipsec_offload/config-app
66 OBJ_DIR = $(ARMV7OBJDIR)/netapi/applications/ipsec_offload/config-app
67 CONFIG_APP_OBJS = $(patsubst %.c,$(OBJ_DIR)/%.o,$(filter %.c, $(FILES)))
70 all: app install
72 app: $(BIN_DIR)/.created $(BIN_DIR)/$(EXE_NAME)
73 ###############################################################################
74 # Normal make process                                                         
75 ###############################################################################
77 $(OBJ_DIR)/%.o: %.c $(OBJ_DIR)/.created
78         @echo compiling $<
79         $(CC) -c  $(CFLAGS) $(INCL)  $<  -o $@
81 $(OBJ_DIR)/.created:
82         $(QUIET_CMD)@echo "making $@" 
83         @mkdir -p $(OBJ_DIR)
85 $(BIN_DIR)/.created:
86         @mkdir -p $(BIN_DIR)
88 $(BIN_DIR)/$(EXE_NAME): $(CONFIG_APP_OBJS) $(BIN_DIR)/.created
89         $(QUIET_CMD)@echo "linking $@" 
90         $(CC) $(CONFIG_APP_OBJS) $(LD_OPTS) -o $(BIN_DIR)/$(EXE_NAME)
92 install:
93         install -d $(INSTALL_BIN_BASE_DIR)
94         install -c -m 755 $(BIN_DIR)/* $(INSTALL_BIN_BASE_DIR)
95         install -d $(INSTALL_INC_BASE_DIR)/ti/runtime/netapi/applications/ipsec_offload/config-app/src
96         install -c -m 644 ../src/*.h $(INSTALL_INC_BASE_DIR)/ti/runtime/netapi/applications/ipsec_offload/config-app/src
98 clean:
99         rm -rf $(OBJ_DIR)
100         rm -rf $(BIN_DIR)