source: trunk/config/moc.gmk@ 1169

Last change on this file since 1169 was 1045, checked in by garnier, 17 years ago

maj en aussi sur CVS

File size: 2.3 KB
RevLine 
[1045]1# $Id: moc.gmk,v 1.3 2008/12/03 13:35:36 gcosmo Exp $
[762]2# ----------------------------------------------------------------
3# Common part of GNUmakefile for libraries. John Allison, 5/7/95.
4# ----------------------------------------------------------------
5# Libraries are created according to G4SYSTEM. G.Cosmo, 11/6/96.
6# Introduced G4LIBDIR and G4TMPDIR. G.Cosmo, 23/6/98.
[770]7# Introduced Qt moc rule, L.Garnier 16/2/08.
[762]8
9ifndef G4LIBDIR
10 G4LIBDIR := $(G4LIB)/$(G4SYSTEM)
11endif
12G4TMPDIR := $(G4TMP)/$(G4SYSTEM)/$(name)
13
14ifneq ($(G4INTY_BUILD_QT),)
[1045]15 moc_inc := $(shell ($(GREP) -l "Q_OBJECT" include/*.hh))
[781]16 moc_sources := $(patsubst include/%.hh, moc/%_moc.cc, $(moc_inc))
[780]17 moc_objects := $(patsubst moc/%_moc.cc,$(G4TMPDIR)/%_moc.o,$(moc_sources))
18 moc_dependencies := $(patsubst moc/%_moc.cc,$(G4TMPDIR)/%_moc.d,$(moc_sources))
[762]19endif
20
21
22###############################################################################
23#
24# Actual moc files for Qt files
25#
26# moc sources and headers: used for Qt signal/slot
27# - all headers which use signals/slots have the macro "Q_OBJECT" present
28# in the class definitions; these all need to be processed by the
29# "meta object compiler (moc)" which generates extra source code to
30# implement the signal/slots, i.e., if "foo.h" contains the token "Q_OBJECT"
31# it will be used by moc to generate the file "foo_moc.cpp" (the _moc. is
32# just an arbitrary extension to make it easier to identify sources
33# generated by moc).
34
35
36ifneq ($(G4INTY_BUILD_QT),)
[780]37$(G4TMPDIR)/%_moc.d: moc/%_moc.cc
[777]38 @echo Making dependency for moc file $< ...
39 @if [ ! -d $(G4TMPDIR) ] ; then mkdir -p $(G4TMPDIR) ;fi
40 @set -e;\
41 g++ $(GPPFLAGS) $(CPPFLAGS) -w -xc++ $< |\
42 sed 's!$*\.o!$(G4TMPDIR)/& $@!' >$@;\
43 [ -s $@ ] || rm -f $@
44
45moc/%_moc.cc: include/%.hh
[762]46 @echo Making moc file for $< ...
[777]47 @if [ ! -d moc ] ; then mkdir -p moc ;fi
[1045]48 @if [ `$(QTMOC) -v 2>&1 | $(GREP) "Qt 3" | wc -l ` -gt 0 ]; then \
[762]49 $(QTMOC) -o $@ $<;\
50 else $(QTMOC) $(MOC_MACRO) -o $@ $<; \
51 fi;
52
[781]53# could be better if we not duplicate this rule from common.gmk...
[780]54$(G4TMPDIR)/%_moc.o: moc/%_moc.cc
[777]55 @echo Compiling $*.cc ...
56ifdef CPPVERBOSE
57 @echo Compiling moc file $*.cc ...
58 $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(OUT_OBJ)$(G4TMPDIR)/$(*F)_moc.o moc/$*_moc.cc
59else
[893]60 @$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(OUT_OBJ)$(G4TMPDIR)/$(*F)_moc.o moc/$*_moc.cc
[762]61endif
[1045]62endif
Note: See TracBrowser for help on using the repository browser.