| 1 | #
|
|---|
| 2 | # ------ GNU/LINUX ------ gcc 3.2 and higher
|
|---|
| 3 | #
|
|---|
| 4 | ifeq ($(G4SYSTEM),Linux-g++)
|
|---|
| 5 | CXX := g++
|
|---|
| 6 | CXXFLAGS := -W -Wall -ansi -pedantic -Wno-non-virtual-dtor -Wno-long-long
|
|---|
| 7 | CXXFLAGS += -Wwrite-strings -Wpointer-arith -Woverloaded-virtual -pipe
|
|---|
| 8 | #
|
|---|
| 9 | # Uncomment the following options to activate Pentium4 chip specific
|
|---|
| 10 | # floating-point operations on the SSE unit. It will allow for more stable
|
|---|
| 11 | # results (no output differences between debug/optimised runs) and little
|
|---|
| 12 | # performance improvement (in the order of 2%).
|
|---|
| 13 | # NOTE: binaries built using these options will NOT be portable cross
|
|---|
| 14 | # platforms. Will only run on Pentium4-based architectures !
|
|---|
| 15 | #
|
|---|
| 16 | # CXXFLAGS += -march=pentium4 -mfpmath=sse
|
|---|
| 17 | ifdef G4OPTIMISE
|
|---|
| 18 | CXXFLAGS += -O2
|
|---|
| 19 | FCFLAGS := -O2
|
|---|
| 20 | CCFLAGS := -O2
|
|---|
| 21 | else
|
|---|
| 22 | ifdef G4DEBUG
|
|---|
| 23 | CXXFLAGS += -g
|
|---|
| 24 | FCFLAGS := -g
|
|---|
| 25 | CCFLAGS := -g
|
|---|
| 26 | endif
|
|---|
| 27 | endif
|
|---|
| 28 | ifdef G4PROFILE
|
|---|
| 29 | CXXFLAGS += -pg
|
|---|
| 30 | FCFLAGS += -pg
|
|---|
| 31 | CCFLAGS += -pg
|
|---|
| 32 | endif
|
|---|
| 33 | ifdef G4OPTDEBUG
|
|---|
| 34 | CXXFLAGS += -O2 -g
|
|---|
| 35 | FCFLAGS += -O2 -g
|
|---|
| 36 | CCFLAGS += -O2 -g
|
|---|
| 37 | endif
|
|---|
| 38 | ifdef G4LIB_BUILD_SHARED
|
|---|
| 39 | CXXFLAGS += -fPIC
|
|---|
| 40 | FCFLAGS += -fPIC
|
|---|
| 41 | CCFLAGS += -fPIC
|
|---|
| 42 | endif
|
|---|
| 43 | G4RUNPATHOPTION := -Wl,-rpath
|
|---|
| 44 | CC := gcc
|
|---|
| 45 | FC := gfortran
|
|---|
| 46 | FCFLAGS += -fno-automatic -fno-backslash -fno-second-underscore
|
|---|
| 47 | FCLIBS := -lg2c -lnsl
|
|---|
| 48 | ECHO := /bin/echo -e
|
|---|
| 49 | SHEXT := so
|
|---|
| 50 | ARCH := $(shell uname -m | cut -s -d "_" -f 2)
|
|---|
| 51 |
|
|---|
| 52 | ifndef X11FLAGS
|
|---|
| 53 | X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
|
|---|
| 54 | endif
|
|---|
| 55 | ifndef X11LIBS
|
|---|
| 56 | X11LIBS := -L/usr/X11R6/lib$(ARCH) -lXmu -lXt -lXext -lX11 -lXi -lSM -lICE
|
|---|
| 57 | endif
|
|---|
| 58 | ifndef XMFLAGS
|
|---|
| 59 | XMFLAGS := -I/usr/X11R6/include
|
|---|
| 60 | endif
|
|---|
| 61 | ifndef XMLIBS
|
|---|
| 62 | XMLIBS := -lXm -lXpm
|
|---|
| 63 | endif
|
|---|
| 64 | DLDLIBS := -ldl
|
|---|
| 65 | ifndef OGLFLAGS
|
|---|
| 66 | OGLFLAGS := -I$(OGLHOME)/include
|
|---|
| 67 | endif
|
|---|
| 68 | ifndef OGLLIBS
|
|---|
| 69 | OGLLIBS := -L$(OGLHOME)/lib$(ARCH) -lGLU -lGL
|
|---|
| 70 | endif
|
|---|
| 71 |
|
|---|
| 72 | # ---- QT Setup block -------------------------------------------------------
|
|---|
| 73 | ifndef QTHOME
|
|---|
| 74 | QTHOME := /usr
|
|---|
| 75 | endif
|
|---|
| 76 | ifndef QTMOC
|
|---|
| 77 | QTMOC := $(QTHOME)/bin/moc
|
|---|
| 78 | endif
|
|---|
| 79 |
|
|---|
| 80 | QT_VERSION := $(shell $(QTMOC) 2>&1 -v | sed 's/.* .Qt \([0-9]\)\..*/\1/' )
|
|---|
| 81 |
|
|---|
| 82 | ifndef QTFLAGS
|
|---|
| 83 | ifeq ($(QT_VERSION),4)
|
|---|
| 84 | QTFLAGS += -I$(QTHOME)/include
|
|---|
| 85 | QTFLAGS += -I $(QTHOME)/include/QtCore
|
|---|
| 86 | QTFLAGS += -I $(QTHOME)/include/QtGui
|
|---|
| 87 | QTFLAGS += -I $(QTHOME)/include/QtOpenGL
|
|---|
| 88 | else
|
|---|
| 89 | QTFLAGS := -I$(QTHOME)/include/Qt -I$(QTHOME)/include
|
|---|
| 90 |
|
|---|
| 91 | # If Qt is not located in the STANDARD path, try to find it in some
|
|---|
| 92 | # other places.(Ex: for ubuntu 8.10)
|
|---|
| 93 | QT_ALT1 := $(shell ls $(QTHOME)/include/qt$(QT_VERSION)/*.h 2>/dev/null | wc -l )
|
|---|
| 94 | QT_ALT2 := $(shell ls $(QTHOME)/include/qt$(QT_VERSION)/Qt/*.h 2>/dev/null | wc -l )
|
|---|
| 95 | ifneq ($(QT_ALT1),0)
|
|---|
| 96 | QTFLAGS := -I$(QTHOME)/include/qt$(QT_VERSION)
|
|---|
| 97 | endif
|
|---|
| 98 | ifneq ($(QT_ALT2),0)
|
|---|
| 99 | QTFLAGS := -I$(QTHOME)/include/qt$(QT_VERSION)/Qt
|
|---|
| 100 | endif
|
|---|
| 101 | endif
|
|---|
| 102 | endif
|
|---|
| 103 | ifndef QTLIBPATH
|
|---|
| 104 | QT_SEARCH_LIB1 := $(shell ls $(QTHOME)/lib/qt$(QT_VERSION)/libq* 2>/dev/null | wc -l )
|
|---|
| 105 | QT_SEARCH_LIB2 := $(shell ls $(QTHOME)/lib/libq* 2>/dev/null | wc -l )
|
|---|
| 106 | ifneq ($(QT_SEARCH_LIB1),0)
|
|---|
| 107 | QTLIBPATH := $(QTHOME)/lib/qt$(QT_VERSION)
|
|---|
| 108 | endif
|
|---|
| 109 | ifneq ($(QT_SEARCH_LIB2),0)
|
|---|
| 110 | QTLIBPATH := $(QTHOME)/lib
|
|---|
| 111 | endif
|
|---|
| 112 | endif
|
|---|
| 113 | ifndef QTLIBS
|
|---|
| 114 | QTLIBS := -L$(QTLIBPATH)
|
|---|
| 115 | ifeq ($(QT_VERSION),3)
|
|---|
| 116 | QT3_MT := $(shell ls $(QTLIBPATH)/libqt-mt.* 2>/dev/null | wc -l )
|
|---|
| 117 | ifneq ($(QT3_MT),0)
|
|---|
| 118 | QTLIBS += -lqt-mt
|
|---|
| 119 | else
|
|---|
| 120 | QTLIBS += -lqt
|
|---|
| 121 | endif
|
|---|
| 122 | QTLIBS += -lqui
|
|---|
| 123 | else
|
|---|
| 124 | QTLIBS += -lQtCore -lQtGui
|
|---|
| 125 | endif
|
|---|
| 126 | endif
|
|---|
| 127 | ifndef GLQTLIBS
|
|---|
| 128 | ifeq ($(QT_VERSION),3)
|
|---|
| 129 | # already done in QTLIBS
|
|---|
| 130 | # GLQTLIBS := $(QTLIBS)
|
|---|
| 131 | else
|
|---|
| 132 | GLQTLIBS := -L$(QTLIBPATH) -lQtCore -lQtGui -lQtOpenGL
|
|---|
| 133 | endif
|
|---|
| 134 | endif
|
|---|
| 135 | #----------------------------------------------------------------------------
|
|---|
| 136 |
|
|---|
| 137 | define build-granular-shared-lib
|
|---|
| 138 | @libdir=`(cd $(@D);/bin/pwd)`; \
|
|---|
| 139 | cd $(G4TMPDIR); \
|
|---|
| 140 | $(CXX) -Wl,-soname,$(@F) -shared -o $$libdir/$(@F) $(INTYLIBS) *.o
|
|---|
| 141 | endef
|
|---|
| 142 | define build-global-shared-lib
|
|---|
| 143 | @libdir=`(cd $(@D);/bin/pwd)`; \
|
|---|
| 144 | cd $(G4TMP)/$(G4SYSTEM); \
|
|---|
| 145 | $(CXX) -Wl,-soname,$(@F) -shared -o $$libdir/$(@F) $(INTYLIBS) \
|
|---|
| 146 | $(foreach dir,$(SUBLIBS),$(dir)/*.o);
|
|---|
| 147 | endef
|
|---|
| 148 |
|
|---|
| 149 | endif
|
|---|