1 | # $Id: common.gmk,v 1.51 2008/04/04 10:35:20 gcosmo Exp $ |
---|
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. |
---|
7 | # Introduced Qt moc rule, L.Garnier 16/2/08. |
---|
8 | |
---|
9 | ifndef G4LIBDIR |
---|
10 | G4LIBDIR := $(G4LIB)/$(G4SYSTEM) |
---|
11 | endif |
---|
12 | G4TMPDIR := $(G4TMP)/$(G4SYSTEM)/$(name) |
---|
13 | |
---|
14 | ifneq ($(G4INTY_BUILD_QT),) |
---|
15 | # moc_inc := $(shell (grep -l "Q_OBJECT" ../OpenGL/include/*.hh)) |
---|
16 | # moc_sources := $(patsubst ../OpenGL/include/%.hh, moc/%_moc.cc, $(moc_inc)) |
---|
17 | # moc_tst := $(shell ls -al $(moc_sources) >/Users/garnier/tst) |
---|
18 | |
---|
19 | moc_dir_name := OpenGL |
---|
20 | moc_inc := $(shell (grep -l "Q_OBJECT" ../$(moc_dir_name)/include/*.hh)) |
---|
21 | moc_sources := $(patsubst ../$(moc_dir_name)/include/%.hh, moc/%_moc.cc, $(moc_inc)) |
---|
22 | moc_objects := $(patsubst moc/%.cc,$(G4TMPDIR)/%.o,$(moc_sources)) |
---|
23 | moc_dependencies := $(patsubst moc/%.cc,$(G4TMPDIR)/%.d,$(moc_sources)) |
---|
24 | endif |
---|
25 | |
---|
26 | |
---|
27 | ############################################################################### |
---|
28 | # |
---|
29 | # Actual moc files for Qt files |
---|
30 | # |
---|
31 | # moc sources and headers: used for Qt signal/slot |
---|
32 | # - all headers which use signals/slots have the macro "Q_OBJECT" present |
---|
33 | # in the class definitions; these all need to be processed by the |
---|
34 | # "meta object compiler (moc)" which generates extra source code to |
---|
35 | # implement the signal/slots, i.e., if "foo.h" contains the token "Q_OBJECT" |
---|
36 | # it will be used by moc to generate the file "foo_moc.cpp" (the _moc. is |
---|
37 | # just an arbitrary extension to make it easier to identify sources |
---|
38 | # generated by moc). |
---|
39 | |
---|
40 | |
---|
41 | ifneq ($(G4INTY_BUILD_QT),) |
---|
42 | $(G4TMPDIR)/%.d: moc/%.cc |
---|
43 | @echo Making dependency for moc file $< ... |
---|
44 | @if [ ! -d $(G4TMPDIR) ] ; then mkdir -p $(G4TMPDIR) ;fi |
---|
45 | @set -e;\ |
---|
46 | g++ $(GPPFLAGS) $(CPPFLAGS) -w -xc++ $< |\ |
---|
47 | sed 's!$*\.o!$(G4TMPDIR)/& $@!' >$@;\ |
---|
48 | [ -s $@ ] || rm -f $@ |
---|
49 | @echo Making dependency for moc file $< ... END |
---|
50 | |
---|
51 | moc/%_moc.cc: include/%.hh |
---|
52 | @echo Making moc file for $< ... |
---|
53 | @if [ ! -d moc ] ; then mkdir -p moc ;fi |
---|
54 | @if [ `$(QTMOC) -v 2>&1 | grep "Qt 3" | wc -l ` -gt 0 ]; then \ |
---|
55 | $(QTMOC) -o $@ $<;\ |
---|
56 | else $(QTMOC) $(MOC_MACRO) -o $@ $<; \ |
---|
57 | fi; |
---|
58 | @echo Making moc file for $< ... END |
---|
59 | |
---|
60 | $(G4TMPDIR)/%.o: moc/%_moc.cc |
---|
61 | @echo Compiling $*.cc ... |
---|
62 | ifdef CPPVERBOSE |
---|
63 | @echo Compiling moc file $*.cc ... |
---|
64 | $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(OUT_OBJ)$(G4TMPDIR)/$(*F)_moc.o moc/$*_moc.cc |
---|
65 | else |
---|
66 | @echo Compiling moc file $*.cc ... |
---|
67 | @$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(OUT_OBJ)$(G4TMPDIR)/$(*F)_moc.o moc/$*_moc.cc |
---|
68 | endif |
---|
69 | endif |
---|