Warning, /geant4/config/moc.gmk is written in an unsupported language. File is not indexed.
0001 # ----------------------------------------------------------------
0002 # Common part of GNUmakefile for libraries. John Allison, 5/7/95.
0003 # ----------------------------------------------------------------
0004 # Libraries are created according to G4SYSTEM. G.Cosmo, 11/6/96.
0005 # Introduced G4LIBDIR and G4TMPDIR. G.Cosmo, 23/6/98.
0006 # Introduced Qt moc rule, L.Garnier 16/2/08.
0007
0008 ifndef G4LIBDIR
0009 G4LIBDIR := $(G4LIB)/$(G4SYSTEM)
0010 endif
0011 G4TMPDIR := $(G4TMP)/$(G4SYSTEM)/$(name)
0012
0013 ifneq ($(G4INTY_BUILD_QT),)
0014 moc_inc := $(shell ($(GREP) -l "Q_OBJECT" include/*.hh))
0015 moc_sources := $(patsubst include/%.hh, moc/%_moc.cc, $(moc_inc))
0016 moc_objects := $(patsubst moc/%_moc.cc,$(G4TMPDIR)/%_moc.o,$(moc_sources))
0017 moc_dependencies := $(patsubst moc/%_moc.cc,$(G4TMPDIR)/%_moc.d,$(moc_sources))
0018 endif
0019
0020
0021 ###############################################################################
0022 #
0023 # Actual moc files for Qt files
0024 #
0025 # moc sources and headers: used for Qt signal/slot
0026 # - all headers which use signals/slots have the macro "Q_OBJECT" present
0027 # in the class definitions; these all need to be processed by the
0028 # "meta object compiler (moc)" which generates extra source code to
0029 # implement the signal/slots, i.e., if "foo.h" contains the token "Q_OBJECT"
0030 # it will be used by moc to generate the file "foo_moc.cpp" (the _moc. is
0031 # just an arbitrary extension to make it easier to identify sources
0032 # generated by moc).
0033
0034
0035 ifneq ($(G4INTY_BUILD_QT),)
0036 $(G4TMPDIR)/%_moc.d: moc/%_moc.cc
0037 @echo Making dependency for moc file $< ...
0038 @if [ ! -d $(G4TMPDIR) ] ; then mkdir -p $(G4TMPDIR) ;fi
0039 @set -e;\
0040 g++ $(GPPFLAGS) $(CPPFLAGS) -w -xc++ $< |\
0041 sed 's!$*\.o!$(G4TMPDIR)/& $@!' >$@;\
0042 [ -s $@ ] || rm -f $@
0043
0044 moc/%_moc.cc: include/%.hh
0045 @echo Making moc file for $< ...
0046 @if [ ! -d moc ] ; then mkdir -p moc ;fi
0047 @if [ `$(QTMOC) -v 2>&1 | $(GREP) "Qt 3" | wc -l ` -gt 0 ]; then \
0048 $(QTMOC) -o $@ $<;\
0049 else $(QTMOC) $(MOC_MACRO) -o $@ $<; \
0050 fi;
0051
0052 # could be better if we not duplicate this rule from common.gmk...
0053 $(G4TMPDIR)/%_moc.o: moc/%_moc.cc
0054 @echo Compiling $*.cc ...
0055 ifdef CPPVERBOSE
0056 @echo Compiling moc file $*.cc ...
0057 $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(OUT_OBJ)$(G4TMPDIR)/$(*F)_moc.o moc/$*_moc.cc
0058 else
0059 @$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(OUT_OBJ)$(G4TMPDIR)/$(*F)_moc.o moc/$*_moc.cc
0060 endif
0061 endif