1
|
#
|
2
|
# Copyright (c) 2013-2018 Texas Instruments Incorporated - http://www.ti.com
|
3
|
# All rights reserved.
|
4
|
#
|
5
|
# Redistribution and use in source and binary forms, with or without
|
6
|
# modification, are permitted provided that the following conditions
|
7
|
# are met:
|
8
|
#
|
9
|
# * Redistributions of source code must retain the above copyright
|
10
|
# notice, this list of conditions and the following disclaimer.
|
11
|
#
|
12
|
# * Redistributions in binary form must reproduce the above copyright
|
13
|
# notice, this list of conditions and the following disclaimer in the
|
14
|
# documentation and/or other materials provided with the distribution.
|
15
|
#
|
16
|
# * Neither the name of Texas Instruments Incorporated nor the names of
|
17
|
# its contributors may be used to endorse or promote products derived
|
18
|
# from this software without specific prior written permission.
|
19
|
#
|
20
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
22
|
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
23
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
24
|
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
25
|
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
26
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
27
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
28
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
29
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
30
|
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
#
|
32
|
|
33
|
#
|
34
|
# ======== Makefile ========
|
35
|
#
|
36
|
|
37
|
srcs = main_host.c App.c
|
38
|
|
39
|
EXBASE = ..
|
40
|
include $(EXBASE)/products.mak
|
41
|
-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A.dep,$(srcs)))
|
42
|
|
43
|
objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A,$(srcs)))
|
44
|
|
45
|
ifdef LIBS_STATIC
|
46
|
libs = libtitransportrpmsg.a \
|
47
|
libtiipc.a \
|
48
|
libtiipcutils.a
|
49
|
else
|
50
|
# Use dynamic or shared libs
|
51
|
#libs = $(IPC_INSTALL_DIR)/linux/src/api/.libs/libtiipc.so \
|
52
|
# $(IPC_INSTALL_DIR)/linux/src/utils/.libs/libtiipcutils.so \
|
53
|
# $(IPC_INSTALL_DIR)/linux/src/transport/.libs/libtitransportrpmsg.so
|
54
|
libs =
|
55
|
# Use dynamic or static libraries installed on your linux distribution
|
56
|
endif
|
57
|
|
58
|
all:
|
59
|
@$(ECHO) "#"
|
60
|
@$(ECHO) "# Making $@ ..."
|
61
|
$(MAKE) PROFILE=debug app_host
|
62
|
$(MAKE) PROFILE=release app_host
|
63
|
|
64
|
help:
|
65
|
@$(ECHO) "make # build executables"
|
66
|
@$(ECHO) "make clean # clean everything"
|
67
|
|
68
|
install:
|
69
|
@$(ECHO) "#"
|
70
|
@$(ECHO) "# Making $@ ..."
|
71
|
@$(MKDIR) $(EXEC_DIR)/debug
|
72
|
$(CP) bin/debug/app_host $(EXEC_DIR)/debug
|
73
|
@$(MKDIR) $(EXEC_DIR)/release
|
74
|
$(CP) bin/release/app_host $(EXEC_DIR)/release
|
75
|
|
76
|
clean::
|
77
|
$(RMDIR) bin
|
78
|
|
79
|
|
80
|
#
|
81
|
# ======== rules ========
|
82
|
#
|
83
|
app_host: bin/$(PROFILE)/app_host
|
84
|
bin/$(PROFILE)/app_host: $(objs) $(libs)
|
85
|
@$(ECHO) "#"
|
86
|
@$(ECHO) "# Making $@ ..."
|
87
|
$(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
|
88
|
|
89
|
bin/$(PROFILE)/obj/%.ov7A: %.c
|
90
|
@$(ECHO) "#"
|
91
|
@$(ECHO) "# Making $@ ..."
|
92
|
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
93
|
|
94
|
# ======== install validation ========
|
95
|
ifeq (install,$(MAKECMDGOALS))
|
96
|
ifeq (,$(EXEC_DIR))
|
97
|
$(error must specify EXEC_DIR)
|
98
|
endif
|
99
|
endif
|
100
|
|
101
|
# ======== toolchain macros ========
|
102
|
CC = $(TOOLCHAIN_PREFIX)gcc
|
103
|
AR = $(TOOLCHAIN_PREFIX)ar
|
104
|
LD = $(TOOLCHAIN_PREFIX)gcc
|
105
|
CFLAGS =
|
106
|
CPPFLAGS =
|
107
|
LDFLAGS = -L$(IPC_INSTALL_DIR)/linux/src/api/.libs/ \
|
108
|
-L$(IPC_INSTALL_DIR)/linux/src/utils/.libs \
|
109
|
-L$(IPC_INSTALL_DIR)/linux/src/transport/.libs \
|
110
|
--sysroot $(LINUX_SYSROOT_DIR)
|
111
|
|
112
|
CFLAGS += -c -MD -MF $@.dep
|
113
|
ARFLAGS = cr
|
114
|
|
115
|
CPPFLAGS += -D_REENTRANT
|
116
|
|
117
|
CFLAGS += -Wall -ffloat-store -fPIC -Wunused -pthread -Dfar= $(CCPROFILE_$(PROFILE)) \
|
118
|
-I. -I..
|
119
|
CFLAGS += --sysroot $(LINUX_SYSROOT_DIR)
|
120
|
CFLAGS += -I$(IPC_INSTALL_DIR)/linux/include -I$(IPC_INSTALL_DIR)/packages
|
121
|
CFLAGS += -mfpu=neon -mfloat-abi=hard
|
122
|
|
123
|
LDFLAGS += $(LDPROFILE_$(PROFILE)) -Wall -Wl,-Map=$@.map
|
124
|
|
125
|
LDLIBS = -lpthread -lc -lrt
|
126
|
ifndef LIBS_STATIC
|
127
|
LDLIBS +=-ltiipc -ltiipcutils -ltitransportrpmsg
|
128
|
endif
|
129
|
CCPROFILE_debug = -ggdb -D DEBUG
|
130
|
CCPROFILE_release = -O3 -D NDEBUG
|
131
|
|
132
|
LDPROFILE_debug = -ggdb
|
133
|
LDPROFILE_release = -O3
|
134
|
|
135
|
# ======== standard macros ========
|
136
|
ifneq (,$(wildcard $(XDC_INSTALL_DIR)/bin/echo.exe))
|
137
|
# use these on Windows
|
138
|
CP = $(XDC_INSTALL_DIR)/bin/cp
|
139
|
ECHO = $(XDC_INSTALL_DIR)/bin/echo
|
140
|
MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
|
141
|
RM = $(XDC_INSTALL_DIR)/bin/rm -f
|
142
|
RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
|
143
|
else
|
144
|
# use these on Linux
|
145
|
CP = cp
|
146
|
ECHO = echo
|
147
|
MKDIR = mkdir -p
|
148
|
RM = rm -f
|
149
|
RMDIR = rm -rf
|
150
|
endif
|
151
|
|
152
|
# ======== create output directories ========
|
153
|
ifneq (clean,$(MAKECMDGOALS))
|
154
|
ifneq (,$(PROFILE))
|
155
|
ifeq (,$(wildcard bin/$(PROFILE)/obj))
|
156
|
$(shell $(MKDIR) -p bin/$(PROFILE)/obj)
|
157
|
endif
|
158
|
endif
|
159
|
endif
|