host_bios: Cleanup makefiles
[processor-sdk/big-data-ipc-examples.git] / host_bios / simple_buffer_example / host / makefile
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/$(BOARD_NAME)/$(PROFILE)/obj/,$(patsubst %.c,%.oa15fg,$(srcs)))
42 CONFIG = bin/$(BOARD_NAME)/$(PROFILE)/configuro
44 HOSTOS = bios
45 locallibsrcs = shared/bigdataxlat/bios/bigdataxlat.c
46 locallibobjs = $(addprefix bin/shared/$(PLATFORM)/$(PROFILE)/obj/,$(patsubst %.c,%.oa15fg,$(locallibsrcs)))
48 -include $(addprefix bin/$(BOARD_NAME)/$(PROFILE)/obj/,$(patsubst %.c,%.oa15fg.dep,$(srcs)))
49 -include $(addprefix bin/shared/$(PLATFORM)/$(PROFILE)/obj/,$(patsubst %.c,%.oa15fg.dep,$(locallibsrcs)))
51 .PRECIOUS: %/compiler.opt %/linker.cmd
53 .PHONY: release debug install install_rov
55 all: release
56 #all: debug
58 release:
59         $(MAKE) PROFILE=release app_host.x
61 debug:
62         $(MAKE) PROFILE=debug app_host.x
64 app_host.x: bin/$(BOARD_NAME)/$(PROFILE)/app_host.xa15fg
65 bin/$(BOARD_NAME)/$(PROFILE)/app_host.xa15fg: $(objs) $(locallibobjs) $(libs) $(CONFIG)/linker.cmd
66         @$(ECHO) "#"
67         @$(ECHO) "# Making $@ ..."
68         $(LD) -o $@ $(LDFLAGS) $(objs) $(locallibobjs) $(libs) -Wl,-T,$(CONFIG)/linker.cmd \
69                 -lgcc -lc -lm -lnosys $(LDLIBS)
71 bin/$(BOARD_NAME)/$(PROFILE)/obj/%.oa15fg: %.c $(CONFIG)/compiler.opt
72         @$(ECHO) "#"
73         @$(ECHO) "# Making $@ ..."
74         $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
76 bin/shared/$(PLATFORM)/$(PROFILE)/obj/%.oa15fg: ../%.c $(CONFIG)/compiler.opt
77         @$(ECHO) "#"
78         @$(ECHO) "# Making $@ ..."
79         $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
81 %/compiler.opt: %/linker.cmd ;
82 %/linker.cmd: Host.cfg ../shared/$(PLATFORM)/config.bld
83         @$(ECHO) "#"
84         @$(ECHO) "# Making $@ ..."
85         $(XDC_INSTALL_DIR)/xs --xdcpath="$(subst +,;,$(PKGPATH))" \
86             xdc.tools.configuro -o $(CONFIG) \
87             -t gnu.targets.arm.A15F \
88             -c $(gnu.targets.arm.A15F) \
89             -p $(HOST_PLATFORM) \
90             -b ../shared/$(PLATFORM)/config.bld -r release \
91             --cfgArgs "{ \
92                 procnamelist: [$(PROC_NAME_LIST)], \
93                 procname: \"$(PROC_HOST_NAME)\", \
94                 boardname: \"$(BOARD_NAME)\", \
95                 profile: \"$(PROFILE)\" \
96             }" \
97             Host.cfg
99 install:
100         @$(ECHO) "#"
101         @$(ECHO) "# Making $@ ..."
102 #       @$(MKDIR) $(EXEC_DIR)/debug
103 #       $(CP) bin/$(PLATFORM)/debug/app_host.xa15fg $(EXEC_DIR)/debug
104         @$(MKDIR) $(EXEC_DIR)/release
105         $(CP) bin/$(BOARD_NAME)/release/app_host.xa15fg $(EXEC_DIR)/release
107 install_rov:
108         @$(ECHO) "#"
109         @$(ECHO) "# Making $@ ..."
110         @$(MKDIR) $(EXEC_DIR)/release
111         $(CP) bin/$(BOARD_NAME)/release/configuro/package/cfg/Host_pa15fg.rov.xs $(EXEC_DIR)/release
113 help:
114         @$(ECHO) "make                   # build executable"
115         @$(ECHO) "make clean             # clean everything"
117 clean::
118         $(RMDIR) bin
120 PKGPATH := $(BIOS_INSTALL_DIR)/packages
121 PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
122 PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
123 PKGPATH := $(PKGPATH)+$(PDK_INSTALL_DIR)
126 #  ======== install validation ========
127 ifeq (install,$(MAKECMDGOALS))
128 ifeq (,$(EXEC_DIR))
129 $(error must specify EXEC_DIR)
130 endif
131 endif
133 #  ======== toolchain macros ========
134 CC = $(gnu.targets.arm.A15F)/bin/arm-none-eabi-gcc -c -MD -MF $@.dep
135 LD = $(gnu.targets.arm.A15F)/bin/arm-none-eabi-gcc
137 CPPFLAGS = -Dfar= -D__DYNAMIC_REENT__
138 CFLAGS = -Wall -Wunused -Wunknown-pragmas -ffunction-sections -fdata-sections $(CCPROFILE_$(PROFILE)) @$(CONFIG)/compiler.opt -I.
139 CFLAGS += -I../shared/bigdataxlat/bios
140 CFLAGS += -DSERVER=\"$(SERVER)\" -DPLATFORM_$(PLATFORM)
142 LDFLAGS = $(LDPROFILE_$(PROFILE)) -mfloat-abi=hard -nostartfiles -Wl,-static -Wl,--gc-sections -Wl,-Map=$(@D)/obj/$(@F).map
143 LDLIBS = -L$(BIOS_INSTALL_DIR)/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/fpu
145 CCPROFILE_debug = -g -ggdb -D_DEBUG_=1
146 CCPROFILE_release = -O2
148 LDPROFILE_debug = -g -ggdb
149 LDPROFILE_release =
151 #  ======== standard macros ========
152 ifneq (,$(wildcard $(XDC_INSTALL_DIR)/bin/echo.exe))
153     # use these on Windows
154     CP      = $(XDC_INSTALL_DIR)/bin/cp
155     ECHO    = $(XDC_INSTALL_DIR)/bin/echo
156     MKDIR   = $(XDC_INSTALL_DIR)/bin/mkdir -p
157     RM      = $(XDC_INSTALL_DIR)/bin/rm -f
158     RMDIR   = $(XDC_INSTALL_DIR)/bin/rm -rf
159 else
160     # use these on Linux
161     CP      = cp
162     ECHO    = echo
163     MKDIR   = mkdir -p
164     RM      = rm -f
165     RMDIR   = rm -rf
166 endif
168 #  ======== create output directories ========
169 ifneq (clean,$(MAKECMDGOALS))
170 ifneq (,$(PROFILE))
171 ifeq (,$(wildcard bin/$(BOARD_NAME)/$(PROFILE)/obj))
172     $(shell $(MKDIR) -p bin/$(BOARD_NAME)/$(PROFILE)/obj)
173 endif
174 ifeq (,$(wildcard bin/shared/$(PLATFORM)/$(PROFILE)/obj/shared/bigdataxlat/bios))
175     $(shell $(MKDIR) -p bin/shared/$(PLATFORM)/$(PROFILE)/obj/shared/bigdataxlat/bios)
176 endif
177 endif
178 endif