1 |
vpath %.pcf $(LOCALTOP)/$(workdir):$(RELEASETOP)/$(workdir)
|
2 |
|
3 |
#
|
4 |
# Some system variables - input through CAPITAL variables
|
5 |
#
|
6 |
|
7 |
mccabe_extensions_pats:=$(addprefix %.,$(MCCABE_EXTENSIONS))
|
8 |
#mccabe_files:=$(filter %.cc %.cxx %.cpp %.C %.c,$(files))
|
9 |
allfiles:=$(files) $(locbinfiles)
|
10 |
mccabe_files:=$(filter $(mccabe_extensions_pats),$(allfiles))
|
11 |
mccabe_pcf_files_test:=$(patsubst %.cc,%_ccsrc.pcf,$(mccabe_files)))
|
12 |
pat_pcf=$(patsubst %.$(ext),%_$(ext)src.pcf,$(mccabe_files))
|
13 |
mccabe_pcf_files:=$(filter %.pcf,$(foreach ext,$(MCCABE_EXTENSIONS),$(pat_pcf)))
|
14 |
path_mccabe_pcf_files:=$(addprefix $(LOCALTOP)/$(workdir)/,$(mccabe_pcf_files))
|
15 |
mccabe_pcf_files:=$(notdir $(mccabe_pcf_files))
|
16 |
ifndef MCCABE_DATA_DIR
|
17 |
MCCABE_DATA_DIR:=$(LOCALTOP)/$(workdir)
|
18 |
endif
|
19 |
|
20 |
#
|
21 |
# Building pcf files
|
22 |
#
|
23 |
|
24 |
# Create a pcf format line for each file in a seperate file
|
25 |
|
26 |
MCCABECPPFLAGS=-DMCCABE
|
27 |
|
28 |
%_ccsrc.pcf: %.cc
|
29 |
@echo $(MCCABE_PARSETAG_cc) $< $(MCCABECPPFLAGS) $(CPPFLAGS) > $@
|
30 |
%_cxxsrc.pcf: %.cxx
|
31 |
@echo $(MCCABE_PARSETAG_cxx) $< $(MCCABECPPFLAGS) $(CPPFLAGS) > $@
|
32 |
%_Csrc.pcf: %.C
|
33 |
@echo $(MCCABE_PARSETAG_C) $< $(MCCABECPPFLAGS) $(CPPFLAGS) > $@
|
34 |
%_cppsrc.pcf: %.cpp
|
35 |
@echo $(MCCABE_PARSETAG_cpp) $< $(MCCABECPPFLAGS) $(CPPFLAGS) > $@
|
36 |
%_csrc.pcf: %.c
|
37 |
@echo $(MCCABE_PARSETAG_c) $< $(MCCABECPPFLAGS) $(CPPFLAGS) > $@
|
38 |
|
39 |
%.i : %.cc
|
40 |
$(PreProcessorCCTool)
|
41 |
|
42 |
pat_pcf=$(patsubst %.$(ext),%_$(ext)src.pcf,$(mccabe_files))
|
43 |
preprocess_files=$(patsubst %.cc, %.i, $(mccabe_files))
|
44 |
|
45 |
ifdef SUBDIRS
|
46 |
.PHONY: preprocess
|
47 |
preprocess:
|
48 |
@for dir in $(SUBDIRS); do \
|
49 |
echo ----------- Generating PreProcessed files in $$dir ---------; \
|
50 |
cd $(LOCALTOP)/$(THISDIR)/$$dir; \
|
51 |
$(TOOL_HOME)/scram build preprocess; \
|
52 |
done
|
53 |
else
|
54 |
preprocess: $(preprocess_files)
|
55 |
endif
|
56 |
|
57 |
#
|
58 |
# Exclude all header files not in this directory
|
59 |
#
|
60 |
|
61 |
ifdef SUBDIRS
|
62 |
.PHONY: myheader.dat
|
63 |
myheader.dat:
|
64 |
@if [ -f myheader.dat ]; then \
|
65 |
rm myheader.dat; \
|
66 |
fi
|
67 |
@for dir in $(SUBDIRS); do \
|
68 |
echo ----------- Collecting Header Data from $$dir ---------; \
|
69 |
cd $(LOCALTOP)/$(THISDIR)/$$dir; \
|
70 |
$(TOOL_HOME)/scram build myheader.dat; \
|
71 |
cat $(LOCALTOP)/$(workdir)/$$dir/myheader.dat >> $(LOCALTOP)/$(workdir)/myheader.dat; \
|
72 |
done
|
73 |
else
|
74 |
mccabe_headers+=$(wildcard $(LOCALTOP)/$(THISDIR)/*.h) $(wildcard $(LOCALTOP)/$(THISDIR)/*.icc)
|
75 |
myheader.dat: $(files) $(mccabe_headers)
|
76 |
-@ls $(mccabe_headers) > myheader.dat
|
77 |
endif
|
78 |
|
79 |
#
|
80 |
# Get all the combined srcs together into one pcf file
|
81 |
#
|
82 |
|
83 |
ifdef SUBDIRS
|
84 |
.PHONY: src.pcf
|
85 |
srcpcf=$(wildcard */src.pcf)
|
86 |
src.pcf: $(srcpcf)
|
87 |
@if [ -f src.pcf ]; then \
|
88 |
rm src.pcf; \
|
89 |
fi
|
90 |
@for dir in $(SUBDIRS); do \
|
91 |
echo ----------- Collecting Compiler Options from $$dir ---------; \
|
92 |
cd $(LOCALTOP)/$(THISDIR)/$$dir; \
|
93 |
$(TOOL_HOME)/scram build src.pcf; \
|
94 |
cat $(LOCALTOP)/$(workdir)/$$dir/src.pcf >> $(LOCALTOP)/$(workdir)/src.pcf; \
|
95 |
done
|
96 |
else
|
97 |
src.pcf: $(mccabe_pcf_files) myheader.dat
|
98 |
@if [ "$(path_mccabe_pcf_files)" != "" ]; then \
|
99 |
cat $(path_mccabe_pcf_files) > src.pcf; \
|
100 |
fi
|
101 |
endif
|
102 |
|
103 |
config.pcf: src.pcf myheader.dat
|
104 |
@echo PROGRAM test > config_tmp.pcf
|
105 |
@echo INSTDIR $(MCCABE_DATA_DIR)/mccabeinstr >> config_tmp.pcf
|
106 |
@echo INSTOUT $(MCCABE_DATA_DIR)/mccabeinstr/inst.out >> config_tmp.pcf
|
107 |
@echo DIR $(LOCALTOP)/$(THISDIR) >> config_tmp.pcf
|
108 |
@cat config_tmp.pcf src.pcf > config.pcf
|
109 |
|
110 |
instplus.cpp: $(mccabe_files) config.pcf
|
111 |
cli export -pcf config.pcf
|
112 |
|
113 |
#mccabe_parse: config.pcf
|
114 |
# cli parse -pcf config.pcf -parse_report $(LOCALTOP)/$(INTlog)/mccabe
|
115 |
|
116 |
mccabe_%: config.pcf
|
117 |
cli $* -pcf config.pcf -parse_report $(LOCALTOP)/$(INTlog)/mccabe $(MCCABE_CLI_OPTIONS)
|
118 |
|
119 |
mccabe_purge:
|
120 |
cli purge -level all
|