cling/Module.mk
Axel Naumann 842a4520c9 Fix initialization order for "new" binutils that use ctors-in-init-array, by passing -Wl,--no-ctors-in-init-array.
See <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46770>.
This enforces llvm (at the end of the link line) globals to be initialized before ROOT's, pretty healthy for new TInterpreter in gROOT's initializer.


git-svn-id: http://root.cern.ch/svn/root/trunk@46055 27541ba8-7e3a-0410-8455-c3a389f83636
2012-09-19 14:12:07 +00:00

90 lines
2.8 KiB
Makefile

# Module.mk for cling module
# Copyright (c) 2011 Rene Brun and Fons Rademakers
#
# Author: Axel Naumann, 2011-10-18
MODNAME := cling
MODDIR := $(ROOT_SRCDIR)/interpreter/$(MODNAME)
CLINGDIR := $(MODDIR)
##### libCling #####
CLINGS := $(wildcard $(MODDIR)/lib/Interpreter/*.cpp) \
$(wildcard $(MODDIR)/lib/MetaProcessor/*.cpp) \
$(wildcard $(MODDIR)/lib/Utils/*.cpp)
CLINGO := $(call stripsrc,$(CLINGS:.cpp=.o))
CLINGDEP := $(CLINGO:.o=.d)
CLINGETC := $(addprefix etc/cling/Interpreter/,RuntimeUniverse.h ValuePrinter.h ValuePrinterInfo.h) \
$(addprefix etc/cling/cint/,multimap multiset)
# used in the main Makefile
ALLHDRS += $(CLINGETC)
# include all dependency files
INCLUDEFILES += $(CLINGDEP)
# include dir for picking up RuntimeUniverse.h etc - need to
# 1) copy relevant headers to include/
# 2) rely on TCling to addIncludePath instead of using CLING_..._INCL below
CLINGCXXFLAGS = $(patsubst -O%,,$(shell $(LLVMCONFIG) --cxxflags) -I$(CLINGDIR)/include \
-fno-strict-aliasing)
ifeq ($(CTORSINITARRAY),yes)
CLINGLDFLAGSEXTRA := -Wl,--no-ctors-in-init-array
endif
CLINGLIBEXTRA = $(CLINGLDFLAGSEXTRA) -L$(shell $(LLVMCONFIG) --libdir) \
$(addprefix -lclang,\
Frontend Serialization Driver CodeGen Parse Sema Analysis RewriteCore AST Lex Basic Edit) \
$(patsubst -lLLVM%Disassembler,,\
$(filter-out -lLLVMipa,\
$(shell $(LLVMCONFIG) --libs linker jit executionengine debuginfo \
archive bitreader all-targets codegen selectiondag asmprinter \
mcparser scalaropts instcombine transformutils analysis target))) \
$(shell $(LLVMCONFIG) --ldflags)
##### local rules #####
.PHONY: all-$(MODNAME) clean-$(MODNAME) distclean-$(MODNAME)
all-$(MODNAME):
clean-$(MODNAME):
@rm -f $(CLINGO)
clean:: clean-$(MODNAME)
distclean-$(MODNAME): clean-$(MODNAME)
@rm -f $(CLINGDEP) $(CLINGETC)
distclean:: distclean-$(MODNAME)
$(CLINGDIRS)/Module.mk: $(LLVMCONFIG)
etc/cling/%.h: $(CLINGDIR)/include/cling/%.h
+@[ -d $(dir $@) ] || mkdir -p $(dir $@)
@cp $< $@
etc/cling/%.h: $(call stripsrc,$(CLINGDIR)/%.o)/include/cling/%.h
+@[ -d $(dir $@) ] || mkdir -p $(dir $@)
@cp $< $@
etc/cling/cint/multimap: $(CLINGDIR)/include/cling/cint/multimap
+@[ -d $(dir $@) ] || mkdir -p $(dir $@)
@cp $< $@
etc/cling/cint/multiset: $(CLINGDIR)/include/cling/cint/multiset
+@[ -d $(dir $@) ] || mkdir -p $(dir $@)
@cp $< $@
$(CLINGDIR)/%.o: $(CLINGDIR)/%.cpp $(LLVMDEP)
$(MAKEDEP) -R -f$(@:.o=.d) -Y -w 1000 -- $(CXXFLAGS) $(CLINGCXXFLAGS) -D__cplusplus -- $<
$(CXX) $(OPT) $(CLINGCXXFLAGS) $(CXXOUT)$@ -c $<
$(call stripsrc,$(CLINGDIR)/%.o): $(CLINGDIR)/%.cpp $(LLVMDEP)
$(MAKEDIR)
$(MAKEDEP) -R -f$(@:.o=.d) -Y -w 1000 -- $(CXXFLAGS) $(CLINGCXXFLAGS) -D__cplusplus -- $<
$(CXX) $(OPT) $(CLINGCXXFLAGS) $(CXXOUT)$@ -c $<
##### extra rules ######