-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathMakefile.lcgdict
119 lines (108 loc) · 6.24 KB
/
Makefile.lcgdict
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
LCGDICT_SUBDIR:=a
AUTO_GENERATED_SOURCES+=$(LCGDICT_SUBDIR)
LCGDICT_FILE_PREFIX = $(1)_
TOP_LEVEL_VARIABLES+=LCGDICT
CXXMODULES_SUPPORT:=$(strip $(root_EX_FLAGS_CXXMODULES))
ifeq ($(CXXMODULES_SUPPORT),1)
-include $(SCRAM_CONFIGDIR)/SCRAM/GMake/Makefile.cxxmodule
else
CXXMODULES_SUPPORT:=0
endif
define compile_lcgdict
$(startlog_$(2)) [ -d $(@D) ] || $(CMD_mkdir) -p $(@D) &&\
$(CMD_echo) ">> Compiling LCG dictionary: $<" &&\
$(VERB_ECHO) $(call GetCXX,$1) $(CXX_MMD) $(CXX_MF) $(1)/$(patsubst $($(1)_objdir)/%,%,$(basename $@).d) $(COMPILE_OPTIONS) -I$(LOCALTOP) $(call AdjustFlags,$1,LCGDICT,CPPFLAGS CXXFLAGS) $(CXXOPTIMISEDFLAGS) $(CXXSHAREDOBJECTFLAGS) $(1)/$(patsubst $($(1)_objdir)/%,%,$<) -o $(1)/$(patsubst $($(1)_objdir)/%,%,$@) &&\
(($(CMD_cd) $($(1)_objdir)/..; $(call GetCXX,$1) $(CXX_MMD) $(CXX_MF) $(1)/$(patsubst $($(1)_objdir)/%,%,$(basename $@).d) $(COMPILE_OPTIONS) -I$(LOCALTOP) $(call AdjustFlags,$1,LCGDICT,CPPFLAGS CXXFLAGS) $(CXXOPTIMISEDFLAGS) $(CXXSHAREDOBJECTFLAGS) $(1)/$(patsubst $($(1)_objdir)/%,%,$<) -o $(1)/$(patsubst $($(1)_objdir)/%,%,$@)) || ($(CMD_touch) -t $(OLD_TIMESTAMP) $< && exit 1)) $(endlog_$(2))
@$(startlog_$(2))$(call processTmpMMDData,$(1)/$(patsubst $($(1)_objdir)/%,%,$<),$(1)/$(patsubst $($(1)_objdir)/%,%,$@),$3)$(endlog_$(2))
endef
#LCG dictionary generation
define generate_classes_h
$(startlog_$(2))[ -d $(@D) ] || $(CMD_mkdir) -p $(@D) && $(CMD_rm) -f $@ &&\
$(CMD_echo) ">> Generating LCG reflex dict header file $(patsubst $(LOCALTOP)/$(SCRAM_SOURCEDIR)/%,%,$<)" &&\
$(VERB_ECHO) $(CLASSES_H_GENERATOR) $< &&\
( $(CLASSES_H_GENERATOR) $< > $@ || ($(CMD_rm) -f $@ && exit 1)) \
$(endlog_$(2))
endef
define generate_lcgdict_cxxmodule0
$(startlog_$(2))[ -d $(@D) ] || $(CMD_mkdir) -p $(@D) && $(CMD_rm) -f $@ &&\
$(CMD_echo) ">> Building LCG reflex dict from header file $(patsubst $(LOCALTOP)/%,%,$4)" &&\
$(VERB_ECHO) $(ROOTRFLX_BASE)/bin/genreflex $(4) -s $(3) -o $@ $(subst -failOnWarnings,--fail_on_warnings,$($(5)_GENREFLEX_ARGS)) --rootmap=$(basename $@).rootmap --rootmap-lib=$(MODULE_PREFIX)$(1).$(SHAREDSUFFIX) $(call Tool_DependencyPCMS,$1) $(GENREFLEX_CPPFLAGS) $(call AdjustFlags,$1,LCGDICT,CPPFLAGS) &&\
(($(SCRAM_GENREFLEX_PREFIX) $(ROOTRFLX_BASE)/bin/genreflex $(4) -s $(3) -o $@ $(subst -failOnWarnings,--fail_on_warnings,$($(5)_GENREFLEX_ARGS)) --rootmap=$(basename $@).rootmap --rootmap-lib=$(MODULE_PREFIX)$(1).$(SHAREDSUFFIX) $(call Tool_DependencyPCMS,$1) $(GENREFLEX_CPPFLAGS) $(call AdjustFlags,$1,LCGDICT,CPPFLAGS) &&\
$(CMD_touch) -r $@ $(basename $@).rootmap $(basename $@)*.pcm && $(CMD_mv) $(basename $@)*.pcm $(6)/) || ($(CMD_rm) -f $@ && exit 1)) \
$(endlog_$(2))
endef
define pcm_build_rules0
$(1)_pcm_name:=$(2)r_rdict.pcm
$(1)_ROOTMAP_FILES += $($(1)_objdir)/$(6)/$(2)r.rootmap
$(1)_libdeps += $($(1)_objdir)/$(6)/$(2)r.rootmap
$($(1)_objdir)/$(6)/$(2)r.rootmap: $($(1)_objdir)/$(6)/$(2)r.cc
@$(CMD_echo) "01:$(CMD_rm) -f $(7)/$(2)r.rootmap $(WORKINGDIR)/rootpcms/$(1)" > $$(call AutoCleanFile,$$<,lcgdict)
@[ -f $$< ] || $(CMD_rm) -f $$@
endef
pcm_header_rules0=
#safename,hfiles,defxmlfiles,prodstore,genreflexargs
define LCGDict
ifneq ($(strip $($(1)_CXXMODULES)),1)
$(1)_CXXMODULES:=0
else ifeq ($(strip $(CXXMODULES_SUPPORT)),0)
$(1)_CXXMODULES:=0
endif
$$(eval $$(call LCGDictHeaders,$1,$2,$3,$5))
$(1)_CLASSES_DEF_XML:=$3
$$(eval $$(call AddLCGDictRule,$(1),$$($1_lcg_header),$$($1_lcg_def_xml),$(1),a,$(4),$($(1)_LCGDICTS)))
ALL_CLASS_VERSION_RULES += $($(1)_objdir)/updateclassversion
$(WORKINGDIR)/rootpcms/$1: $(foreach x,$($1_LCGDICTS),$(WORKINGDIR)/rootpcms/$1_$(x))
@$(CMD_touch) $$@
ifneq ($(strip $(UPDATE_CLASSVERSION)),)
all_$(1) += $($(1)_objdir)/updateclassversion
$($(1)_objdir)/updateclassversion: $($(1)_objdir)/$(MODULE_PREFIX)$(1).$(SHAREDSUFFIX)
@$(CMD_touch) $$@
endif
endef
##safename,hfiles,defxmlfiles,genreflexargs
define LCGDictHeaders
$(1)_prodsrc += $(patsubst src/%,%,$2 $3)
$(1)_GENREFLEX_ARGS := $(filter-out $($(1)_LOC_FLAGS_REM_GENREFLEX_ARGS),$(4))
$1_lcg_header:=$2
$1_lcg_def_xml:=$3
$$(eval $$(call pcm_header_rules$($(1)_CXXMODULES),$1,$2,$3))
endef
#safename,headers,xmls,name,prefix,prodstore,dict_prefix
define AddLCGDictRule
$$(if $(2),$$(eval $$(call LCGDictRule,$(1),$(LCGDICT_FILE_PREFIX)$(firstword $(7)),$(firstword $(2)),$(firstword $(3)),$(4),$(5),$(6)))$$(eval $$(call AddLCGDictRule,$(1),$(wordlist 2,100,$(2)),$(wordlist 2,100,$(3)),$(4),$(5),$(6),$(wordlist 2,100,$(7)))),)
endef
define LCG_ExtraRules
$(WORKINGDIR)/rootpcms/$(1): $(foreach l,$($(1)_EX_USE) $($(1)_EX_FLAGS_USE_SOURCE_ONLY),$(if $(strip $($l)),$(WORKINGDIR)/rootpcms/$($l)))
@[ -d $$(@D) ] || $(CMD_mkdir) -p $$(@D) && $(CMD_touch) $$@
endef
define VectorizePCM
all_$(1)+=$4/$2/$3
$4/$2/$3: $4/$3
@[ -d $$(@D) ] || $(CMD_mkdir) -p $$(@D) && $(CMD_ln) -sf ../$$(@F) $$@
endef
define LCGDictRule
$(1)_LOC_USE += $(LCGDICT_DEPS)
$(1)_files := $($(1)_objdir)/$(6)/$(2)r.cc $($(1)_files)
$(1)_objs := $($(1)_objdir)/$(6)/$(2)r.cc.$(OBJEXT) $($(1)_objs)
$(1)_extra_files += $($(1)_objdir)/$(6)/$(2)r.cc
$(2)r_header:=$3
$$(eval $$(call pcm_build_rules$($(1)_CXXMODULES),$1,$2,$3,$4,$5,$6,$7))
$(1)_ROOTPCMS += $(7)/$$($(1)_pcm_name)
all_$(1) += $(7)/$$($(1)_pcm_name)
ALL_PCMS += $(7)/$$($(1)_pcm_name)
$$(eval $$(call AddBigObjLCGDICTRule,$1,$(6)/$(2),$(7),$$($(1)_pcm_name)))
$($(1)_objdir)/$(6)/$(2)r.cc: $(4) $$($(2)r_header) $($(1)_config) $(foreach l,$($(1)_LOC_USE) $($(1)_LOC_FLAGS_USE_SOURCE_ONLY),$(if $(strip $($l)),$(WORKINGDIR)/rootpcms/$($l)))
@$$(call generate_lcgdict_cxxmodule$($(1)_CXXMODULES),$(1),$(1),$(4),$$($(2)r_header),$(5),$7)
@$(CMD_echo) "01:$(CMD_rm) -f $(7)/$$($(1)_pcm_name) $(WORKINGDIR)/rootpcms/$(1)" > $$(call AutoCleanFile,$$@,lcgdict)
$($(1)_objdir)/$(6)/$(2)r.cc.$(OBJEXT): $($(1)_objdir)/$(6)/$(2)r.cc
@$$(call compile_lcgdict,$(1),$(1),$3)
$(7)/$$($(1)_pcm_name): $($(1)_objdir)/$(6)/$(2)r.cc
@[ -f $$< ] || $(CMD_rm) -f $$@
$(WORKINGDIR)/rootpcms/$(2): $(7)/$$($(1)_pcm_name)
@[ -d $$(@D) ] || $(CMD_mkdir) -p $$(@D) && $(CMD_touch) $$@
$$(foreach v,$($(1)_LOC_FLAGS_VECTORIZE),$$(eval $$(call VectorizePCM,$1,$$v,$$($(1)_pcm_name),$7)))
endef
$(WORKINGDIR)/classes/%:
@[ -d $(@D) ] || $(CMD_mkdir) -p $(@D) && $(CMD_touch) $@
$(WORKINGDIR)/rootpcms/%:
@[ -d $(@D) ] || $(CMD_mkdir) -p $(@D) && $(CMD_touch) $@