Import Geant4 0.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:09:25 +02:00
parent b97f8d0df7
commit aaa409b6ee
2922 changed files with 55107 additions and 81674 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
# $Id: G4ODBMS_BUILD.gmk,v 2.1 1998/07/09 13:00:42 morita Exp $
# $Id: G4ODBMS_BUILD.gmk,v 1.1 1999/01/07 15:58:31 gunter Exp $
# ----------------------------------------------------------------
# GNUmakefile for CPPFLAGS for HepODBMS and Objectivity/DB.
# Youhei Morita, 9th July 1998.
+1 -1
View File
@@ -1,4 +1,4 @@
# $Id: G4UI_BUILD.gmk,v 2.7 1998/10/23 15:14:36 barrand Exp $
# $Id: G4UI_BUILD.gmk,v 1.1 1999/01/07 15:58:31 gunter Exp $
# -------------------------------------------------------------
# Interfaces-specific CPPFLAGS for BUILD phase.
# John Allison, 6th July 1998.
+1 -1
View File
@@ -1,4 +1,4 @@
# $Id: G4UI_USE.gmk,v 2.7 1998/08/26 11:05:37 allison Exp $
# $Id: G4UI_USE.gmk,v 1.1 1999/01/07 15:58:31 gunter Exp $
# -------------------------------------------------------------
# GNUmakefile for CPPFLAGS for interfaces USE phase.
# John Allison, 6th July 1998.
+1 -7
View File
@@ -1,4 +1,4 @@
# $Id: G4VIS_BUILD.gmk,v 1.2 1998/07/07 15:10:33 allison Exp $
# $Id: G4VIS_BUILD.gmk,v 1.2 1999/06/19 15:20:38 johna Exp $
# -------------------------------------------------------------
# Visualization-specific CPPFLAGS for BUILD phase.
# John Allison, 24th January 1998.
@@ -62,12 +62,6 @@ ifdef G4VIS_BUILD_OI_DRIVER
CPPFLAGS += -DG4VIS_BUILD_OI_DRIVER
endif
ifdef G4VIS_BUILD_RAYX_DRIVER
G4VIS_BUILD = 1
INC_X11 = 1
CPPFLAGS += -DG4VIS_BUILD_RAYX_DRIVER
endif
# For VRML and VRMLFILE drivers
ifdef G4VIS_BUILD_VRML_DRIVER
G4VIS_BUILD = 1
+1 -10
View File
@@ -1,4 +1,4 @@
# $Id: G4VIS_USE.gmk,v 1.7 1998/12/07 03:48:44 stanaka Exp $
# $Id: G4VIS_USE.gmk,v 1.2 1999/06/19 15:20:40 johna Exp $
# -------------------------------------------------------------
# GNUmakefile for CPPFLAGS for visualization USE phase.
# John Allison, 24th January 1998.
@@ -70,15 +70,6 @@ ifdef G4VIS_USE_OI
LOAD_IV = 1
endif
ifdef G4VIS_USE_RAYX
G4VIS_USE = 1
CPPFLAGS += -DG4VIS_USE_RAYX
CPPFLAGS += -I$(G4BASE)/visualization/G4Ray/include
VISLIBS += -lG4Ray
INC_X11 = 1
LOAD_X11 = 1
endif
ifdef G4VIS_USE_VRML
G4VIS_USE_VRML_OR_VRMLFILE = 1
CPPFLAGS += -DG4VIS_USE_VRML
+172 -2
View File
@@ -1,5 +1,5 @@
$Id: History,v 2.65 1998/12/15 19:29:12 gcosmo Exp $
$Name: geant4-00 $
$Id: History,v 1.50 1999/07/06 17:54:47 johna Exp $
$Name: geant4-00-01 $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,176 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
6th July 1999 John Allison (config-01-00-10)
- Changed -L/usr/X11/lib to -L/usr/X11R6/lib for Linux.
6th July 1999 Gunter Folger (config-01-00-09)
- Adapt architecture.gmk for use of STL with WIN32-VC
Remove NICE from G4SYSTEM name WIN32-VC in architecture, globlib and
binmake.gmk
3rd July 1999 John Allison (config-01-00-08a)
- Added full-stop after i.e in binmake.gmk.
2nd July 1999 John Allison (config-01-00-08)
- Protected liblist against duplicate library names.
29th June 1999 Gabriele Cosmo (config-01-00-07)
- architecture.gmk: fixed bug in SUN-CC setup concerning XMLIBS and XMFLAGS.
-lXm was missing.
25th June 1999 Gabriele Cosmo
- Use $G4LIB/$G4SYSTEM instead of $G4LIBDIR in binmake.gmk for invoking
liblist and search for libname.map (granular libraries setup).
24th June 1999 John Allison
- Use liblist and libname.map in $G4LIBDIR.
19th June 1999 John Allison
- Removed references to G4Ray in G4VIS_BUILD.gmk and G4VIS_USE.gmk.
9th June 1999 Gunter Folger
- Adapt liblist.c for Windows, all changes contained withing #ifdef WIN32 blocks.
4th June 1999 John Allison
- Corrected USER_DEFINED_LDLIBS action.
- Changed `export G4TMP=$(G4TMP);' to `G4TMP=$(G4TMP); export G4TMP;'
- Added -I$(G4BASE)/geometry/solids/Boolean/include.
- Introduced LDLIBS_PREFINAL (Gunter).
2nd June 1999 John Allison
- Changed more occurrences of := to = to fix crash of liblist at startup.
1st June 1999 John Allison
- Changed LDLIBS2 := to LDLIBS2 = in binmake.gmk.
- Reverted $(G4WORKDIR)/tmp/$(G4SYSTEM)/$(G4TARGET) to $(G4TMPDIR).
- Added /$(G4TARGET) to liblist -d $(G4WORKDIR)/tmp/$(G4SYSTEM) in binmake.gmk.
31st May 1999 John Allison
- Added -I$(G4BASE)/processes/electromagnetic/lowenergy/include.
27th May 1999 Gabriele Cosmo (config-01-00-06)
- architecture.gmk: set default $G4INSTALL path to $HOME/geant4 (was still referring
to geant4beta...).
- Restored default CLHEP_BASE_DIR to /afs/cern.ch/sw/geant4/dev/CLHEP/$G4SYSTEM/pro.
- architecture.gmk: added -DG4NOT_ISO_DELETES for NT setup (G.Folger).
25th May 1999 Gabriele Cosmo
- architecture.gmk: fixed bug in SUN-CC setup. Replaced VISLIBS with LOADLIBS to
specify inclusion of socket libraries -lsocket -lnsl.
- binmake.gmk: fixed path to libname.map in the definition of LDLIBS2 for the
granular libs setup.
19th May 1999 John Allison
- Force linking of static library, libCLHEP.a.
18th May 1999 John Allison
- Specify -DG4NOT_ISO_DELETES in any case (not just G4USE_STL) and only
for HP, Sun and AIX.
17th May 1999 Gabriele Cosmo
- Added -DG4NOT_ISO_DELETES for DEC and AIX and moved inside G4USE_STL or
G4USE_OSPACE scope for all platforms which need it.
- Added path to wrappers for AIX.
17th May 1999 John Allison
- Added -DG4NOT_ISO_DELETES for Sun and HP.
- Changed order of -I$(OSPACEDIR)/ospace/std and -I$(OSPACEDIR)/ospace/stl.
13th May 1999 Gabriele Cosmo (config-01-00-05)
- architecture.gmk: G4USE_OSPACE setup is now independent from G4USE_STL which
is now devoted for generic STL setup. Added -DOS_NO_TYPEDEF_5 option to HP-aCC
for ObjectSpace.
12th May 1999 Gabriele Cosmo
- architecture.gmk: modified path to STL wrapper files directory to point to
$RWINC/wrappers/$G4SYSTEM. Wrappers are now differenciated according to
the architecture type.
11th May 1999 Gabriele Cosmo
- architecture.gmk: merged Isidro's OSPACE setup for HP-aCC.
Reorganised OSPACE options by introducing OSPACEINC variable.
10th May 1999 Guy Barrand
- interactivity.gmk ; put OpenGL things after OPACS things to have
correct link order.
10th May 1999 John Allison
- Added -I$(OSPACEDIR)/ospace/stl for Sun.
7th May 1999 John Allison
- Added GREP := grep except for SUN.
- Introduced STLInterface/wrappers directory. Testing on OSF+ObjectSpace (G.Cosmo).
6th May 1999 Gabriele Cosmo
- Introduced G4USE_OSPACE for ObjectSpace STL. If defined G4USE_STL is
set as well. Modified architecture.gmk and binmake.gmk.
6th May 1999 John Allison
- Removed extra library for circular dependencies. Now all solved!
5th May 1999 Gabriele Cosmo
- Fixed typo in architecture.gmk and defined OSPACEDIR to point to the G4
dev area where links to the ObjectSpace installations at CERN have been
created for all platforms. "pro" version points to ObjectSpace 2.1.
5th May 1999 John Allison
- Eliminated all references to RW in the case of G4USE_STL.
- Added OSPACE variables.
28th April 1999 Gabriele Cosmo (config-01-00-04)
- architecture.gmk: moved link for CLHEP to "new" to test the new version
1.4 of CLHEP. It will become "pro" again as soon as the new CLHEP will be
validated. NOTE: for DEC-cxx a custom CLHEP installation is used in order
to deactivate the ISO-ANSI options now set by default in CLHEP.
19th April 1999 Gabriele Cosmo (config-01-00-03)
- architecture.gmk: introduced CCFLAGS for all platforms. Set CCFLAGS to
"-Ae +DAportable" for HP-aCC to overcome compilation problems on liblist.c
18th April 1999 Youhei Morita
- architecture.gmk, binmake.gmk: introduced OBJY_LDLIB variable for
defining Objectivity library within G4ODBMS.
13th April 1999 Gabriele Cosmo
- architecture.gmk: added the following options in compilation:
o HP-aCC, SGI-CC: +Onolimit, -Olimit 5000 respectively.
Not suppress any optimization specifying a high or unlimited memory
limitation.
o DEC-cxx: -timplicit_local.
Get rid of the template repository by generating explicit template
instantiations used in the code with internal linkage.
13th April 1999 John Allison
- In binmake.gmk: - moved libmap target to source/GNUmakefile.
- extensive tidying.
12th April 1999 John Allison
- In liblist.c: - fixed bug to distinguish, e.g., track from tracking.
- improved printing.
- improved "Usage" comments.
- improved protection against bad input format.
- In binmake.gmk, used $(ECHO) to solve platform dependency of echo.
- In binmake.gmk for granular libraries:
- fully implemented -d option.
- Gave /tmp files a unique name.
- Removed repeated libraries - no longer necessary, all circular
dependencies seem solved.
9th April 1999 Frank Behner
- Fixed bug in liblist in -d option
- Changed binmake.gmk to use liblist -d
18th February 1999 John Allison
- Added G4USE_STL flag.
- Added code for linking granular libraries.
1st January 1999 Gunter Folger (config-01-00-02)
- Add FCLIBS for SUN.
January 29th 1999 - John Allison (config-01-00-01)
- Changed rd44 to sw/geant4.
December 15th, 1998 - G.Cosmo (config-00-04-11)
- Added G4_HAVE_BOOL to DEC-cxx.
- Cosmetic changes.
+233 -89
View File
@@ -1,4 +1,4 @@
# $Id: architecture.gmk,v 2.40 1998/12/15 19:29:13 gcosmo Exp $
# $Id: architecture.gmk,v 1.36 1999/07/06 17:54:49 johna Exp $
# ------------------------------------------------------------------------
# GEANT 4 - Architecture configuration script for GNU Make
#
@@ -25,10 +25,12 @@
#
# Linux-g++ Linux (Red Hat 5.1), egcs 1.1
#
# WIN32-VC-NICE NiceNT and Microsoft Visual C++ 5.0 installed
# locally as CD-ROM intallation
# ex. NiceNT at CERN (but CYGWIN32 installed
# locally, because not full installation on NICE)
# WIN32-VC NT and Microsoft Visual C++ 5.0 or Microsoft Visual C++ 6.0
# and using CYGWIN32 tools ( make, g++ as "makedepend", sh...)
# ( Note: you will need to set your environment, see installation
# guide.)
#
# WIN32-VC-NICE alias for the above, although NICE is not used anymore.
#
# WIN32-G++-NICE NiceNT and CYGWIN32 with g++ as base compiler
# ex. NiceNT at CERN (but CYGWIN32 and RogueWave
@@ -38,6 +40,13 @@
MAKEFLAGS= --no-print-directory
# Specify G4USE_STL when using STL, even for using our "temporary"
# STLinterface to RogueWave.
#
ifdef G4USE_STL
CPPFLAGS += -DG4USE_STL
endif
# If not specified, the default platform for G4SYSTEM is IBM-AIX ...
#
ifndef G4SYSTEM
@@ -45,10 +54,10 @@ ifndef G4SYSTEM
endif
# If not specified, the default path for G4 installation G4INSTALL is
# set to $HOME/geant4beta ...
# set to $HOME/geant4 ...
#
ifndef G4INSTALL
G4INSTALL := $(HOME)/geant4beta
G4INSTALL := $(HOME)/geant4
endif
# If not specified, the default path for G4 source G4BASE is
@@ -80,6 +89,7 @@ ifndef G4LIB
G4LIB := $(G4INSTALL)/lib
endif
G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4LIB) ] && mkdir -p $(G4LIB) )
G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4LIB)/$(G4SYSTEM) ] && mkdir -p $(G4LIB)/$(G4SYSTEM) )
# If not specified, the default path for G4 binaries G4BIN is
# set to $G4WORKDIR/bin/$G4SYSTEM ...
@@ -118,11 +128,11 @@ ifndef G4DEBUG
endif
#
# CLHEP path
# CLHEP path, etc.
#
ifndef CLHEP_BASE_DIR
CLHEP_BASE_DIR := /afs/cern.ch/rd44/dev/CLHEP/$(G4SYSTEM)/pro
CLHEP_BASE_DIR := /afs/cern.ch/sw/geant4/dev/CLHEP/$(G4SYSTEM)/pro
endif
CLHEP_INCLUDE_DIR := $(CLHEP_BASE_DIR)/include
CLHEP_LIB_DIR := $(CLHEP_BASE_DIR)/lib
@@ -131,33 +141,102 @@ ifndef CLHEP_LIB
endif
ifeq ($(G4SYSTEM),WIN32-VC-NICE)
#
# NiceNT policy for letter drive mapping
#
ifndef CLHEP_BASE_DIR
CLHEP_BASE_DIR := "z:\p32\lhcpp\clhep\1.1"
G4SYSTEM:=WIN32-VC
endif
CLHEP_INCLUDE_DIR := $(CLHEP_BASE_DIR)/include
CLHEP_LIB_DIR := $(CLHEP_BASE_DIR)/lib
CLHEP_LIB := libCLHEP-cl.a
ifeq ($(G4SYSTEM),WIN32-VC)
# CLHEP_BASE_DIR must be defined in the environment
CLHEP_INCLUDE_DIR := $(CLHEP_BASE_DIR)/include
CLHEP_LIB_DIR := $(CLHEP_BASE_DIR)/lib
CLHEP_LIB := CLHEP.lib
endif
#
# Rogue Wave Tools.h++ path
# Rogue Wave Tools.h++ path & ObjectSpace STL
#
ifndef RWBASE
RWBASE := /afs/cern.ch/rd44/dev/rogue/$(G4SYSTEM)
endif
RWINC := $(RWBASE)
RWLIBDIR := $(RWBASE)/lib
RWLIB := rwtool
ifeq ($(G4SYSTEM),HP-aCC)
RWBASE := /opt/aCC
RWINC := $(RWBASE)/include
RWLIBDIR := /usr/lib
endif
ifdef G4USE_OSPACE
#Object Space STL implementation
RWINC := $(G4BASE)/global/STLInterface
OSPACEDIR := /afs/cern.ch/sw/geant4/dev/ObjectSpace/$(G4SYSTEM)/pro/ToolKit
OSPACEINC := -I$(OSPACEDIR)/ospace/std -I$(OSPACEDIR)/ospace/stl
OSPACELIBS := -L$(OSPACEDIR)/lib -lospace
CPPFLAGS += -DG4USE_STL
ifeq ($(G4SYSTEM),WIN32-VC)
OSPACEDIR := $(OBJECT_SPACE_BASE)
OSPACEINC := -I$(OSPACEDIR)/ospace/std -I$(OSPACEDIR)/ospace/stl -I$(OSPACEDIR)
OSPACELIBS := '-libpath:c:\dev\ospace\lib std-2.1-vc5.0-mt.lib'
CPPFLAGS += -DG4USE_STL -DG4USE_OLDSTL
CPPFLAGS += -DOS_WIN_NT_4_0 -DOS_MULTI_THREADED -D_WIN32_WINNT $(OSPACEINC)
endif
else
ifdef G4USE_STL
# Native STL implemetation
RWINC := $(G4BASE)/global/STLInterface
else
ifdef G4USE_STLPORT
# STLport STL implementation (free) ( derived from SGI implementaion)
ifeq ($(G4SYSTEM),WIN32-VC)
RWINC := $(G4BASE)/global/STLInterface
STLPORTDIR := $(STLPORT_BASE)
OSPACEINC := -I$(STLPORTDIR)/stl
CPPFLAGS += -DG4USE_STL -DG4USE_OLDSTL
CPPFLAGS += -D_NOTHREADS -D__STL_NO_NEW_IOSTREAMS -D__STL_NO_NAMESPACES -D__STL_NO_NEW_STYLE_HEADERS
endif
endif #STLport
endif #STL
endif #OPSPACE
# default to RW if RWINC is not set...
ifndef RWINC
ifndef RWBASE
RWBASE := /afs/cern.ch/sw/geant4/dev/rogue/$(G4SYSTEM)
endif
RWINC := $(RWBASE)
RWLIBDIR := $(RWBASE)/lib
RWLIB := rwtool
ifeq ($(G4SYSTEM),HP-aCC)
RWBASE := /opt/aCC
RWINC := $(RWBASE)/include
RWLIBDIR := /usr/lib
endif
ifeq ($(G4SYSTEM),WIN32-VC)
# RWBASE must be defined in the environment
RWINC := $(RWBASE)
RWLIBDIR := $(RWBASE)"\lib"
RWLIB := mtlmt.lib
endif
ifeq ($(G4SYSTEM),WIN32-G++-NICE)
#
# locally installed RogueWave for g++ (mount mapping)
#
RWBASE := /rogue
RWINC := $(RWBASE)
RWLIBDIR := $(RWBASE)/lib
RWLIB := rwtool
endif
#
# Make dependencies files by g++ then need right RW include
#
ifdef RWINCGPP
RWINCGPP := -I$(RWINCGPP)
endif
endif # ifndef RWINC
#
# Paths for G4 data
@@ -172,33 +251,10 @@ ifndef G4LEVELGAMMADATA
G4LEVELGAMMADATA := $(G4DATA)/PhotonEvaporation
endif
ifeq ($(G4SYSTEM),WIN32-VC-NICE)
#
# NiceNT policy for letter drive mapping
#
ifndef RWBASE
RWBASE := "z:\p32\lhcpp\rw\tools\7.0.2\rogue"
endif
RWINC := $(RWBASE)
RWLIBDIR := $(RWBASE)"\lib"
RWLIB := mtldmt.lib
RWINCGPP := /rogue
endif
ifeq ($(G4SYSTEM),WIN32-G++-NICE)
#
# locally installed RogueWave for g++ (mount mapping)
#
RWBASE := /rogue
RWINC := $(RWBASE)
RWLIBDIR := $(RWBASE)/lib
RWLIB := rwtool
endif
#
# Toggle variables (positional qualifiers) between WIN32-VC and UNIX...
#
ifeq ($(G4SYSTEM),WIN32-VC-NICE)
ifeq ($(G4SYSTEM),WIN32-VC)
OUT_OBJ := -TP '-Fo'
FOR_OBJ := '-Fo'
OUT_LIB := '-out:'
@@ -226,29 +282,37 @@ else
FLIB_PATT := $(LIB_PATT)
endif
#
# Make dependencies files by g++ then need right RW include
#
ifdef RWINCGPP
RWINCGPP := -I$(RWINCGPP)
endif
#
# Variables for implicit rules, etc., as suggested in GNU Make manual...
#
CPPFLAGS += -Iinclude \
-I$(CLHEP_INCLUDE_DIR) \
-I$(RWINC)
CPPFLAGS += -Iinclude -I$(RWINC)
CPPFLAGS += -I$(CLHEP_INCLUDE_DIR)
#
# Positional qualifiers in action...
#
ifeq ($(G4SYSTEM),WIN32-VC-NICE)
LDFLAGS := -link $(LIB_PATH)$(CLHEP_LIB_DIR) $(LIB_PATH)$(RWLIBDIR)
LOADLIBS := $(CLHEP_LIB) $(RWLIB)
ifeq ($(G4SYSTEM),WIN32-VC)
LDFLAGS := -link $(LIB_PATH)$(CLHEP_LIB_DIR)
ifdef RWLIBDIR
LDFLAGS += $(LIB_PATH)$(RWLIBDIR)
endif
LOADLIBS := $(CLHEP_LIB)
ifdef RWLIB
LOADLIBS += $(RWLIB)
endif
else
LDFLAGS := -L$(CLHEP_LIB_DIR) -L$(RWLIBDIR)
LOADLIBS := -l$(CLHEP_LIB) -l$(RWLIB) -lm
## LDFLAGS := -L$(CLHEP_LIB_DIR)
LDFLAGS :=
ifdef RWLIBDIR
LDFLAGS += -L$(RWLIBDIR)
endif
## LOADLIBS := -l$(CLHEP_LIB)
LOADLIBS := $(CLHEP_LIB_DIR)/lib$(CLHEP_LIB).a
ifdef RWLIB
LOADLIBS += -l$(RWLIB)
endif
LOADLIBS += -lm
endif
#
@@ -310,6 +374,9 @@ AR := ar r
# Default echo used with makedepend. Changed for SUN-CC, Linux-g++.
ECHO:= echo
# Default grep used with source/GNUmakfile. Changed for SUN-CC.
GREP := grep
#
# Architecture dependent variables...
@@ -324,6 +391,7 @@ ifeq ($(G4SYSTEM),AIX-xlC)
else
CXXFLAGS := -g -qdbxextra -qcheck=all -qfullpath -qtwolink -+
FCFLAGS := -g
CCFLAGS := -g
endif
FC := xlf
FCFLAGS += -qextname
@@ -340,6 +408,19 @@ ifeq ($(G4SYSTEM),AIX-xlC)
ifndef OGLLIBS
OGLLIBS := -L$(OGLHOME)/lib -lGLU -lGL
endif
ifdef G4ODBMS
ifeq ($(OBJY_VERS),4.0.2)
OBJY_LDLIB := oo_shar.4.02
endif
endif
CPPFLAGS += -DG4NOT_ISO_DELETES
ifdef G4USE_STL
CPPFLAGS += -I$(RWINC)/wrappers/$(G4SYSTEM)
endif
ifdef G4USE_OSPACE
CPPFLAGS += -DOS_AIX_4 -DOS_NEW_CHECK -DOS_STL_ASSERT -DOS_NO_WSTRING -DOS_NO_ALLOCATORS
CPPFLAGS += -I$(RWINC)/wrappers/$(G4SYSTEM) $(OSPACEINC) -I$(OSPACEDIR)
endif
endif
# -------- SUN ---------
@@ -351,6 +432,7 @@ ifeq ($(G4SYSTEM),SUN-CC)
else
CXXFLAGS := -g
FCFLAGS := -g
CCFLAGS := -g
endif
# CXXFLAGS += -fnonstd
CFRONT_G4TEMPLATE_REPOSITORY := true
@@ -358,11 +440,11 @@ ifeq ($(G4SYSTEM),SUN-CC)
SHEXT := so
AR := $(CXX) -xar -ptr$(G4TREP) -o
ECHO := /bin/echo
GREP := /usr/xpg4/bin/grep
FCLIBS := -lM77 -lF77 -lsunmath
X11FLAGS := -I/usr/openwin/include/X11/extensions -I/usr/openwin/include/X11 -I/usr/openwin/include
X11LIBS := -L/usr/openwin/lib -L/usr/dt/lib -L/usr/ucblib -R/usr/openwin/lib -lXmu -lX11 -lXext
XMFLAGS := -I/usr/include/Motif1.2
XMLIBS := -L/usr/openwin/lib -L/usr/dt/lib -L/usr/ucblib -R/usr/openwin/lib -lXt -lX11
XMLIBS := -L/usr/openwin/lib -L/usr/dt/lib -L/usr/ucblib -R/usr/openwin/lib -lXt -lXm -lX11
XAWFLAGS := -I/usr/openwin/include/X11
XAWLIBS := -L/usr/openwin/lib -L/usr/dt/lib -L/usr/ucblib -R/usr/openwin/lib -lXaw -lXmu -lXt -lX11 -lXext
ifndef OGLFLAGS
@@ -371,8 +453,21 @@ ifeq ($(G4SYSTEM),SUN-CC)
ifndef OGLLIBS
OGLLIBS := -L$(OGLHOME)/lib -lGLU -lGL
endif
ifdef G4ODBMS
ifeq ($(OBJY_VERS),4.0.2)
OBJY_LDLIB := oo
endif
endif
CPPFLAGS += -DSOCKET_IRIX_SOLARIS
VISLIBS += -L/usr/lib -lsocket -lnsl
LOADLIBS += -L/usr/lib -lsocket -lnsl
CPPFLAGS += -DG4NOT_ISO_DELETES
ifdef G4USE_STL
CPPFLAGS += -I$(RWINC)/wrappers/$(G4SYSTEM)
endif
ifdef G4USE_OSPACE
CPPFLAGS += -DOS_SOLARIS_2_5 -DOS_NEW_CHECK -DOS_STL_ASSERT -DOS_NO_WSTRING -DOS_NO_ALLOCATORS
CPPFLAGS += -I$(RWINC)/wrappers/$(G4SYSTEM) $(OSPACEINC) -I$(OSPACEDIR)
endif
endif
# -------- HP ---------
@@ -380,10 +475,11 @@ endif
ifeq ($(G4SYSTEM),HP-aCC)
CXX := aCC
ifdef G4OPTIMISE
CXXFLAGS := +O2
CXXFLAGS := +O2 +Onolimit
else
CXXFLAGS := -g
CXXFLAGS := -g
FCFLAGS := -g
CCFLAGS := -g
endif
CXXFLAGS += +DAportable
CPPFLAGS += -I/usr
@@ -393,6 +489,7 @@ ifeq ($(G4SYSTEM),HP-aCC)
G4_HAVE_BOOL := yes
FC := f77
FCFLAGS += +E6 +ppu
CCFLAGS += -Ae +DAportable
X11FLAGS := -I/usr/include/X11/extensions -I/usr/contrib/X11R6/include -I/usr/contrib/X11R6/include/X11
X11LIBS := -L/usr/contrib/X11R6/lib -lXmu -L/usr/lib -lXt -lXext -lX11
XMFLAGS := -I/usr/include/Motif1.2
@@ -406,6 +503,20 @@ ifeq ($(G4SYSTEM),HP-aCC)
OGLLIBS := -L$(OGLHOME)/lib -lGLU -lGL
OGLLIBS += -L/opt/graphics/common/lib -lXwindow -lhpgfx -lXhp11 -ldld
endif
ifdef G4ODBMS
ifeq ($(OBJY_VERS),4.0.2)
OBJY_LDLIB := oo
endif
endif
CPPFLAGS += -DG4NOT_ISO_DELETES
ifdef G4USE_STL
CPPFLAGS += -I$(RWINC)/wrappers/$(G4SYSTEM) -DG4USE_EXPLICIT_TYPES_IN_TEMPLATES
endif
ifdef G4USE_OSPACE
CPPFLAGS += -DOS_HPUX_10_20 -DOS_NEW_CHECK -DOS_STL_ASSERT -DOS_NO_WSTRING -DOS_NO_ALLOCATORS
CPPFLAGS += -DOS_NO_TYPEDEF_5 -D__HPACC_NOEH -DG4USE_EXPLICIT_TYPES_IN_TEMPLATES
CPPFLAGS += -I$(RWINC)/wrappers/$(G4SYSTEM) $(OSPACEINC) -I$(OSPACEDIR)
endif
endif
# -------- SGI ---------
@@ -413,11 +524,13 @@ endif
ifeq ($(G4SYSTEM),SGI-CC)
CXX := CC
ifdef G4OPTIMISE
CXXFLAGS := -O -ptused
CXXFLAGS := -O -Olimit 5000
else
CXXFLAGS := -g -ptused
FCFLAGS := -g
CXXFLAGS := -g
FCFLAGS := -g
CCFLAGS := -g
endif
CXXFLAGS += -ptused
FC := f77
FCLIBS := -lftn
SHEXT := so
@@ -431,6 +544,10 @@ ifeq ($(G4SYSTEM),SGI-CC)
OGLLIBS := -L/usr/lib -lGLU -lGL
endif
CPPFLAGS += -DSOCKET_IRIX_SOLARIS
ifdef G4USE_OSPACE
CPPFLAGS += -DOS_IRIX_6_2 -DOS_NEW_CHECK -DOS_STL_ASSERT -DOS_NO_WSTRING -DOS_NO_ALLOCATORS
CPPFLAGS += $(OSPACEINC) -I$(OSPACEDIR)
endif
endif
# -------- DEC ---------
@@ -442,11 +559,12 @@ ifeq ($(G4SYSTEM),DEC-cxx)
else
CXXFLAGS := -gall
FCFLAGS := -g
CCFLAGS := -g
endif
CFRONT_G4TEMPLATE_REPOSITORY := true
G4_HAVE_BOOL := yes
LDFLAGS += -taso
CXXFLAGS += -ieee
CXXFLAGS += -ieee -timplicit_local
FC := f77
FCLIBS := -lUfor -lfor -lFutil -lots
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
@@ -458,6 +576,15 @@ ifeq ($(G4SYSTEM),DEC-cxx)
OGLLIBS := -L$(OGLHOME)/lib -lGLU -lGL
# OGLLIBS := -lMesaGLU -lMesaGL
endif
ifdef G4USE_STL
CPPFLAGS += -I$(RWINC)/wrappers/$(G4SYSTEM)
CXXFLAGS += -nostdnew
endif
ifdef G4USE_OSPACE
CPPFLAGS += -DOS_OSF1_4 -DOS_NEW_CHECK -DOS_STL_ASSERT -DOS_NO_WSTRING -DOS_NO_ALLOCATORS -D__NO_EDG_EXCEPTION_CLASSES
CPPFLAGS += -I$(RWINC)/wrappers/$(G4SYSTEM) $(OSPACEINC) -I$(OSPACEDIR)
CXXFLAGS += -nostdnew
endif
endif
# ------ GNU/LINUX ------
@@ -470,14 +597,15 @@ ifeq ($(G4SYSTEM),Linux-g++)
CXXFLAGS += -O
else
CXXFLAGS += -g
FCFLAGS := -g
FCFLAGS := -g
CCFLAGS := -g
endif
FC := g77
FCFLAGS += -fno-automatic -fno-backslash -fno-second-underscore
FCLIBS := -lf2c
ECHO := /bin/echo
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
X11LIBS := -L/usr/X11/lib -lXmu -lXt -lXext -lX11 -lSM -lICE
X11LIBS := -L/usr/X11R6/lib -lXmu -lXt -lXext -lX11 -lSM -lICE
XMFLAGS := -I/usr/X11R6/include
XMLIBS := -lXm -lXpm
ifndef OGLFLAGS
@@ -487,29 +615,41 @@ ifeq ($(G4SYSTEM),Linux-g++)
OGLLIBS := -L$(OGLHOME)/lib -lGLU -lGL
endif
OIVFLAGS += -I$(OIHOME)/include
ifdef G4USE_OSPACE
CPPFLAGS += -DOS_LINUX_2 -DOS_NEW_CHECK -DOS_STL_ASSERT -DOS_NO_WSTRING -DOS_NO_ALLOCATORS
CPPFLAGS += -I$(OSPACEDIR)/ospace/std -I$(OSPACEDIR)
endif
endif
# ------ WIN32/VC/NICE ------
# ------ WIN32/VC ------
#
ifeq ($(G4SYSTEM),WIN32-VC-NICE)
ifeq ($(G4SYSTEM),WIN32-VC)
CXX := CL
G4_HAVE_BOOL := yes
G4_NO_CBRT := yes
ifdef G4OPTIMISE
CXXFLAGS += -Ox
else
CXXFLAGS += -Od
CXXFLAGS += -Od -Zi -Fd$(G4LIBDIR)/lib$(name)
endif
CXXFLAGS += -GX -Zm200 -DWIN32 # -TP
CXXFLAGS += -MD -GX -Zm200 -nologo -DWIN32 -D_CONSOLE
CXXFLAGS += -D_WIN32 -DOS -DG4NOT_ISO_DELETES
CPPFLAGS += -DWIN32 -DRW_NO_XMSG
#
# Should set $INCLUDE environment, if not set as below
#
# CXXFLAGS += -I'\\srv1_info\v2\vc50pro1\DEVSTUDIO\VC\INCLUDE'
ifdef G4USE_OSPACE
CXXFLAGS += $(OSPACEINC)
else
ifdef G4USE_STLPORT
CXXFLAGS += $(OSPACEINC)
endif #stlport
endif #ospace
LDFLAGS += -FORCE
LDFLAGS += -FORCE /NODEFAULTLIB:MSVCRT.dll
#
# Should set $LIB environment, if not set as below
# Should set $LIB environment to include VC++ Studio lib directories, e.g.
#
# $(LIB_PATH)"c:\ProgramFiles\DevStudio\vc\lib" \
# $(LIB_PATH)'\\srv1_info\v2\vc50pro1\DEVSTUDIO\VC\LIB' \
@@ -561,7 +701,11 @@ ifdef G4_NO_CBRT
endif
# Standard Template Library (STL) not installed
CPPFLAGS += -DRW_NO_STL
ifndef G4USE_STL
ifndef G4USE_OSPACE
CPPFLAGS += -DRW_NO_STL
endif
endif
# Verbosity code can be left out (for better performance)
# by defining G4_NO_VERBOSE.
+136 -60
View File
@@ -1,4 +1,4 @@
# $Id: binmake.gmk,v 2.22 1998/12/01 22:59:47 gcosmo Exp $
# $Id: binmake.gmk,v 1.29 1999/07/06 15:19:42 gunter Exp $
# ----------------------------------------------------------
# Script defining rules and paths for making binaries.
# Gabriele Cosmo, 25/06/1998.
@@ -27,6 +27,7 @@ ifndef INCFLAGS
-I$(G4BASE)/particles/hadrons/barions/include \
-I$(G4BASE)/particles/hadrons/ions/include \
-I$(G4BASE)/particles/hadrons/mesons/include \
-I$(G4BASE)/particles/shortlived/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/general/include \
-I$(G4BASE)/processes/decay/include \
@@ -37,6 +38,7 @@ ifndef INCFLAGS
-I$(G4BASE)/processes/electromagnetic/muons/include \
-I$(G4BASE)/processes/electromagnetic/utils/include \
-I$(G4BASE)/processes/electromagnetic/xrays/include \
-I$(G4BASE)/processes/electromagnetic/lowenergy/include \
-I$(G4BASE)/processes/hadronic/management/include \
-I$(G4BASE)/processes/hadronic/processes/include \
-I$(G4BASE)/processes/hadronic/util/include \
@@ -58,6 +60,7 @@ ifndef INCFLAGS
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/geometry/solids/CSG/include \
-I$(G4BASE)/geometry/solids/BREPS/include \
-I$(G4BASE)/geometry/solids/Boolean/include \
-I$(G4BASE)/geometry/solids/STEP/include \
-I$(G4BASE)/geometry/solids/STEPinterface/include \
-I$(G4BASE)/geometry/volumes/include \
@@ -92,84 +95,162 @@ ifdef G4ODBMS
-DHep_HAS_BUILDIN_BOOL_CONSTANTS
endif
ifndef LDLIBS
ifdef G4EXLIB
LDLIBS := -l$(G4TARGET) $(VISLIBS) $(UILIBS)
else
LDLIBS := $(VISLIBS) $(UILIBS)
endif
ifdef G4ODBMS
LDLIBS += -lG4persistency
endif
LDLIBS += \
-lG4readout \
-lG4run \
-lG4event \
-lG4tracking \
-lG4processes \
-lG4particles \
-lG4digits+hits \
-lG4track \
-lG4materials \
-lG4geometry \
-lG4graphics_reps \
-lG4intercoms \
-lG4global \
$(INTYLIBS)
endif
ifdef G4ODBMS
LDFLAGS += -L$(OBJY_DIR)/lib \
-L$(HEP_ODBMS_DIR)/lib
# Note: -loo_sahr.4.02 and -lHepODBMS should be placed
# _before_ -l$(CLHEP_LIB) -l$(RWLIB)
LDLIBS += -loo_shar.4.02 -lHepODBMS
endif
CPPFLAGS += $(INCFLAGS)
LDFLAGS += -L$(G4LIBDIR)
LDLIBS += $(LOADLIBS)
G4TMPDIR := $(G4TMP)/$(G4SYSTEM)/$(G4TARGET)
G4BINDIR := $(G4BIN)/$(G4SYSTEM)
ifdef G4EXLIB
G4LIBDIR := $(G4TMPDIR)
LDFLAGS += -L$(G4LIBDIR)
include $(G4INSTALL)/config/common.gmk
G4LIBDIR := $(G4TMPDIR)
LDFLAGS += -L$(G4LIBDIR)
include $(G4INSTALL)/config/common.gmk
endif
GLOBALLIBS := $(shell test -f $(G4LIB)/$(G4SYSTEM)/libG4global.a && echo yes)
ifdef LDLIBS
USER_DEFINED_LDLIBS := 1
endif
# Because of the script for granular libraries which replaces part of LDLIBS
# and because of the way user defined LDLIBS was augmented historically I
# have split LDLIBS into 4 parts...
#
ifndef USER_DEFINED_LDLIBS
# LDLIBS1 contains the very high level libraries...
#
ifdef G4EXLIB
LDLIBS1 := -l$(G4TARGET)
endif
# VISLIBS and UILIBS are now handles by the granular library script...
#
ifdef GLOBALLIBS
LDLIBS1 += $(VISLIBS) $(UILIBS)
endif
ifdef G4ODBMS
LDLIBS1 += -lG4persistency
endif
ifdef GLOBALLIBS
LDLIBS2 := -lG4readout \
-lG4run \
-lG4event \
-lG4tracking \
-lG4processes \
-lG4particles \
-lG4digits+hits \
-lG4track \
-lG4materials \
-lG4geometry \
-lG4graphics_reps \
-lG4intercoms \
-lG4global
else
# The next line specifically should read LDLIBS2 = , not LDLIBS2 :=, so
# that it is not expanded until the directory G4TMPDIR is created.
LDLIBS2 = $(shell \
G4TMP=$(G4TMP); export G4TMP; \
if [ \( -f $(G4LIB)/$(G4SYSTEM)/liblist \
-a -f $(G4LIB)/$(G4SYSTEM)/libname.map \) ]; then \
$(G4LIB)/$(G4SYSTEM)/liblist \
-d $(G4TMPDIR) \
< $(G4LIB)/$(G4SYSTEM)/libname.map; fi)
# Extra libraries to resolve remaining circular dependencies...
# LDLIBS2 +=
endif
# LDLIBS3 contains the first set of low level libraries...
#
LDLIBS3 += $(INTYLIBS)
endif # ifndef USER_DEFINED_LDLIBS
# LDLIBS4 contains the next set of low level libraries which historically
# (why?) the user is not supposed to be able to define...
#
ifdef G4ODBMS
LDFLAGS += -L$(OBJY_DIR)/lib \
-L$(HEP_ODBMS_DIR)/lib
# Note: -l$(OBJY_LDLIB) and -lHepODBMS should be placed
# _before_ -l$(CLHEP_LIB) -l$(RWLIB)
LDLIBS4 += -l$(OBJY_LDLIB) -lHepODBMS
endif
ifdef G4USE_OSPACE
LDLIBS4 += $(OSPACELIBS)
endif
LDLIBS4 += $(EXTRALIBS)
LDLIBS4 += $(LOADLIBS)
# Finally assemble libraries...
#
ifdef USER_DEFINED_LDLIBS
LDLIBS_PREFINAL := $(LDLIBS)
else
LDLIBS_PREFINAL = $(LDLIBS1) $(LDLIBS2) $(LDLIBS3)
endif
LDLIBS_PREFINAL += $(LDLIBS4)
ifeq ($(G4SYSTEM),WIN32-VC)
WIN32TMP := $(patsubst -L%,$(LIB_PATH)%,$(LDFLAGS))
LDFLAGS = $(patsubst /,$(PATH_DEL),$(WIN32TMP))
LDLIBS = $(patsubst -l%,lib%.a,$(LDLIBS_PREFINAL))
else
LDLIBS = $(LDLIBS_PREFINAL)
endif
LDLIBS += $(EXTRALIBS)
sources := $(wildcard $(G4TARGET).cc)
objects := $(patsubst %.cc,$(G4TMPDIR)/exe/%.o,$(sources))
dependencies := $(patsubst %.cc,$(G4TMPDIR)/exe/%.d,$(sources))
.PHONY: bin clean clean_bin
LINK_DEPENDENCIES := $(G4TMPDIR)/exe/obj.last
.PHONY: bin clean clean_bin debug
# Make $(G4TARGET) executable.
bin: $(G4BINDIR)/$(G4TARGET)
ifeq ($(G4SYSTEM),WIN32-VC-NICE)
WIN32TMP := $(patsubst -L%,$(LIB_PATH)%,$(LDFLAGS))
LDFLAGS = $(patsubst /,$(PATH_DEL),$(WIN32TMP))
LDLIBS := $(patsubst -l%,lib%.a,$(LDLIBS))
$(G4BINDIR)/$(G4TARGET): $(LINK_DEPENDENCIES)
ifndef USER_DEFINED_LDLIBS
ifndef GLOBALLIBS
@echo "WARNING: This assumes you are using granular libraries!"
@echo "WARNING: It looked for your global library G4global and,"
@echo " not finding it, assumes you are using granular"
@echo " libraries."
@echo "WARNING: If you did not intend this, interrupt now (CTRL-C),"
@echo " and go back and make global libraries, i.e.,"
@echo ' cd $$G4INSTALL/source'
@echo " gmake global"
@if [ ! \( -f $(G4LIB)/$(G4SYSTEM)/liblist \
-a -f $(G4LIB)/$(G4SYSTEM)/libname.map \) ]; then \
echo "ERROR: No liblist program or library map file."; \
echo " These are needed for building with granular"; \
echo " libraries."; \
echo ' cd $$G4INSTALL/source'; \
echo " gmake"; \
echo " or if you are sure you have already made all the"; \
echo " granular libraries:"; \
echo " gmake libmap"; \
exit 1; fi
endif
endif
$(G4BINDIR)/$(G4TARGET): $(G4TMPDIR)/exe/obj.last
@if [ ! -d $(G4BINDIR) ] ; then mkdir $(G4BINDIR) ;fi
ifdef CPPVERBOSE
$(CXX) $(CXXFLAGS) $(CPPFLAGS) \
-o $(G4BINDIR)/$(G4TARGET) $(objects) $(LDFLAGS) $(LDLIBS)
-o $(G4BINDIR)/$(G4TARGET) $(objects) $(LDFLAGS) \
$(LDLIBS)
else
@echo Linking $(G4TARGET) ...
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) \
-o $(G4BINDIR)/$(G4TARGET) $(objects) $(LDFLAGS) $(LDLIBS)
-o $(G4BINDIR)/$(G4TARGET) $(objects) $(LDFLAGS) \
$(LDLIBS)
endif
# Touch the versioning file
@@ -197,13 +278,8 @@ $(G4TMPDIR)/exe/$(G4TARGET).d: $(G4TARGET).cc
@if [ ! -d $(G4TMPDIR) ] ; then mkdir $(G4TMPDIR) ;fi
@if [ ! -d $(G4TMPDIR)/exe ] ; then mkdir $(G4TMPDIR)/exe ;fi
@echo Making dependency for file $<...
ifeq ($(G4SYSTEM),Linux-g++)
@($(ECHO) -n $(G4TMPDIR)/exe/ ; \
@($(ECHO) $(G4TMPDIR)/exe/\\c ; \
g++ -MM $(RWINCGPP) $(CPPFLAGS) $< ) | sed 's!$(G4TMPDIR)/exe/$*.o!& $@!' >$@
else
@($(ECHO) $(G4TMPDIR)/\\c ; \
g++ -MM $(RWINCGPP) $(CPPFLAGS) $< ) | sed 's!$(G4TMPDIR)/exe/$*.o!& $@!' >$@
endif
-include $(dependencies)
clean:
+1 -1
View File
@@ -1,4 +1,4 @@
# $Id: common.gmk,v 2.7 1998/07/29 00:53:08 gcosmo Exp $
# $Id: common.gmk,v 1.1 1999/01/07 15:58:32 gunter Exp $
# ----------------------------------------------------------------
# Common part of GNUmakefile for libraries. John Allison, 5/7/95.
# ----------------------------------------------------------------
+2 -2
View File
@@ -1,4 +1,4 @@
# $Id: globlib.gmk,v 2.15 1998/12/11 00:40:21 gcosmo Exp $
# $Id: globlib.gmk,v 1.2 1999/07/06 15:19:44 gunter Exp $
# --------------------------------------------------------------
# Script for compound libraries. Gabriele Cosmo, 25/6/98.
# --------------------------------------------------------------
@@ -36,7 +36,7 @@ $(G4LIBDIR)/lib$(name).a: \
#
#
#
@if [ X$(G4SYSTEM) = XWIN32-VC-NICE ] ; i=NO; \
@if [ X$(G4SYSTEM) = XWIN32-VC ] ; i=NO; \
then \
(( for lib in $(SUBLIBS); \
do ( if [ $$i = NO ]; \
+11 -9
View File
@@ -11,7 +11,7 @@
# Other libraries
########################### OpenGL, Inventor ############
########################### Inventor ############
# Should be before OpenGL.
ifdef INC_IV
@@ -23,15 +23,8 @@ ifdef LOAD_IV
INTYLIBS += $(OIVLIBS)
endif
ifdef INC_GL
CPPFLAGS += $(OGLFLAGS)
endif
ifdef LOAD_GL
INTYLIBS += $(OGLLIBS)
endif
########################### OPACS #######################
# X11 things must come after.
# OpenGL, X11 things must come after.
ifdef INC_OPACS
CPPFLAGS += -I$(COROOT)/include -I$(XXROOT)/include -I$(WOROOT)/include
@@ -70,6 +63,15 @@ endif
endif
########################### OpenGL ###############################
ifdef INC_GL
CPPFLAGS += $(OGLFLAGS)
endif
ifdef LOAD_GL
INTYLIBS += $(OGLLIBS)
endif
########################### Motif, Athena, X11 ###################
# Motif raise X11 flags.
+512
View File
@@ -0,0 +1,512 @@
/* $Id: liblist.c,v 1.7 1999/07/02 12:27:38 stesting Exp $ */
/*
Given a "libname.map" file on standard input and a list or directory
of .d dependency files liblist produces:
a) without -l option, a library list ordered according to the libname.map,
giving a warning if conflicting dependencies are found in the .d files.
b) with -l option, another libname.map, ordered according firstly to the
original libname.map file, then reordered according to the dependencies
found in the .d files. This option is used for compiling the file
libname.map from all the dependencies.
The .d files are specfied in the argument(s).
The libname.map is on standard input.
Usage:
liblist *.d < libname.map
liblist -d <ddir> < libname.map
liblist -l *.d < libname.map
liblist -ld <ddir> < libname.map
liblist -l -d <ddir> < libname.map
where <ddir> is a directory name of a directory which is recursively
searched for dependency files.
Frank Behner, John Allison 13th February 1999.
*/
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <dirent.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#define BUFSIZE 1000000
#define TRIGSIZE 1000
#define NLIBMAX 200
extern char *optarg;
extern int optind, opterr, optopt;
char** parsedir(char *directory,int *argc)
{
DIR *actualdir;
FILE *actualfile;
struct dirent *entry;
char *buffer=0;
struct stat status;
char **targv=0,**ptr,**phelp;
int len,targc,s;
/*Open the actual directory*/
actualdir=opendir(directory);
/*Loop over all entries */
for(entry=readdir(actualdir);entry!=NULL;entry=readdir(actualdir))
{
/* Throw away . and .. */
if(strcmp(entry->d_name,".")==0 ||
strcmp(entry->d_name,"..")==0) continue;
/* Obtain the status information of that entry */
if(buffer) free(buffer);
buffer=(char*) malloc((strlen(directory)+
strlen(entry->d_name)+2)*sizeof(char));
strcpy(buffer,directory);
strcat(buffer,"/");
strcat(buffer,entry->d_name);
s=stat(buffer,&status);
if(s==0)
{
if(S_ISDIR(status.st_mode))
{
/* a directory, so we are going recursive*/
targc=0;
ptr=parsedir(buffer,&targc);
if(targc)
{
phelp=targv;
targv=(char**) malloc((*argc+targc)*sizeof(char*));
memcpy(targv,phelp,*argc*sizeof(char*));
memcpy(&targv[*argc],ptr,targc*sizeof(char*));
*argc+=targc;
free(phelp);
free(ptr);
}
}
else if(S_ISREG(status.st_mode))
{
/* a regular file is it .d? */
len=strlen(entry->d_name);
if(entry->d_name[len-2]=='.' && entry->d_name[len-1]=='d')
{
phelp=targv;
targv=(char**) malloc((*argc+1)*sizeof(char*));
memcpy(targv,phelp,*argc*sizeof(char*));
targv[*argc]=strdup(buffer);
(*argc)++;
free(phelp);
}
}
}
else
perror(" No status");
}
if(buffer) free(buffer);
closedir(actualdir);
return targv;
}
int main (int argc, char** argv) {
char buffer[BUFSIZE],*bufferPtr,workbuf[256];
char *ptr,*p,**pp,**pp1,**pp2,*directory=0;
char **rargv;
int i,optl=0,swapping,c,rargc;
FILE *fp;
#ifdef _WIN32
char *ntg4tmp=0,*ntg4tmp1=0;
int nti;
#endif
struct libmap_
{
char *lib;
char *trigger;
int used;
char **uses;
struct libmap_ *next;
};
struct libmap_ *libmap=0,*libmapPtr=0,*libmapPtr1=0,*libmapPtr2=0,
*prevPtr1,*prevPtr2,*tmpp,*userLibmapPtr;
while((c=getopt(argc,argv,"ld:"))!=EOF)
{
switch(c)
{
case 'l':
optl=1;
break;
case 'd':
directory=strdup(optarg);
break;
}
}
/*Adjust parameters after parsing options */
if(optind<argc)
{
rargv=&argv[optind];
rargc=argc-optind;
}
else
{
rargv=0;
rargc=0;
}
if(directory)
{
if(rargc==0)
{
rargv=parsedir(directory,&rargc);
}
else
{
fprintf(stderr," ERROR: If you specify a directory don't also specify files\n");
exit(-1);
}
}
if(optl)fprintf(stderr," Reading library name map file...\n");
while (!feof(stdin))
{
/* Get library name... */
gets(buffer);
if(feof(stdin)) break;
ptr=strtok(buffer,":\n");
/* Check for duplicate names... */
for(libmapPtr1=libmap;libmapPtr1;libmapPtr1=libmapPtr1->next)
{
if(strcmp(libmapPtr1->lib,ptr)==0)
{
fprintf(stderr," ERROR: Duplicate library name: %s\n",ptr);
fprintf(stderr,
" Perhaps a duplicate subdirectory with"
" a GNUmakefile with the same library name.\n"
);
exit(1);
}
}
if(libmap)
{
libmapPtr->next=(struct libmap_*) malloc(sizeof(struct libmap_));
libmapPtr=libmapPtr->next;
}
else /* First time through anchor libmapPtr to libmap. */
{
libmap=(struct libmap_*) malloc(sizeof(struct libmap_));
libmapPtr=libmap;
}
libmapPtr->next=0;
libmapPtr->lib=strdup(ptr);
libmapPtr->used=0;
libmapPtr->uses=(char**)calloc(NLIBMAX,sizeof(char*));
/* If option -l not specified, fill uses list... */
if(!optl)
{
pp=libmapPtr->uses;
if(ptr)
{
ptr=strtok(NULL," \n");
while (ptr)
{
*pp=strdup(ptr);
pp++;
ptr=strtok(NULL," \n");
}
}
}
/* Get directory name... */
gets(buffer);
ptr=strtok(buffer,"/");
if(!ptr)
{
fprintf(stderr," ERROR: \"/\" before \"source\" expected.\n");
exit(1);
}
while(ptr&&strcmp (ptr,"source"))ptr=strtok(NULL,"/");
ptr=strtok(NULL,"/");
if(!ptr)
{
fprintf(stderr," ERROR: \"source\" expected.\n");
exit(1);
}
libmapPtr->trigger=(char*)malloc(TRIGSIZE);
strcpy(libmapPtr->trigger,ptr);
ptr=strtok(NULL,"/");
while(ptr&&strcmp(ptr,"GNUmakefile"))
{
strcat(libmapPtr->trigger,"/");
strcat(libmapPtr->trigger,ptr);
ptr=strtok(NULL,"/");
}
if(!ptr)
{
fprintf(stderr," ERROR: \"source/<unique-sub-path>/GNUmakefile\" expected.\n");
exit(1);
}
}
if(optl)fprintf(stderr," Reading dependency files...\n");
#ifdef _WIN32
ntg4tmp=getenv("G4TMP");
if ( ! ntg4tmp )
{
fprintf(stderr," ERROR: Cannot find environment variable G4TMP\n");
exit(1);
}
ntg4tmp1=strdup(ntg4tmp);
#endif
for(i=0;i<rargc;i++)
{
fp=fopen(rargv[i],"r");
fgets(buffer,BUFSIZE,fp);
#ifdef _WIN32
ptr=strchr(ntg4tmp1,':');
if ( ptr ) *(ptr+1)='\0';
while ( ptr=strchr(buffer,'\\') ) *ptr='/';
while (ntg4tmp1!=NULL && (ptr=strstr(buffer,ntg4tmp1))!=NULL )
{
for(nti=0;nti<strlen(ntg4tmp1);nti++) ptr[nti]=' ';
}
#endif
/* Clip target out of dependency file... */
ptr=strtok(buffer,":");
/* Look for a "user" library... */
for(libmapPtr=libmap;libmapPtr;libmapPtr=libmapPtr->next)
{
strcpy(workbuf,libmapPtr->lib);
/* Add trailing "/" to distinguish track/ and tracking/, etc. */
strcat(workbuf,"/");
if(strstr(ptr,workbuf)) break;
}
if(libmapPtr)
{
userLibmapPtr=libmapPtr;
}
else
{
userLibmapPtr=0;
}
/* Look for a "used" library and add it to the "user" uses list... */
do
{
for(libmapPtr=libmap;libmapPtr;libmapPtr=libmapPtr->next)
{
strcpy(workbuf,libmapPtr->trigger);
strcat(workbuf,"/include");
ptr=strstr(buffer,workbuf);
if(ptr)
{
libmapPtr->used=1;
if(userLibmapPtr)
{
for(pp=userLibmapPtr->uses;*pp;pp++)
{
if(strcmp(*pp,libmapPtr->lib)==0)break;
}
if(!*pp)*pp=libmapPtr->lib;
}
}
}
fgets(buffer,BUFSIZE,fp);
#ifdef _WIN32
while ( ptr=strchr(buffer,'\\') ) *ptr='/';
while (ntg4tmp1 && (ptr=strstr(buffer,ntg4tmp1)) )
{
for(nti=0;nti<strlen(ntg4tmp1);nti++) ptr[nti]=' ';
}
#endif
} while(!feof(fp));
fclose(fp);
}
#ifdef _WIN32
free(ntg4tmp1);
#endif
if(optl) /* This option is used for compiling the file libname.map
from all the dependencies. */
{
fprintf(stderr," Checking for circular dependencies...\n");
for(libmapPtr=libmap;libmapPtr;libmapPtr=libmapPtr->next)
{
for(pp=libmapPtr->uses;*pp;pp++)
{
for(libmapPtr1=libmap;libmapPtr1!=libmapPtr;
libmapPtr1=libmapPtr1->next)
{
if(strcmp(libmapPtr1->lib,*pp)==0)
{
for(pp1=libmapPtr1->uses;*pp1;pp1++)
{
if(strcmp(*pp1,libmapPtr->lib)==0)break;
}
if(*pp1)
{
fprintf
(stderr,
" WARNING: %s and %s use each other.\n",
libmapPtr->lib,
libmapPtr1->lib);
}
}
else
{
/* Not right yet...
for(pp1=libmapPtr1->uses;*pp1;pp1++)
{
for(libmapPtr0=libmap;libmapPtr0!=libmapPtr1;
libmapPtr0=libmapPtr0->next)
{
if(libmapPtr0==*pp)
{
fprintf
(stderr,
" WARNING: triangular dependecy:\n"
" %s uses %s uses %s uses %s.\n",
libmapPtr->lib,
libmapPtr1->lib,
libmapPtr0->lib,
libmapPtr->lib);
}
}
}
*/
}
}
}
}
fprintf(stderr," Reordering according to dependencies...\n");
do
{
swapping=0;
prevPtr2=0;
for(libmapPtr=libmap;libmapPtr;libmapPtr=libmapPtr->next)
{
for(pp=libmapPtr->uses;*pp;pp++)
{
prevPtr1=0;
for(libmapPtr1=libmap;libmapPtr1!=libmapPtr;
libmapPtr1=libmapPtr1->next)
{
if(strcmp(libmapPtr1->lib,*pp)==0)
{
/* Check that 1st doesn't use 2nd... */
for(pp1=libmapPtr1->uses;*pp1;pp1++)
{
if(strcmp(*pp1,libmapPtr->lib)==0)break;
}
if(!*pp1) /* If not... */
{
swapping=1;
/* Make previous of 1st now point to 2nd... */
if(prevPtr1)
{
prevPtr1->next=libmapPtr;
}
else
{
libmap=libmapPtr;
}
/* Make 2nd now point to what 1st did, unless
it's adjacent, in which case make it point
to 1st itself... */
tmpp=libmapPtr->next;
if(libmapPtr1->next==libmapPtr)
{
libmapPtr->next=libmapPtr1;
}
else
{
libmapPtr->next=libmapPtr1->next;
}
/* Make previous of 2nd point to 1st, unless
it's adjacent, in which case leave it... */
if(libmapPtr1->next!=libmapPtr)
{
prevPtr2->next=libmapPtr1;
}
/* Make 1st now point to what 2nd did... */
libmapPtr1->next=tmpp;
break;
}
}
prevPtr1=libmapPtr1;
}
if(swapping)break;
}
prevPtr2=libmapPtr;
if(swapping)break;
}
}while(swapping);
fprintf(stderr," Writing new library map file...\n");
for(libmapPtr=libmap;libmapPtr;libmapPtr=libmapPtr->next)
{
printf("%s:",libmapPtr->lib);
for(pp=libmapPtr->uses;*pp;pp++)
{
printf(" %s",*pp);
}
printf("\n");
printf("source/%s/GNUmakefile\n",libmapPtr->trigger);
}
}
else
{
/* Add dependent libraries... */
for(libmapPtr=libmap;libmapPtr;libmapPtr=libmapPtr->next)
{
if(libmapPtr->used)
{
for(pp=libmapPtr->uses;*pp;pp++)
{
for(libmapPtr1=libmap;libmapPtr1;libmapPtr1=libmapPtr1->next)
{
if(strcmp(libmapPtr1->lib,*pp)==0)
{
libmapPtr1->used=1;
}
}
}
}
}
/* Write out library list... */
for(libmapPtr=libmap;libmapPtr;libmapPtr=libmapPtr->next)
{
if(libmapPtr->used)
{
printf("-l%s ",libmapPtr->lib);
}
}
}
exit(0);
}