| 227 |
dpurdie |
1 |
# -*- mode: mak; -*-
|
|
|
2 |
###############################################################################
|
| 6177 |
dpurdie |
3 |
# COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.
|
| 227 |
dpurdie |
4 |
#
|
|
|
5 |
# File: TOOLSET/dafbr.rul[e]
|
|
|
6 |
# Contents: daf br compiler rules
|
|
|
7 |
#
|
|
|
8 |
# Description:
|
|
|
9 |
# This file provides Toolset rules for the target makefiles
|
|
|
10 |
# The file is dropped into the target makefile
|
|
|
11 |
#
|
|
|
12 |
# Revision History:
|
|
|
13 |
# 16-Dec-04 DDP Started Work
|
|
|
14 |
###############################################################################
|
|
|
15 |
|
|
|
16 |
###############################################################################
|
|
|
17 |
#.. Remove "undef" warnings
|
|
|
18 |
#
|
|
|
19 |
cc_includes +=
|
|
|
20 |
cc_defines +=
|
|
|
21 |
brcc_flags +=
|
|
|
22 |
|
|
|
23 |
###############################################################################
|
|
|
24 |
#.. Parse user options
|
|
|
25 |
# Global options already parsed
|
|
|
26 |
# These options extend the global options
|
|
|
27 |
ifdef OPTIONS
|
|
|
28 |
endif
|
|
|
29 |
|
|
|
30 |
###############################################################################
|
|
|
31 |
#.. Compiler definitions
|
|
|
32 |
#
|
|
|
33 |
|
|
|
34 |
ifdef ALVL
|
|
|
35 |
cc_defines += -DALVL=$(ALVL)
|
|
|
36 |
endif
|
|
|
37 |
|
|
|
38 |
ifdef DLVL
|
|
|
39 |
cc_defines += -DDLVL=$(DLVL)
|
|
|
40 |
endif
|
|
|
41 |
|
|
|
42 |
cc_defines += -D__SOURCE__=\"$(notdir $<)\"
|
|
|
43 |
|
|
|
44 |
br_includes = $(DAFBROPCODE_PATH) $(DAFBRCOMPILER_PATH)
|
|
|
45 |
|
|
|
46 |
#
|
|
|
47 |
# Compiler flags:
|
|
|
48 |
# /g file - payload definition file
|
|
|
49 |
# /l path - loads the specified opcode table file
|
|
|
50 |
# /little - output endian
|
|
|
51 |
# /big - output endian
|
|
|
52 |
# /d* - All debug files
|
|
|
53 |
# /d - Define debug maro only
|
|
|
54 |
|
|
|
55 |
ifeq "$(DEBUG)" "1" # debug/prod specific
|
|
|
56 |
cc_defines += -D_DEBUG
|
|
|
57 |
brcc_flags += /d
|
|
|
58 |
else
|
|
|
59 |
cc_defines += -DNDEBUG
|
|
|
60 |
endif
|
|
|
61 |
|
|
|
62 |
brcc_flags += /e$(ENDIAN)
|
|
|
63 |
|
|
|
64 |
ifdef USE_OPTIMISE # default for production
|
|
|
65 |
brcc_flags += /o
|
|
|
66 |
else
|
|
|
67 |
brcc_flags +=
|
|
|
68 |
endif
|
|
|
69 |
|
|
|
70 |
ifdef DAFBR_V2 # Version-2 compiler
|
|
|
71 |
brcc_flags += /nopayload /g $(BRCC_DEF)
|
|
|
72 |
endif
|
|
|
73 |
|
|
|
74 |
|
|
|
75 |
# Command
|
|
|
76 |
#..
|
|
|
77 |
cc = $(CC_PRE) $(DAFBRCOMPILER)
|
|
|
78 |
cc_init =
|
|
|
79 |
cc_o_switch = /Fr $(subst /,\,$@)
|
|
|
80 |
cc_source = $(subst /,\\,$<)
|
|
|
81 |
cc_flags = \
|
|
|
82 |
$(brcc_flags) \
|
|
|
83 |
$(patsubst %,/l %,$(subst /,\,$(DAFBROPCODE))) \
|
|
|
84 |
$(patsubst %,%,$(CFLAGS)) \
|
|
|
85 |
$(subst $(spacealt),$(space),$(patsubst %,/I %,$(subst /,\,$(INCDIRS)))) \
|
|
|
86 |
$(subst $(spacealt),$(space),$(patsubst %,/I %,$(subst /,\,$(cc_includes)))) \
|
|
|
87 |
$(subst $(spacealt),$(space),$(patsubst %,/I %,$(subst /,\,$(br_includes))))
|
|
|
88 |
|
|
|
89 |
cc_term =
|
|
|
90 |
|
|
|
91 |
define cc_pre
|
| 6177 |
dpurdie |
92 |
@$(echo) '[$<] compiling..'
|
| 227 |
dpurdie |
93 |
endef
|
|
|
94 |
|
|
|
95 |
cc_post =
|
|
|
96 |
|
|
|
97 |
cc_filter := "$(notdir $(wildcard $(GBE_ROOT)/warnings.dafbr))"
|
|
|
98 |
ifeq ($(strip $(cc_filter)), "warnings.dafbr")
|
|
|
99 |
cc_filter = $(GBE_ROOT)/warnings.dafbr
|
|
|
100 |
else
|
|
|
101 |
cc_filter =
|
|
|
102 |
endif
|
|
|
103 |
|
|
|
104 |
ifdef cc_filter
|
|
|
105 |
cc_redirect_stderr = 1
|
|
|
106 |
cc_error_filter = $(awk) -f $(cc_filter)
|
|
|
107 |
endif
|
|
|
108 |
|
|
|
109 |
|
|
|
110 |
###############################################################################
|
|
|
111 |
#.. C/C++ dependencies
|
|
|
112 |
# depend and depend.err
|
|
|
113 |
#
|
|
|
114 |
cc_depend =
|
|
|
115 |
ccdep = $(XX_PRE) $(GBE_BIN)/mkdepend
|
|
|
116 |
ccdep_init =
|
|
|
117 |
ccdep_o_switch = -f -
|
|
|
118 |
ccdep_source = $(filter %.c %.cc %.cpp, $+) > $@ 2> $@.err
|
|
|
119 |
ccdep_flags = -MM -b -We -p '$$(OBJDIR)/' \
|
|
|
120 |
$(foreach shname,$(SHNAMES),-p '$$(OBJDIR)/$(shname)/') \
|
|
|
121 |
-o ".$(o)" \
|
|
|
122 |
$(patsubst %,%,$(cc_depend)) \
|
|
|
123 |
$(patsubst %,%,$(cc_defines)) \
|
|
|
124 |
$(patsubst %,%,$(CFLAGS)) \
|
|
|
125 |
$(patsubst %,%,$(CXXFLAGS)) \
|
|
|
126 |
$(patsubst %,-D%,$(cc_defines)) \
|
|
|
127 |
$(subst $(spacealt),$(space),$(patsubst %,-I"%",$(subst /,\,$(INCDIRS)))) \
|
|
|
128 |
$(subst $(spacealt),$(space),$(patsubst %,-I"%",$(subst /,\,$(cc_includes)))) \
|
|
|
129 |
$(subst $(spacealt),$(space),$(patsubst %,-I"%",$(subst /,\,$(br_includes)))) \
|
|
|
130 |
$(patsubst %,-Y %,$(NODEPDIRS))
|
|
|
131 |
|
|
|
132 |
ccdep_pre =
|
|
|
133 |
ccdep_post =
|
|
|
134 |
|
|
|
135 |
|
|
|
136 |
#.. Application
|
|
|
137 |
# Link one or more .rul files into a single .bin file
|
|
|
138 |
# The individual .rul files are not specified. The compiler is
|
|
|
139 |
# instructed to look for them in the OBJECT directory
|
|
|
140 |
#
|
|
|
141 |
# Note: BRLD_FLAGS and BRLD_DEF are target specific variables
|
|
|
142 |
# They cannot be tested with a "ifdef", but can be used
|
|
|
143 |
# in substitutions
|
|
|
144 |
#
|
|
|
145 |
# Default values are set within the makefile and may
|
|
|
146 |
# be overriden within the recipe
|
|
|
147 |
#
|
|
|
148 |
|
|
|
149 |
ld = $(CC_PRE) $(DAFBRCOMPILER)
|
|
|
150 |
ld_o_switch = $(patsubst %,/I %,$(sort $(^D))) /Fp $(subst /,\,$@)
|
|
|
151 |
ld_term =
|
|
|
152 |
ld_flags = \
|
|
|
153 |
/nocompile \
|
|
|
154 |
$(patsubst %,/%,$(BRLD_FLAGS)) \
|
|
|
155 |
/e$(ENDIAN) \
|
|
|
156 |
/g $(subst /,\,$(BRLD_DEF)) \
|
|
|
157 |
$(subst $(spacealt),$(space),$(patsubst %,/I %,$(subst /,\,$(INCDIRS)))) \
|
|
|
158 |
$(subst $(spacealt),$(space),$(patsubst %,/I %,$(subst /,\,$(cc_includes)))) \
|
|
|
159 |
$(subst $(spacealt),$(space),$(patsubst %,/I %,$(subst /,\,$(br_includes))))
|
|
|
160 |
|
|
|
161 |
|
|
|
162 |
define ld_pre
|
| 6177 |
dpurdie |
163 |
echo '[$@] Generating Payload ..'
|
| 227 |
dpurdie |
164 |
endef
|
|
|
165 |
|
|
|
166 |
|
|
|
167 |
ld_post =
|
|
|
168 |
|