source: trunk/config/sys/Darwin-g++.gmk @ 868

Last change on this file since 868 was 868, checked in by garnier, 16 years ago

see history

File size: 4.3 KB
Line 
1#
2# ------ MacOS-X ------
3#                                 MacOS 10.3 gcc-3.3
4#                                 MacOS 10.4 gcc-4.0
5#
6# Original author: Helmut Burkhardt - CERN
7#       Revisions: Guy Barrand - LAL
8#                  Gabriele Cosmo - CERN
9#
10ifeq ($(G4SYSTEM),Darwin-g++)
11  CXX       := g++
12  CXXFLAGS  := -Wall -ansi -pedantic -Wno-non-virtual-dtor -Wno-long-long
13  CXXFLAGS  += -Wwrite-strings -Wpointer-arith -Woverloaded-virtual -pipe
14  ifdef G4OPTIMISE
15    CXXFLAGS  += -O2
16    FCFLAGS   := -O2
17    CCFLAGS   := -O2
18  else
19    ifdef G4DEBUG
20      CXXFLAGS  += -g
21      FCFLAGS   := -g
22      CCFLAGS   := -g
23    endif
24  endif
25  ifdef G4PROFILE
26    CXXFLAGS  += -pg
27    FCFLAGS   += -pg
28    CCFLAGS   += -pg
29  endif
30  FC := gfortran
31  FCFLAGS += -fno-automatic -fno-backslash -fno-second-underscore
32  LDFLAGS += -bind_at_load
33  FCLIBS := -lg2c -lnsl
34  SHEXT   := dylib
35  ifndef X11FLAGS
36    X11FLAGS  := -I/usr/include/X11/extensions -I/usr/include/X11
37  endif
38  ifndef X11LIBS
39    X11LIBS   := -L/usr/X11R6/lib  -lXmu -lXt -lXext -lX11 -lXi -lSM -lICE
40  endif
41  ifndef XMFLAGS
42    XMFLAGS   := -I/sw/include
43#   XMFLAGS   := -I/usr/X11R6/include          ##### some installations.
44  endif
45  ifndef XMLIBS
46    XMLIBS    := -L/sw/lib -lXm -lXpm
47#   XMLIBS    := -L/usr/X11R6/lib -lXm -lXpm   ##### some installations.
48  endif
49  ifndef XAWFLAGS
50    XAWFLAGS   := -I/sw/include
51#   XAWFLAGS   := -I/usr/X11R6/include         ##### some installations.
52  endif
53  ifndef XAWLIBS
54    XAWLIBS    := -lXaw
55  endif
56  DLDLIBS   := -ldl
57  ifndef OGLHOME
58    OGLHOME  := /usr/X11R6
59  endif
60  ifndef OGLFLAGS
61    OGLFLAGS  := -I$(OGLHOME)/include
62  endif
63  ifndef OGLLIBS
64    OGLLIBS   := -L$(OGLHOME)/lib -lGLU -lGL
65    ifeq ($(G4SYSTEM),Darwin-g++)
66          # It may be required to uncomment the following lines for building on MacOSX 10.5 "Leopard"
67      OGLLIBS   := $(shell test -f /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib && echo " -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib")
68      endif
69  endif
70  ifndef QTHOME
71    QTHOME   := $(shell test -f /Library/Frameworks/Qt3Support.framework/Qt3Support && echo  "/Library/Frameworks" || echo "/sw")
72  endif
73
74  ifeq ($(QTHOME),/Library/Frameworks)
75    QT_VERSION := $(shell grep "QT_VERSION_STR" $(QTHOME)/QtCore.framework/Headers/qglobal.h | sed 's/.* \"\([0-9]\)\..*\"/\1/')
76  else
77    QT_VERSION := $(shell grep "QT_VERSION_STR" $(QTHOME)/include/qt/qglobal.h | sed 's/.* \"\([0-9]\)\..*\"/\1/')
78  endif
79
80  ifndef QTFLAGS
81    ifeq ($(QT_VERSION),4)
82      QTFLAGS   := -I $(QTHOME)/QtCore.framework/Headers
83      QTFLAGS   += -I $(QTHOME)/QtGui.framework/Headers
84      QTFLAGS   += -I $(QTHOME)/QtOpenGL.framework/Headers
85    else
86      QTFLAGS   := -I $(QTHOME)/include/Qt -I$(QTHOME)/include
87    endif
88  endif
89  ifndef QTMOC
90    ifeq ($(QT_VERSION),4)
91      QTMOC      := /usr/bin/moc
92    else
93      QTMOC      := $(QTHOME)/bin/moc
94    endif
95  endif
96
97  ifndef QTLIBPATH
98    ifeq ($(QT_VERSION),3)
99      QTLIBPATH   := $(shell test -d $(QTHOME)/lib/qt3/lib && echo "/lib/qt3/lib" || echo "/lib" )
100    else
101      QTLIBPATH  := -F$(QTHOME)
102    endif
103  endif
104  ifndef QTLIBS
105    ifeq ($(QT_VERSION),3)
106      QTLIBS   := -L$(QTHOME)$(QTLIBPATH)
107      QT3_MT  := $(shell ls  $(QTHOME)$(QTLIBPATH)/libqt-mt.* | wc -l )
108      ifneq ($(QT3_MT),0)
109        QTLIBS  += -lqt-mt
110      else
111        QTLIBS  += -lqt
112      endif
113      QTLIBS   += -lqui
114    else
115      QTLIBS    :=  -framework QtCore -framework QtGui
116    endif
117  endif
118
119  ifndef GLQTLIBS
120    ifeq ($(QT_VERSION),3)
121        # already done in QTLIBS
122        #      GLQTLIBS    := $(QTLIBS)
123    else
124      GLQTLIBS    := -F$(QTHOME) -framework QtCore -framework QtGui
125      GLQTLIBS    += -framework QtOpenGL
126    endif
127  endif
128
129  define build-granular-shared-lib
130    @libdir=`(cd $(@D);/bin/pwd)`; \
131     cd $(G4TMPDIR); \
132     g++ -dynamiclib -single_module -undefined dynamic_lookup \
133         -o $$libdir/$(@F) $(INTYLIBS) *.o
134  endef
135  define build-global-shared-lib
136    @libdir=`(cd $(@D);/bin/pwd)`; \
137     cd $(G4TMP)/$(G4SYSTEM); \
138     g++ -dynamiclib -single_module -undefined dynamic_lookup \
139         -o $$libdir/$(@F) $(INTYLIBS) $(foreach dir,$(SUBLIBS),$(dir)/*.o);
140  endef
141
142endif
Note: See TracBrowser for help on using the repository browser.