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

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

change and better Leopard check on Mac OSX

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