Linux makefile updates for DSP Client example using IPC to communicate to Linux RM...
[keystone-rtos/rm-lld.git] / test / k2h / armv7 / linux / build / makefile
1 #
2 # Macro definitions referenced below
3 #
5 empty =
6 space =$(empty) $(empty)
8 PDK_INSTALL_PATH ?= ../../..
9 # IPC_DEVKIT_INSTALL_PATH ?= need/to/set/path
10 # export IPC_DEVKIT_INSTALL_PATH if IPC is not in /usr/lib
11 # Currently requiring IPC from linux-devkit because that package is compiled with Linaro tools
13 ARMV7OBJDIR ?= ./obj/$(DEVICE)
14 ARMV7BINDIR ?= ./bin/$(DEVICE)
15 ARMV7LIBDIR ?= ./lib
17 ARMV7OBJDIR := $(ARMV7OBJDIR)/rm/test
18 ARMV7BINDIR := $(ARMV7BINDIR)/rm/test
20 #Cross tools
21 ifdef CROSS_TOOL_INSTALL_PATH
22 # Support backwards compatibility with KeyStone1 approach
23  CC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
24  AC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)as
25  AR = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)ar
26  LD = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
27 endif
29 ifdef IPC_DEVKIT_INSTALL_PATH
30   IPCLIBDIRS := -L$(IPC_DEVKIT_INSTALL_PATH)/lib/
31 else
32   IPCLIBDIRS :=
33 endif
35 # INCLUDE Directories
36 RM_INC_DIR = $(PDK_INSTALL_PATH)/ti/drv/rm
38 RM_SRC_DIR ?= $(PDK_INSTALL_PATH)/ti/drv/rm
39 RM_TEST_DIR = $(RM_SRC_DIR)/test
40 RM_ARM_LIN_TEST_DIR = $(RM_TEST_DIR)/$(DEVICE)/armv7/linux
42 INCDIR := $(PDK_INSTALL_PATH);$(RM_INC_DIR);$(RM_ARM_LIN_TEST_DIR);$(IPC_DEVKIT_INSTALL_PATH)/include
44 # Libraries
45 RM_LIB = -lrm
46 IPC_LIBS = -ltiipc -ltiipcutils -ltiipccfg_tci6638
48 # Compiler options
49 INTERNALDEFS = $(DEBUG_FLAG) -D__ARMv7 -DDEVICE_K2H -D_VIRTUAL_ADDR_SUPPORT -D__LINUX_USER_SPACE -D_LITTLE_ENDIAN=1 -DMAKEFILE_BUILD
51 # Linker options
52 INTERNALLINKDEFS = -Wl,--start-group -L $(ARMV7LIBDIR) $(RM_LIB) -lrt -Wl,--end-group -pthread $(LDFLAGS)
53 IPC_INTERNALLINKDEFS = -Wl,--start-group -L $(ARMV7LIBDIR) $(IPCLIBDIRS) $(RM_LIB) $(IPC_LIBS) -lrt -Wl,--end-group -pthread $(LDFLAGS)
55 RM_SERVER_EXE=rmServer.out
56 RM_LINUX_CLIENT_TEST_EXE=rmLinuxClientTest.out
57 RM_DSP_CLIENT_TEST_EXE=rmDspClientTest.out
59 OBJEXT = o 
61 SRCDIR = $(RM_ARM_LIN_TEST_DIR)
63 INCS = -I. -I$(strip $(subst ;, -I,$(INCDIR)))
65 VPATH=$(SRCDIR)
67 #List the Source Files
68 RM_SERVER_SRC =     \
69     rm_server.c     \
70     rm_linux_osal.c \
71     sockutils.c
72     
73 RM_LINUX_CLIENT_TEST_SRC = \
74     rm_linux_client_test.c \
75     rm_linux_osal.c        \
76     sockutils.c
78 RM_DSP_CLIENT_TEST_SRC = \
79     rm_dsp_client_test.c \
80     sockutils.c    
82 # FLAGS for the SourceFiles
83 SRC_CFLAGS = -I. $(CFLAGS)
85 # Make Rule for the SRC Files
86 RM_SERVER_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_SERVER_SRC))
87 RM_LINUX_CLIENT_TEST_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_LINUX_CLIENT_TEST_SRC))
88 RM_DSP_CLIENT_TEST_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_DSP_CLIENT_TEST_SRC))
90 all:$(ARMV7BINDIR)/$(RM_SERVER_EXE) $(ARMV7BINDIR)/$(RM_LINUX_CLIENT_TEST_EXE) $(ARMV7BINDIR)/$(RM_DSP_CLIENT_TEST_EXE)
92 $(ARMV7BINDIR)/$(RM_SERVER_EXE): $(RM_SERVER_SRC_OBJS) $(ARMV7BINDIR)/.created
93         @echo linking $(RM_SERVER_SRC_OBJS) into $@ ...
94         @$(CC) $(RM_SERVER_SRC_OBJS) $(INTERNALLINKDEFS) -o $@
95 $(ARMV7BINDIR)/$(RM_LINUX_CLIENT_TEST_EXE): $(RM_LINUX_CLIENT_TEST_SRC_OBJS) $(ARMV7BINDIR)/.created
96         @echo linking $(RM_LINUX_CLIENT_TEST_SRC_OBJS) into $@ ...
97         @$(CC) $(RM_LINUX_CLIENT_TEST_SRC_OBJS) $(INTERNALLINKDEFS) -o $@
98 $(ARMV7BINDIR)/$(RM_DSP_CLIENT_TEST_EXE): $(RM_DSP_CLIENT_TEST_SRC_OBJS) $(ARMV7BINDIR)/.created
99         @echo linking $(RM_DSP_CLIENT_TEST_SRC_OBJS) into $@ ...
100         @$(CC) $(RM_DSP_CLIENT_TEST_SRC_OBJS) $(IPC_INTERNALLINKDEFS) -o $@     
102 $(ARMV7OBJDIR)/%.$(OBJEXT): %.c $(ARMV7OBJDIR)/.created
103         @echo compiling $< ...
104         @$(CC) -c $(SRC_CFLAGS) $(INTERNALDEFS) $(INCS)  $< -o $@
106 $(ARMV7OBJDIR)/.created:
107         @mkdir -p $(ARMV7OBJDIR)
108         @touch $(ARMV7OBJDIR)/.created
110 $(ARMV7BINDIR)/.created:
111         @mkdir -p $(ARMV7BINDIR)
112         @touch $(ARMV7BINDIR)/.created
114 clean:
115         @rm -fr $(ARMV7OBJDIR)
116         @rm -fr $(ARMV7BINDIR)