1 #
2 # Copyright (c) 2012-2014 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 = MainHost.c App.c
41 objs = $(addprefix bin/$(PLATFORM)/$(PROFILE)/obj/,$(patsubst %.c,%.oa15fg,$(srcs)))
42 CONFIG = bin/$(PLATFORM)/$(PROFILE)/configuro
44 -include $(addprefix bin/$(PLATFORM)/$(PROFILE)/obj/,$(patsubst %.c,%.oa15fg.dep,$(srcs)))
46 .PRECIOUS: %/compiler.opt %/linker.cmd
48 all: release
49 #all: debug
51 release:
52 $(MAKE) PROFILE=release app_host.x
54 debug:
55 $(MAKE) PROFILE=debug app_host.x
57 app_host.x: bin/$(PLATFORM)/$(PROFILE)/app_host.xa15fg
58 bin/$(PLATFORM)/$(PROFILE)/app_host.xa15fg: $(objs) $(libs) $(CONFIG)/linker.cmd
59 @$(ECHO) "#"
60 @$(ECHO) "# Making $@ ..."
61 $(LD) -o $@ $(LDFLAGS) $(objs) $(libs) -Wl,-T,$(CONFIG)/linker.cmd \
62 -lgcc -lc -lm -lnosys $(LDLIBS)
64 bin/$(PLATFORM)/$(PROFILE)/obj/%.oa15fg: %.c $(CONFIG)/compiler.opt
65 @$(ECHO) "#"
66 @$(ECHO) "# Making $@ ..."
67 $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
69 %/compiler.opt: %/linker.cmd ;
70 %/linker.cmd: Host.cfg ../shared/$(PLATFORM)/config.bld
71 @$(ECHO) "#"
72 @$(ECHO) "# Making $@ ..."
73 $(XDC_INSTALL_DIR)/xs --xdcpath="$(subst +,;,$(PKGPATH))" \
74 xdc.tools.configuro -o $(CONFIG) \
75 -t gnu.targets.arm.A15F \
76 -c $(gnu.targets.arm.A15F) \
77 -p $(HOST_PLATFORM) \
78 -b ../shared/$(PLATFORM)/config.bld -r release \
79 --cfgArgs "{ \
80 procnamelist: [$(PROC_NAME_LIST)], \
81 procname: \"$(PROC_HOST_NAME)\", \
82 boardname: \"$(BOARD_NAME)\", \
83 profile: \"$(PROFILE)\" \
84 }" \
85 Host.cfg
87 install:
88 @$(ECHO) "#"
89 @$(ECHO) "# Making $@ ..."
90 # @$(MKDIR) $(EXEC_DIR)/debug
91 # $(CP) bin/$(PLATFORM)/debug/app_host.xa15fg $(EXEC_DIR)/debug
92 @$(MKDIR) $(EXEC_DIR)/release
93 $(CP) bin/$(PLATFORM)/release/app_host.xa15fg $(EXEC_DIR)/release
95 help:
96 @$(ECHO) "make # build executable"
97 @$(ECHO) "make clean # clean everything"
99 clean::
100 $(RMDIR) bin
102 PKGPATH := $(BIOS_INSTALL_DIR)/packages
103 PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
104 PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
105 PKGPATH := $(PKGPATH)+$(PDK_INSTALL_DIR)
108 # ======== install validation ========
109 ifeq (install,$(MAKECMDGOALS))
110 ifeq (,$(EXEC_DIR))
111 $(error must specify EXEC_DIR)
112 endif
113 endif
115 # ======== toolchain macros ========
116 CC = $(gnu.targets.arm.A15F)/bin/arm-none-eabi-gcc -c -MD -MF $@.dep
117 LD = $(gnu.targets.arm.A15F)/bin/arm-none-eabi-gcc
119 CPPFLAGS = -Dfar= -D__DYNAMIC_REENT__
120 CFLAGS = -Wall -Wunused -Wunknown-pragmas -ffunction-sections -fdata-sections $(CCPROFILE_$(PROFILE)) @$(CONFIG)/compiler.opt -I.
121 CFLAGS += -DSERVER=\"$(SERVER)\"
123 LDFLAGS = $(LDPROFILE_$(PROFILE)) -mfloat-abi=hard -nostartfiles -Wl,-static -Wl,--gc-sections -Wl,-Map=$(@D)/obj/$(@F).map
124 LDLIBS = -L$(BIOS_INSTALL_DIR)/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/fpu
126 CCPROFILE_debug = -g -ggdb -D_DEBUG_=1
127 CCPROFILE_release = -O2
129 LDPROFILE_debug = -g -ggdb
130 LDPROFILE_release =
132 # ======== standard macros ========
133 ifneq (,$(wildcard $(XDC_INSTALL_DIR)/bin/echo.exe))
134 # use these on Windows
135 CP = $(XDC_INSTALL_DIR)/bin/cp
136 ECHO = $(XDC_INSTALL_DIR)/bin/echo
137 MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
138 RM = $(XDC_INSTALL_DIR)/bin/rm -f
139 RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
140 else
141 # use these on Linux
142 CP = cp
143 ECHO = echo
144 MKDIR = mkdir -p
145 RM = rm -f
146 RMDIR = rm -rf
147 endif
149 # ======== create output directories ========
150 ifneq (clean,$(MAKECMDGOALS))
151 ifneq (,$(PROFILE))
152 ifeq (,$(wildcard bin/$(PROFILE)/obj))
153 $(shell $(MKDIR) -p bin/$(PLATFORM)/$(PROFILE)/obj)
154 endif
155 endif
156 endif