Added linux makefiles for Linux test project
[keystone-rtos/rm-lld.git] / test / k2k / armv7 / linux / build / makefile
1 #
2 # Macro definitions referenced below
3 #
5 empty =
6 space =$(empty) $(empty)
8 PDK_INSTALL_PATH ?= ../../..
10 ARMV7OBJDIR ?= ./obj/$(DEVICE)
11 ARMV7BINDIR ?= ./bin/$(DEVICE)
12 ARMV7LIBDIR ?= ./lib
14 ARMV7OBJDIR := $(ARMV7OBJDIR)/rm/test
15 ARMV7BINDIR := $(ARMV7BINDIR)/rm/test
17 #Cross tools
18 ifdef CROSS_TOOL_INSTALL_PATH
19 # Support backwards compatibility with KeyStone1 approach
20  CC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
21  AC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)as
22  AR = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)ar
23  LD = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
24 endif
26 # INCLUDE Directories
27 RM_INC_DIR = $(PDK_INSTALL_PATH)/ti/drv/rm
29 RM_SRC_DIR ?= $(PDK_INSTALL_PATH)/ti/drv/rm
30 RM_TEST_DIR = $(RM_SRC_DIR)/test
31 RM_ARM_LIN_TEST_DIR = $(RM_TEST_DIR)/$(DEVICE)/armv7/linux
33 INCDIR := $(PDK_INSTALL_PATH);$(RM_INC_DIR);$(RM_ARM_LIN_TEST_DIR)
35 # Libraries
36 RM_LIB = -lrm
38 # Compiler options
39 INTERNALDEFS = $(DEBUG_FLAG) -D__ARMv7 -DDEVICE_K2K -D_VIRTUAL_ADDR_SUPPORT -D__LINUX_USER_SPACE -D_LITTLE_ENDIAN=1 -DMAKEFILE_BUILD
41 # Linker options
42 INTERNALLINKDEFS = --start-group -L $(ARMV7LIBDIR) $(RM_LIB) -lrt --end-group -pthread $(LDFLAGS)
44 RM_SERVER_EXE=rmServer.out
45 RM_CLIENT_TEST_EXE=rmClientTest.out
47 OBJEXT = o 
49 SRCDIR = $(RM_ARM_LIN_TEST_DIR)
51 INCS = -I. -I$(strip $(subst ;, -I,$(INCDIR)))
53 VPATH=$(SRCDIR)
55 #List the Source Files
56 RM_SERVER_SRC =     \
57     rm_server.c     \
58     rm_linux_osal.c \
59     sockutils.c
60     
61 RM_CLIENT_TEST_SRC = \
62     rm_client_test.c \
63     rm_linux_osal.c  \
64     sockutils.c
66 # FLAGS for the SourceFiles
67 SRC_CFLAGS = -I. $(CFLAGS)
69 # Make Rule for the SRC Files
70 RM_SERVER_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_SERVER_SRC))
71 RM_CLIENT_TEST_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_CLIENT_TEST_SRC))
73 all:$(ARMV7BINDIR)/$(RM_SERVER_EXE) $(ARMV7BINDIR)/$(RM_CLIENT_TEST_EXE)
75 $(ARMV7BINDIR)/$(RM_SERVER_EXE): $(RM_SERVER_SRC_OBJS) $(ARMV7BINDIR)/.created
76         @echo linking $(RM_SERVER_SRC_OBJS) into $@ ...
77         @$(CC) $(RM_SERVER_SRC_OBJS) $(INTERNALLINKDEFS) -o $@
78 $(ARMV7BINDIR)/$(RM_CLIENT_TEST_EXE): $(RM_CLIENT_TEST_SRC_OBJS) $(ARMV7BINDIR)/.created
79         @echo linking $(RM_CLIENT_TEST_SRC_OBJS) into $@ ...
80         @$(CC) $(RM_CLIENT_TEST_SRC_OBJS) $(INTERNALLINKDEFS) -o $@
82 $(ARMV7OBJDIR)/%.$(OBJEXT): %.c $(ARMV7OBJDIR)/.created
83         @echo compiling $< ...
84         @$(CC) -c $(SRC_CFLAGS) $(INTERNALDEFS) $(INCS)  $< -o $@
86 $(ARMV7OBJDIR)/.created:
87         @mkdir -p $(ARMV7OBJDIR)
88         @touch $(ARMV7OBJDIR)/.created
90 $(ARMV7BINDIR)/.created:
91         @mkdir -p $(ARMV7BINDIR)
92         @touch $(ARMV7BINDIR)/.created
94 clean:
95         @rm -fr $(ARMV7OBJDIR)
96         @rm -fr $(ARMV7BINDIR)