Added multi-threaded client test for Linux
[keystone-rtos/rm-lld.git] / test / armv7 / linux / build / makefile
1 #
2 # Macro definitions referenced below
3 #
5 empty =
6 space =$(empty) $(empty)
8 .PHONY: rmserver
10 PDK_INSTALL_PATH ?= ../../..
11 # DEVKIT_INSTALL_PATH ?= need/to/set/path
12 # export DEVKIT_INSTALL_PATH if IPC and libdaemon not in /usr/lib
13 # Currently requiring IPC and libdaemon from linux-devkit because packages compiled with Linaro tools
15 ARMV7OBJDIR ?= ./obj
16 ARMV7BINDIR ?= ./bin
17 ARMV7LIBDIR ?= ./lib
19 ARMV7OBJDIR := $(ARMV7OBJDIR)/rm/test
20 ARMV7BINDIR := $(ARMV7BINDIR)/rm/test
22 #Cross tools
23 ifdef CROSS_TOOL_INSTALL_PATH
24 # Support backwards compatibility with KeyStone1 approach
25  CC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
26  AC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)as
27  AR = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)ar
28  LD = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
29 endif
31 ifdef DEVKIT_INSTALL_PATH
32   IPCLIBDIRS := -L$(DEVKIT_INSTALL_PATH)/lib/
33 else
34   IPCLIBDIRS :=
35 endif
37 # INCLUDE Directories
38 RM_INC_DIR = $(PDK_INSTALL_PATH)/ti/drv/rm
40 RM_SRC_DIR ?= $(PDK_INSTALL_PATH)/ti/drv/rm
41 RM_TEST_DIR = $(RM_SRC_DIR)/test
42 RM_ARM_LIN_TEST_DIR = $(RM_TEST_DIR)/armv7/linux
44 INCDIR := $(PDK_INSTALL_PATH);$(RM_INC_DIR);$(RM_ARM_LIN_TEST_DIR);$(DEVKIT_INSTALL_PATH)/include
46 # Libraries
47 RM_LIB = -lrm
48 DAEMON_LIB = -ldaemon
49 IPC_LIBS = -ltiipc -ltiipcutils
51 ifeq ($(USEDYNAMIC_LIB), yes)
52 #presuming ARM executable would depend on dynamic library dependency
53 EXE_EXTN = _so
54 LIBS     = $(RM_LIB) $(DAEMON_LIB)
55 else
56 #forcing ARM executable to depend on static LLD libraries
57 EXE_EXTN =
58 LIBS     = -Wl,-static $(RM_LIB) -Wl,-Bdynamic $(DAEMON_LIB)
59 endif
61 # Compiler options
62 INTERNALDEFS = $(DEBUG_FLAG) -D__ARMv7 -D_VIRTUAL_ADDR_SUPPORT -D__LINUX_USER_SPACE -D_LITTLE_ENDIAN=1 -DMAKEFILE_BUILD
64 # Linker options
65 INTERNALLINKDEFS = -Wl,--start-group -L $(ARMV7LIBDIR) $(LIBS) -lrt -Wl,--end-group -pthread $(LDFLAGS)
66 IPC_INTERNALLINKDEFS = -Wl,--start-group -L $(ARMV7LIBDIR) $(IPCLIBDIRS) $(IPC_LIBS) -lrt -Wl,--end-group -pthread $(LDFLAGS)
68 RM_SERVER_EXE=rmServer$(EXE_EXTN).out
69 RM_LINUX_CLIENT_TEST_EXE=rmLinuxClientTest$(EXE_EXTN).out
70 RM_LINUX_MT_CLIENT_TEST_EXE=rmLinuxMtClientTest$(EXE_EXTN).out
71 RM_DSP_CLIENT_TEST_EXE=rmDspClientTest$(EXE_EXTN).out
73 OBJEXT = o 
75 SRCDIR = $(RM_ARM_LIN_TEST_DIR)
77 INCS = -I. -I$(strip $(subst ;, -I,$(INCDIR)))
79 VPATH=$(SRCDIR)
81 #List the Source Files
82 RM_SERVER_SRC =     \
83     rm_server.c     \
84     rm_server_osal.c \
85     sockutils.c
86     
87 RM_LINUX_CLIENT_TEST_SRC = \
88     rm_linux_client_test.c \
89     rm_linux_osal.c        \
90     sockutils.c
92 RM_LINUX_MT_CLIENT_TEST_SRC = \
93     rm_linux_mt_client_test.c \
94     rm_linux_osal.c        \
95     sockutils.c
96     
97 RM_DSP_CLIENT_TEST_SRC = \
98     rm_dsp_client_test.c \
99     sockutils.c    
101 # FLAGS for the SourceFiles
102 SRC_CFLAGS = -I. $(CFLAGS)
104 # Make Rule for the SRC Files
105 RM_SERVER_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_SERVER_SRC))
106 RM_LINUX_CLIENT_TEST_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_LINUX_CLIENT_TEST_SRC))
107 RM_LINUX_MT_CLIENT_TEST_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_LINUX_MT_CLIENT_TEST_SRC))
108 RM_DSP_CLIENT_TEST_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_DSP_CLIENT_TEST_SRC))
110 all:rmserver $(ARMV7BINDIR)/$(RM_LINUX_CLIENT_TEST_EXE) $(ARMV7BINDIR)/$(RM_LINUX_MT_CLIENT_TEST_EXE) $(ARMV7BINDIR)/$(RM_DSP_CLIENT_TEST_EXE)
112 rmserver:$(ARMV7BINDIR)/$(RM_SERVER_EXE)
114 $(ARMV7BINDIR)/$(RM_SERVER_EXE): $(RM_SERVER_SRC_OBJS) $(ARMV7BINDIR)/.created
115         @echo linking $(RM_SERVER_SRC_OBJS) into $@ ...
116         @$(CC) $(RM_SERVER_SRC_OBJS) $(INTERNALLINKDEFS) -o $@
117 $(ARMV7BINDIR)/$(RM_LINUX_CLIENT_TEST_EXE): $(RM_LINUX_CLIENT_TEST_SRC_OBJS) $(ARMV7BINDIR)/.created
118         @echo linking $(RM_LINUX_CLIENT_TEST_SRC_OBJS) into $@ ...
119         @$(CC) $(RM_LINUX_CLIENT_TEST_SRC_OBJS) $(INTERNALLINKDEFS) -o $@
120 $(ARMV7BINDIR)/$(RM_LINUX_MT_CLIENT_TEST_EXE): $(RM_LINUX_MT_CLIENT_TEST_SRC_OBJS) $(ARMV7BINDIR)/.created
121         @echo linking $(RM_LINUX_MT_CLIENT_TEST_SRC_OBJS) into $@ ...
122         @$(CC) $(RM_LINUX_MT_CLIENT_TEST_SRC_OBJS) $(INTERNALLINKDEFS) -o $@    
123 $(ARMV7BINDIR)/$(RM_DSP_CLIENT_TEST_EXE): $(RM_DSP_CLIENT_TEST_SRC_OBJS) $(ARMV7BINDIR)/.created
124         @echo linking $(RM_DSP_CLIENT_TEST_SRC_OBJS) into $@ ...
125         @$(CC) $(RM_DSP_CLIENT_TEST_SRC_OBJS) $(IPC_INTERNALLINKDEFS) -o $@     
127 $(ARMV7OBJDIR)/%.$(OBJEXT): %.c $(ARMV7OBJDIR)/.created
128         @echo compiling $< ...
129         @$(CC) -c $(SRC_CFLAGS) $(INTERNALDEFS) $(INCS)  $< -o $@
131 $(ARMV7OBJDIR)/.created:
132         @mkdir -p $(ARMV7OBJDIR)
133         @touch $(ARMV7OBJDIR)/.created
135 $(ARMV7BINDIR)/.created:
136         @mkdir -p $(ARMV7BINDIR)
137         @touch $(ARMV7BINDIR)/.created
139 clean:
140         @rm -fr $(ARMV7OBJDIR)
141         @rm -fr $(ARMV7BINDIR)