1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
|
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/usr/diag/prdf/framework/rule/makefile $
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2012,2014
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
# Relative path to root from this makefile
ROOTPATH = ../../../../../..
# Relative path to root from OBJ_RULE
OBJ_PLUG_LINK_PATH = ../../../..
OBJ_RULE = obj/modules/prdf/rule
OBJ_PLUG = obj/genfiles/plugins/prdf
SRC_USR = src/usr/diag/prdf
SRC_INC = src/include/usr/diag/prdf
OBJ_RULE_DIR = ${ROOTPATH}/${OBJ_RULE}
OBJ_PLUG_DIR = ${ROOTPATH}/${OBJ_PLUG}
SRC_USR_DIR = ${ROOTPATH}/${SRC_USR}
OBJ_RULE_LINK_DIR = ${OBJ_PLUG_LINK_PATH}/${OBJ_RULE}
VPATH = ${SRC_USR_DIR}/common/framework/rule
include ../../common/framework/rule/prdf_rule.mk
#------------------------------------------------------------------------------
# Generated files
#------------------------------------------------------------------------------
PRDR_CMP = prdrCompile
PRDR_CMP_o = ${PRDR_CMP}.o
PRDR_CMP_C = ${PRDR_CMP}.C
PRDR_CMP_YACC = ${PRDR_CMP}.y
PRDR_CMP_YACC_o = ${PRDR_CMP_YACC}.o
PRDR_CMP_YACC_C = ${PRDR_CMP_YACC}.C
PRDR_CMP_YACC_H = ${PRDR_CMP_YACC}.H
PRDR_CMP_FLEX = ${PRDR_CMP}.lex
PRDR_CMP_FLEX_o = ${PRDR_CMP_FLEX}.o
PRDR_CMP_FLEX_C = ${PRDR_CMP_FLEX}.C
PRDR_CMP_PATH = ${OBJ_RULE_DIR}/${PRDR_CMP}
PRDR_CMP_o_PATH = ${OBJ_RULE_DIR}/${PRDR_CMP_o}
PRDR_CMP_YACC_o_PATH = ${OBJ_RULE_DIR}/${PRDR_CMP_YACC_o}
PRDR_CMP_YACC_C_PATH = ${OBJ_RULE_DIR}/${PRDR_CMP_YACC_C}
PRDR_CMP_YACC_H_PATH = ${OBJ_RULE_DIR}/${PRDR_CMP_YACC_H}
PRDR_CMP_FLEX_o_PATH = ${OBJ_RULE_DIR}/${PRDR_CMP_FLEX_o}
PRDR_CMP_FLEX_C_PATH = ${OBJ_RULE_DIR}/${PRDR_CMP_FLEX_C}
PRF_IMG_PATHS = $(addprefix ${IMGDIR}/, ${prd_rule_prf_targets})
ERR_PLUGIN_PATHS = $(addprefix ${OBJ_PLUG_DIR}/, ${prd_rule_err_targets})
REG_PLUGIN_PATHS = $(addprefix ${OBJ_PLUG_DIR}/, ${prd_rule_reg_targets})
#-------------------------------------------------------------------------------
# Files linked to the error log plugins directory
#-------------------------------------------------------------------------------
# Entire directories to link.
SOURCE_PLUGIN_DIRS += ${SRC_USR}/common/plugins
SOURCE_PLUGIN_DIRS += ${SRC_USR}/plugins
# Individual source files to link.
SOURCE_PLUGIN_FILES += ${SRC_USR}/common/framework/rule/prdf_rule.mk
SOURCE_PLUGIN_FILES += ${SRC_USR}/common/framework/rule/tables.mk
SOURCE_PLUGIN_FILES += ${SRC_USR}/common/util/UtilHash.H
SOURCE_PLUGIN_FILES += ${SRC_USR}/common/plat/pegasus/prdfCenConst.H
SOURCE_PLUGIN_FILES += ${SRC_USR}/common/iipconst.h
SOURCE_PLUGIN_FILES += ${SRC_USR}/common/prdf_types.h
SOURCE_PLUGIN_FILES += ${SRC_INC}/common/prdf_service_codes.H
SOURCE_PLUGIN_FILES += $(foreach d, ${SOURCE_PLUGIN_DIRS}, $(addprefix $(d)/, $(notdir $(wildcard ${ROOTPATH}/$(d)/*))))
LINK_PLUGIN_FILES += $(addprefix ${OBJ_PLUG_DIR}/,$(notdir ${SOURCE_PLUGIN_FILES}))
#-------------------------------------------------------------------------------
# CODE_PASS
#-------------------------------------------------------------------------------
CODE_PASS_BODY += ${PRF_IMG_PATHS}
CODE_PASS_BODY += ${ERR_PLUGIN_PATHS}
CODE_PASS_BODY += ${REG_PLUGIN_PATHS}
CODE_PASS_BODY += ${LINK_PLUGIN_FILES}
CLEAN_TARGETS += ${PRDR_CMP_PATH}
CLEAN_TARGETS += ${PRDR_CMP_o_PATH}
CLEAN_TARGETS += ${PRDR_CMP_YACC_o_PATH}
CLEAN_TARGETS += ${PRDR_CMP_YACC_C_PATH}
CLEAN_TARGETS += ${PRDR_CMP_YACC_H_PATH}
CLEAN_TARGETS += ${PRDR_CMP_FLEX_o_PATH}
CLEAN_TARGETS += ${PRDR_CMP_FLEX_C_PATH}
CLEAN_TARGETS += $(addprefix ${OBJ_RULE_DIR}/, ${prd_rule_prf_targets})
CLEAN_TARGETS += $(addprefix ${OBJ_RULE_DIR}/, ${prd_rule_err_targets})
CLEAN_TARGETS += $(addprefix ${OBJ_RULE_DIR}/, ${prd_rule_reg_targets})
CLEAN_TARGETS += $(addprefix ${OBJ_RULE_DIR}/, ${prd_rule_html_targets})
CLEAN_TARGETS += ${PRF_IMG_PATHS}
CLEAN_TARGETS += ${ERR_PLUGIN_PATHS}
CLEAN_TARGETS += ${REG_PLUGIN_PATHS}
CLEAN_TARGETS += ${LINK_PLUGIN_FILES}
# NOTE: All rules defined in this makefile must be done after this line
# otherwise the default rule 'all' will not be called.
include ${ROOTPATH}/config.mk
# Special recipes to make the output less chatty
PRD_OUT_MAKE = $(C2) " MAKE $(notdir $@)"
PRD_OUT_LINK = $(C2) " LINK $(notdir $@)"
#-------------------------------------------------------------------------------
# Rules for directories that may not exist.
#-------------------------------------------------------------------------------
${OBJ_RULE_DIR}:
$(C1)mkdir -p ${OBJ_RULE_DIR}
${OBJ_PLUG_DIR}:
$(C1)mkdir -p ${OBJ_PLUG_DIR}
#-------------------------------------------------------------------------------
# Build the flex/yacc source code
#-------------------------------------------------------------------------------
${PRDR_CMP_YACC_C_PATH} \
${PRDR_CMP_YACC_H_PATH}: ${PRDR_CMP_YACC} | ${OBJ_RULE_DIR}
${PRD_OUT_MAKE}
$(C1)bison -d -o ${PRDR_CMP_YACC_C_PATH} $^
PRDR_CMP_FLEX: ; # Discard implicit rule for %.lex <- %.lex.C
${PRDR_CMP_FLEX_C_PATH}: ${PRDR_CMP_FLEX} | ${OBJ_RULE_DIR}
${PRD_OUT_MAKE}
$(C1)flex -o$@ $^
#------------------------------------------------------------------------------
# Build the PRD rule compiler
#------------------------------------------------------------------------------
USERDEFINES = -D__HOSTBOOT_MODULE -O3 -pipe
${PRDR_CMP_YACC_o_PATH}: ${PRDR_CMP_YACC_C_PATH} ${PRDR_CMP_YACC_H_PATH}
${PRD_OUT_MAKE}
$(C1)$(CCACHE) $(HOST_PREFIX)g++ -c $(USERDEFINES) $< \
-I ${SRC_USR_DIR}/common/framework/rule \
-I ${SRC_USR_DIR}/common/util -I ${OBJ_RULE_DIR} \
-o $@
${PRDR_CMP_FLEX_o_PATH}: ${PRDR_CMP_FLEX_C_PATH} ${PRDR_CMP_YACC_H_PATH}
${PRD_OUT_MAKE}
$(C1)$(CCACHE) $(HOST_PREFIX)g++ -c $(USERDEFINES) $< \
-I ${SRC_USR_DIR}/common/framework/rule \
-I ${SRC_USR_DIR}/common/util -I ${OBJ_RULE_DIR} \
-o $@
${PRDR_CMP_o_PATH}: ${PRDR_CMP_C} | ${OBJ_RULE_DIR}
${PRD_OUT_MAKE}
$(C1)$(CCACHE) $(HOST_PREFIX)g++ -c $(USERDEFINES) $< \
-I ${SRC_USR_DIR}/common/framework/rule \
-I ${SRC_USR_DIR}/common \
-I ${SRC_USR_DIR}/common/plugins \
-I ${SRC_USR_DIR}/common/util \
-I ${GENDIR} -I ${OBJ_RULE_DIR} \
-I ${SRC_USR_DIR}/common/framework/resolution \
-I ${SRC_USR_DIR}/common/framework/service \
-o $@
${PRDR_CMP_PATH}: ${PRDR_CMP_YACC_o_PATH} ${PRDR_CMP_FLEX_o_PATH} \
${PRDR_CMP_o_PATH}
${PRD_OUT_MAKE}
$(C1)$(HOST_PREFIX)g++ $(USERDEFINES) \
${PRDR_CMP_YACC_o_PATH} ${PRDR_CMP_FLEX_o_PATH} ${PRDR_CMP_o_PATH} \
-o $@
#------------------------------------------------------------------------------
# Build the *.prf, *.err.C, and *.reg.C files
#------------------------------------------------------------------------------
vpath %.rule ../../common/plat/pegasus
PRDRPP_SEARCHDIRS = -I../../common/plat/pegasus
${OBJ_RULE_DIR}/%.prf \
${OBJ_RULE_DIR}/%.prf.err.C \
${OBJ_RULE_DIR}/%.prf.reg.C : %.rule ${PRDR_CMP_PATH}
${PRD_OUT_MAKE}
$(C1)cat $< | ${SRC_USR_DIR}/common/framework/rule/prdrpp \
${PRDRPP_SEARCHDIRS} | $(JAILCMD) ${PRDR_CMP_PATH} $@
# Copy all .prf files from ${OBJ_RULE_DIR} to ${IMGDIR}
${PRF_IMG_PATHS}: ${IMGDIR}/% : ${OBJ_RULE_DIR}/%
$(C1)cp -f $^ $@
#------------------------------------------------------------------------------
# Link the necessary files to the plugins directory
#------------------------------------------------------------------------------
# Link all .prf.err.C and .prf.reg.C files from OBJ_RULE_DIR to OBJ_PLUG_DIR
${ERR_PLUGIN_PATHS} \
${REG_PLUGIN_PATHS}: ${OBJ_PLUG_DIR}/% : ${OBJ_RULE_DIR}/% | ${OBJ_PLUG_DIR}
${PRD_OUT_LINK}
$(C1)ln -sf ${OBJ_RULE_LINK_DIR}/$(notdir $^) $@
# Link all individual header file needed to compile plugin code.
define LINK_RULE
${OBJ_PLUG_DIR}/$(notdir $(1)): $(ROOTPATH)/$(1) | ${OBJ_PLUG_DIR}
$(C2) " LINK $$(notdir $$@)"
$(C1)ln -sf ${OBJ_PLUG_LINK_PATH}/$(1) $$@
endef
$(foreach file,${SOURCE_PLUGIN_FILES}, $(eval $(call LINK_RULE,$(file))))
|