1 #
2 # Copyright (c) 2012-2015 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 = MainDsp1.c Server.c
41 objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.oe66,$(srcs)))
42 CONFIG = bin/$(PROFILE)/configuro
44 PKGPATH := $(BIOS_INSTALL_DIR)/packages
45 PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
46 PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
48 -include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.oe66.dep,$(srcs)))
50 .PRECIOUS: %/compiler.opt %/linker.cmd
52 all: debug release
54 debug:
55 $(MAKE) PROFILE=debug PROCLIST="$(PROCLIST)" server_dsp1.x
57 release:
58 $(MAKE) PROFILE=release PROCLIST="$(PROCLIST)" server_dsp1.x
60 server_dsp1.x: bin/$(PROFILE)/server_dsp1.xe66
61 bin/$(PROFILE)/server_dsp1.xe66: $(objs) $(libs) $(CONFIG)/linker.cmd
62 @$(ECHO) "#"
63 @$(ECHO) "# Making $@ ..."
64 $(LD) $(LDFLAGS) -o $@ $(objs) \
65 $(addprefix -l ,$(libs)) $(CONFIG)/linker.cmd $(LDLIBS)
67 bin/$(PROFILE)/obj/%.oe66: %.c $(CONFIG)/compiler.opt
68 @$(ECHO) "#"
69 @$(ECHO) "# Making $@ ..."
70 $(CC) $(CPPFLAGS) $(CFLAGS) --output_file=$@ -fc $<
72 %/linker.cmd %/compiler.opt: $(CONFIG)/.config ;
73 $(CONFIG)/.config: Dsp1.cfg ../shared/config.bld
74 @$(ECHO) "#"
75 @$(ECHO) "# Making $@ ..."
76 $(XDC_INSTALL_DIR)/xs --xdcpath="$(subst +,;,$(PKGPATH))" \
77 xdc.tools.configuro -o $(CONFIG) \
78 -t ti.targets.elf.C66 \
79 -c $(ti.targets.elf.C66) \
80 -p ti.platforms.evmDRA7XX:dsp1 \
81 -b ../shared/config.bld -r $(PROFILE) \
82 Dsp1.cfg
83 @$(ECHO) "" > $@
85 install:
86 @$(ECHO) "#"
87 @$(ECHO) "# Making $@ ..."
88 @$(MKDIR) $(EXEC_DIR)/debug
89 $(CP) bin/debug/server_dsp1.xe66 $(EXEC_DIR)/debug
90 @$(MKDIR) $(EXEC_DIR)/release
91 $(CP) bin/release/server_dsp1.xe66 $(EXEC_DIR)/release
93 help:
94 @$(ECHO) "make # build executable"
95 @$(ECHO) "make clean # clean everything"
97 clean::
98 $(RMDIR) bin
100 # ======== install validation ========
101 ifeq (install,$(MAKECMDGOALS))
102 ifeq (,$(EXEC_DIR))
103 $(error must specify EXEC_DIR)
104 endif
105 endif
107 # ======== toolchain macros ========
108 CGTOOLS = $(ti.targets.elf.C66)
110 CC = $(CGTOOLS)/bin/cl6x -c
111 LD = $(CGTOOLS)/bin/cl6x -z
113 CPPFLAGS =
114 CFLAGS = -qq -pdsw225 -ppd=$@.dep -ppa $(CCPROFILE_$(PROFILE)) -@$(CONFIG)/compiler.opt -I.
116 # entry point is set to an aligned address so that IPC can load the slave
117 LDFLAGS = -w -q -u _c_int00 -c -m $(@D)/obj/$(@F).map
118 LDLIBS = -l $(CGTOOLS)/lib/libc.a
120 CCPROFILE_debug = -D_DEBUG_=1 --symdebug:dwarf
121 CCPROFILE_release = -O2
123 # ======== standard macros ========
124 ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
125 # use these on Windows
126 CP = $(XDC_INSTALL_DIR)/bin/cp
127 ECHO = $(XDC_INSTALL_DIR)/bin/echo
128 MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
129 RM = $(XDC_INSTALL_DIR)/bin/rm -f
130 RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
131 else
132 # use these on Linux
133 CP = cp
134 ECHO = echo
135 MKDIR = mkdir -p
136 RM = rm -f
137 RMDIR = rm -rf
138 endif
140 # ======== create output directories ========
141 ifneq (clean,$(MAKECMDGOALS))
142 ifneq (,$(PROFILE))
143 ifeq (,$(wildcard bin/$(PROFILE)/obj))
144 $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
145 endif
146 endif
147 endif