1 #
2 # Copyright (c) 2017 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 #
33 #
34 # ======== makefile ========
35 #
37 EXBASE = ..
38 include $(EXBASE)/products.mak
40 srcs = MainDsp.c Server.c
41 objs = $(addprefix bin/$(PLATFORM)/$(PROFILE)/obj/,$(patsubst %.c,%.oe66,$(srcs)))
42 CONFIG = bin/$(PLATFORM)/$(PROFILE)/configuro
44 HOSTOS = bios
45 locallibsrcs = shared/bigdataxlat/$(HOSTOS)/bigdataxlat.c
46 locallibobjs = $(addprefix bin/shared/$(PLATFORM)/$(PROFILE)/obj/,$(patsubst %.c,%.oe66,$(locallibsrcs)))
48 PKGPATH := $(BIOS_INSTALL_DIR)/packages
49 PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
50 PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
52 -include $(addprefix bin/$(PLATFORM)/$(PROFILE)/obj/,$(patsubst %.c,%.oe66.dep,$(srcs)))
53 -include $(addprefix bin/shared/$(PLATFORM)/$(PROFILE)/obj/,$(patsubst %.c,%.oe66.dep,$(locallibsrcs)))
55 .PRECIOUS: %/compiler.opt %/linker.cmd
57 all: release
59 debug:
60 echo Building debug
61 $(MAKE) PROFILE=debug server_dsp.x
63 release:
64 $(MAKE) PROFILE=release server_dsp.x
66 server_dsp.x: bin/$(PLATFORM)/$(PROFILE)/server_dsp.xe66
67 echo executing server_dsp.x
69 bin/$(PLATFORM)/$(PROFILE)/server_dsp.xe66: $(objs) $(locallibobjs) $(libs) $(CONFIG)/linker.cmd
70 @$(ECHO) "#"
71 @$(ECHO) "# Making $@ ..."
72 $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
74 bin/$(PLATFORM)/$(PROFILE)/obj/%.oe66: %.c $(CONFIG)/compiler.opt
75 @$(ECHO) "#"
76 @$(ECHO) "# Making $@ ..."
77 $(CC) $(CPPFLAGS) $(CFLAGS) --output_file=$@ -fc $<
79 bin/shared/$(PLATFORM)/$(PROFILE)/obj/%.oe66: ../%.c $(CONFIG)/compiler.opt
80 @$(ECHO) "#"
81 @$(ECHO) "# Making $@ ..."
82 $(CC) $(CPPFLAGS) $(CFLAGS) --output_file=$@ -fc $<
84 %/compiler.opt: %/linker.cmd ;
85 %/linker.cmd: Dsp.cfg ../shared/$(PLATFORM)/config.bld
86 @$(ECHO) "#"
87 @$(ECHO) "# Making $@ ..."
88 $(XDC_INSTALL_DIR)/xs --xdcpath="$(subst +,;,$(PKGPATH))" \
89 xdc.tools.configuro -o $(CONFIG) \
90 -t ti.targets.elf.C66 \
91 -c $(ti.targets.elf.C66) \
92 -p $(DSP_PLATFORM) \
93 -b ../shared/$(PLATFORM)/config.bld -r $(PROFILE) \
94 --cfgArgs "{ \
95 procnamelist: [$(PROC_NAME_LIST)], \
96 procname: \"$(PROC_DSP_NAME)\", \
97 profile: \"$(PROFILE)\" \
98 }" \
99 Dsp.cfg
101 install:
102 @$(ECHO) "#"
103 @$(ECHO) "# Making $@ ..."
104 # @$(MKDIR) $(EXEC_DIR)/debug
105 # $(CP) bin/$(PLATFORM)/debug/server_dsp.xe66 $(EXEC_DIR)/debug
106 @$(MKDIR) $(EXEC_DIR)/release
107 $(CP) bin/$(PLATFORM)/release/server_dsp.xe66 $(EXEC_DIR)/release
109 help:
110 @$(ECHO) "make # build executable"
111 @$(ECHO) "make clean # clean everything"
113 clean::
114 $(RMDIR) bin
116 # ======== install validation ========
117 ifeq (install,$(MAKECMDGOALS))
118 ifeq (,$(EXEC_DIR))
119 $(error must specify EXEC_DIR)
120 endif
121 endif
123 # ======== toolchain macros ========
124 CGTOOLS = $(ti.targets.elf.C66)
126 CC = $(CGTOOLS)/bin/cl6x -c
127 LD = $(CGTOOLS)/bin/cl6x -z
129 CPPFLAGS =
130 CFLAGS = -qq -pdsw225 -ppd=$@.dep -ppa $(CCPROFILE_$(PROFILE)) -@$(CONFIG)/compiler.opt -I.
131 CFLAGS += -I../shared/bigdataxlat/bios
133 LDFLAGS = -w -q -c -m $(@D)/obj/$(@F).map
134 LDLIBS = -l $(CGTOOLS)/lib/rts6600_elf.lib
136 CCPROFILE_debug = -D_DEBUG_=1 --symdebug:dwarf
137 CCPROFILE_release = -O2
139 # ======== standard macros ========
140 ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
141 # use these on Windows
142 CP = $(XDC_INSTALL_DIR)/bin/cp
143 ECHO = $(XDC_INSTALL_DIR)/bin/echo
144 MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
145 RM = $(XDC_INSTALL_DIR)/bin/rm -f
146 RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
147 else
148 # use these on Linux
149 CP = cp
150 ECHO = echo
151 MKDIR = mkdir -p
152 RM = rm -f
153 RMDIR = rm -rf
154 endif
156 # ======== create output directories ========
157 ifneq (clean,$(MAKECMDGOALS))
158 ifneq (,$(PROFILE))
159 ifeq (,$(wildcard bin/$(PLATFORM)/$(PROFILE)/obj))
160 $(shell $(MKDIR) -p bin/$(PLATFORM)/$(PROFILE)/obj)
161 endif
162 ifeq (,$(wildcard bin/shared/$(PLATFORM)/$(PROFILE)/obj/shared/bigdataxlat/bios))
163 $(shell $(MKDIR) -p bin/shared/$(PLATFORM)/$(PROFILE)/obj/shared/bigdataxlat/bios)
164 endif
165 endif
166 endif