Makefile.def for Cygwin

If you have a script you think might be useful to others post it
here. Hopefully we will be able to get the most useful of these incorporated in the manuals.

Moderators: silvia, selimgunay, Moderators

Post Reply
rjaeger
Posts: 102
Joined: Thu Aug 31, 2006 9:57 pm
Location: UC Davis

Makefile.def for Cygwin

Post by rjaeger »

Code: Select all

############################################################################
#
#  Program:  OpenSees
#
#  Purpose:  A Top-level Makefile to create the libraries needed
#	     to use the OpenSees framework. Works for Linux 7.1 and 
#            above, modified to use the OpenGl libraries.
#
#  Written: fmk 
#  Created: 10/99
#  Edited: RAJ  05/07
#  Send bug reports, comments or suggestions to fmckenna@ce.berkeley.edu
#
############################################################################

# %---------------------------------%
# |  SECTION 1: PROGRAM             |
# %---------------------------------%
#
# Specify the location and name of the OpenSees interpreter program
# that will be created (if this all works!)

OpenSees_PROGRAM = $(HOME)/bin/OpenSees

# %---------------------------------%
# |  SECTION 2: MAKEFILE CONSTANTS  |
# %---------------------------------%
#
# Specify the constants the are used as control structure variables in the Makefiles.

#OPERATING_SYSTEM = LINUX
OPERATING_SYSTEM = WIN32

#GRAPHICS = UsingOpenGL, UsingX11
#GRAPHICS = UsingOpenGL
#GRAPHICS = NONE
GRAPHICS = UsingX11

#PROGRAMMING_MODE = SEQUENTIAL, THREADS OR DISTRIBUTED_MPI
PROGRAMMING_MODE = SEQUENTIAL

#COMPILER = GCC, KAI
COMPILER = GCC

#DEBUG_MODE = DEBUG, NO_DEBUG
DEBUG_MODE = NO_DEBUG

#RELIABILITY = YES_RELIABILITY, NO_RELIABILITY
RELIABILITY = NO_RELIABILITY

# %---------------------------------%
# |  SECTION 3: PATHS               |
# %---------------------------------%
#
# Note: if vendor supplied BLAS and LAPACK libraries or if you have
# any of the libraries already leave the directory location blank AND
# remove the directory from DIRS.

BASE		= /usr/local
HOME		= /home/Robbie
OS			= $(HOME)/OpenSees
FE			= $(OS)/SRC

BLASdir      = $(OS)/OTHER/BLAS
CBLASdir     = $(OS)/OTHER/CBLAS
LAPACKdir    = $(OS)/OTHER/LAPACK
ARPACKdir    = $(OS)/OTHER/ARPACK
UMFPACKdir   = $(OS)/OTHER/UMFPACK
METISdir     = $(OS)/OTHER/METIS
SRCdir       = $(OS)/SRC

ifeq ($(PROGRAMMING_MODE), THREADS)
SUPERLUdir   = $(OS)/OTHER/SuperLU_MT
else
SUPERLUdir   = $(OS)/OTHER/SuperLU_3.0/SRC
endif



DIRS        = $(BLASdir) $(CBLASdir) $(LAPACKdir) \
	$(SUPERLUdir) $(ARPACKdir) $(UMFPACKdir) $(SRCdir) $(METISdir)

# %-------------------------------------------------------%
# | SECTION 4: LIBRARIES                                  |
# |                                                       |
# | The following section defines the libraries that will |
# | be created and/or linked with when the libraries are  | 
# | being created or linked with.                         |
# %-------------------------------------------------------%
#
# Note: if vendor supplied BLAS and LAPACK libraries leave the
# libraries blank. You have to get your own copy of the tcl/tk 
# library!! 
#
# Note: For libraries that will be created (any in DIRS above)
# make sure the directory exsists where you want the library to go!

FE_LIBRARY      = $(HOME)/lib/libOpenSees.a
NDARRAY_LIBRARY = $(HOME)/lib/libndarray.a # BJ_UCD jeremic@ucdavis.edu
MATMOD_LIBRARY  = $(HOME)/lib/libmatmod.a  # BJ_UCD jeremic@ucdavis.edu
BJMISC_LIBRARY  = $(HOME)/lib/libBJmisc.a  # BJ_UCD jeremic@ucdavis.edu
LAPACK_LIBRARY  = $(HOME)/lib/libLapack.a
BLAS_LIBRARY    = $(HOME)/lib/libBlas.a
SUPERLU_LIBRARY = $(HOME)/lib/libSuperLU.a
CBLAS_LIBRARY   = $(HOME)/lib/libCBlas.a
ARPACK_LIBRARY  = $(HOME)/lib/libArpack.a
UMFPACK_LIBRARY = $(HOME)/lib/libUmfpack.a
METIS_LIBRARY   = $(HOME)/lib/libMetis.a
TCL_LIBRARY     = /usr/lib/libtcl84.a /usr/lib/libtk84.a
BLITZ_LIBRARY   = 


ifeq ($(GRAPHICS), UsingX11)
GRAPHIC_LIBRARY = /usr/X11R6/lib/libX11*
else
GRAPHIC_LIBRARY = /usr/X11R6/lib/libGL*
# /usr/lib/libGL.a /usr/X11R6/lib/libX11.a /usr/X11R6/lib/libXext.a \
#		/usr/lib/libGLU.a
endif

ifeq ($(RELIABILITY), YES_RELIABILITY)
RELIABILITY_LIBRARY = $(HOME)/lib/libReliability.a
else
RELIABILITY_LIBRARY = 
endif


# WATCH OUT .. These libraries are removed when 'make wipe' is invoked.
WIPE_LIBS	= $(FE_LIBRARY) \
		$(LAPACK_LIBRARY) \
		$(BLAS_LIBRARY) \
		$(CBLAS_LIBRARY) \
		$(SUPERLU_LIBRARY) \
		$(ARPACK_LIBRARY) \
		$(UMFPACK_LIBRARY) \
	        $(METIS_LIBRARY) \
		$(RELIABILITY_LIBRARY)

# %---------------------------------------------------------%
# | SECTION 5: COMPILERS                                    |
# |                                                         |
# | The following macros specify compilers, linker/loaders, |
# | the archiver, and their options.  You need to make sure |
# | these are correct for your system.                      |
# %---------------------------------------------------------%

# Compilers
CC++	= g++
CC      = gcc
FC	= g77

AR		= ar 
ARFLAGS		= cqls
RANLIB		= ranlib
RANLIBFLAGS     = 

#GRAPHICS = UsingOpenGL, UsingX11
ifeq ($(GRAPHICS), UsingOpenGL)
GRAPHIC_FLAG = -D_GLX
else
GRAPHIC_FLAG = -D_X11
endif

ifeq ($(PROGRAMMING_MODE), THREADS)
PROGRAMMING_FLAG = -D_THREADS -D_PTHREAD
else
PROGRAMMING_FLAG = 
endif

ifeq ($(DEBUG_MODE), DEBUG)
DEBUG_FLAG = -D_G3DEBUG
else
DEBUG_FLAG =
endif

ifeq ($(RELIABILITY), YES_RELIABILITY)
RELIABILITY_FLAG = -D_RELIABILITY
else
RELIABILITY_FLAG =
endif


# Compiler Flags
#
# NOTES:
#    C++ FLAGS TAKE need _UNIX or _WIN32 for preprocessor dircetives
#         - the _WIN32 for the Windows95/98 or NT operating system.
#    C FLAGS used -DUSE_VENDOR_BLAS (needed in SuperLU) if UNIX in C++ FLAGS
#


ifeq ($(DEBUG_MODE), DEBUG)

C++FLAGS         = -Wall  -funroll-loops -fcse-follow-jumps \
		 -fthread-jumps -fcse-skip-blocks -frerun-cse-after-loop \
		 -felide-constructors \
		 -fcaller-saves  -ffloat-store -fforce-addr \
		 -fschedule-insns -fschedule-insns2 -D_LINUX -D_UNIX 
-D_TCL84\
		$(GRAPHIC_FLAG) $(RELIABILITY_FLAG) $(DEBUG_FLAG) $(PROGRAMMING_FLAG) \
		 -fexpensive-optimizations \
		 -fforce-addr -fforce-mem -finline-functions \
		 -fkeep-inline-functions \
              -fno-function-cse -fno-inline -fno-peephole \
              -fschedule-insns -fschedule-insns2 \
              -fstrength-reduce -fthread-jumps -g -pg \
	      -ffloat-store -D_RELIABILITY

CFLAGS          = -Wall -pg $(GRAPHIC_FLAG) $(RELIABILITY_FLAG) $(DEBUG_FLAG) $(PROGRAMMING_FLAG)
FFLAGS          = -Wall 

# Linker
LINKER          = $(CC++)
LINKFLAGS       = -g -pg

else

# modified as optimizaton currently causing problems with Steel01 code
C++FLAGS        =  -Wall -O3 -D_UNIX -ftemplate-depth-30 -D_LINUX -D_TCL84 \
		$(GRAPHIC_FLAG) $(RELIABILITY_FLAG) $(DEBUG_FLAG) $(PROGRAMMING_FLAG) \
		-ffloat-store

CFLAGS          = -Wall -O3 $(GRAPHIC_FLAG) $(RELIABILITY_FLAG) $(DEBUG_FLAG) $(PROGRAMMING_FLAG)
FFLAGS          = -Wall -O

# Linker
LINKER          = $(CC++)
LINKFLAGS       = 

endif

ifeq ($(COMPILER), KAI)

CC++	= /usr/local/KAI/KCC_BASE/bin/KCC
CC      = /usr/local/KAI/KCC_BASE/bin/KCC
FC	= /usr/bin/g77

C++FLAGS        =  -D_KAI -D_UNIX -D_LINUX +K1 +K3 -O3 \
		$(GRAPHIC_FLAG) $(RELIABILITY_FLAG) $(DEBUG_FLAG) $(PROGRAMMING_FLAG)
		--display_error_number 	--backend -ffloat-store

CFLAGS          =  -D_KAI -D_UNIX -D_LINUX $(GRAPHIC_FLAG) $(RELIABILITY_FLAG) \
		 $(DEBUG_FLAG) $(PROGRAMMING_FLAG) +K3 -O3 --c
FFLAGS          =  -Wall -O

LINKER          = $(CC++)
LINKFLAGS       = 

endif


# Misc
MAKE		= make
CD              = cd
ECHO            = echo
RM              = rm
RMFLAGS         = -f
SHELL           = /bin/sh

# %---------------------------------------------------------%
# | SECTION 6: COMPILATION                                  |
# |                                                         |
# | The following macros specify the macros used in         |
# | to compile the source code into object code.            |
# %---------------------------------------------------------%

.SUFFIXES:
.SUFFIXES:	.C .c .f .f90 .cpp .o .cpp

#
# %------------------%
# | Default command. |
# %------------------%
#
.DEFAULT:
	@$(ECHO) "Unknown target $@, try:  make help"
#
# %-------------------------------------------%
# |  Command to build .o files from .f files. |
# %-------------------------------------------%
#

.cpp.o:
	@$(ECHO) Making $@ from $<
	$(CC++) $(C++FLAGS) $(INCLUDES) -c $< -o $@

.C.o:
	@$(ECHO) Making $@ from $<
	$(CC++) $(C++FLAGS) $(INCLUDES) -c $< -o $@
.c.o:
	@$(ECHO) Making $@ from $<
	$(CC) $(CFLAGS) -c $< -o $@
.f.o:      
	@$(ECHO) Making $@ from $<
	$(FC) $(FFLAGS) -c $< -o $@

# %---------------------------------------------------------%
# | SECTION 7: OTHER LIBRARIES                              |
# |                                                         |
# | The following macros specify other libraries that must  |
# | be linked with when creating executables. These are     |
# | platform specific and typically order does matter!!     |
# %---------------------------------------------------------%
MACHINE_LINKLIBS  = -L$(BASE)/lib \
		-L$(HOME)/lib 

MACHINE_NUMERICAL_LIBS  = -lm \
		$(ARPACK_LIBRARY) \
		$(SUPERLU_LIBRARY) \
		$(UMFPACK_LIBRARY) $(METIS_LIBRARY) \
	        $(LAPACK_LIBRARY) $(BLAS_LIBRARY) $(CBLAS_LIBRARY) \
		$(GRAPHIC_LIBRARY) $(RELIABILITY_LIBRARY) -lg2c -ldl


ifeq ($(PROGRAMMING_MODE), THREADS)
MACHINE_SPECIFIC_LIBS = -lpthread
else
MACHINE_SPECIFIC_LIBS = 
endif

# %---------------------------------------------------------%
# | SECTION 8: INCLUDE FILES                                |
# |                                                         |
# | The following macros specify include files needed for   |
# | compilation.                                            |
# %---------------------------------------------------------%
MACHINE_INCLUDES        = -I/usr/include \
			  -I$(BASE)/include \
			  -I/usr/include/cxx \
#			  -I$(HOME)/include -I$(HOME)/blitz \
			  -I$(HOME)/include \
			  -I$(UMFPACKdir) -I$(SUPERLUdir) 


# this file contains all the OpenSees/SRC includes
include $(FE)/Makefile.incl

TCL_INCLUDES = 

INCLUDES = $(TCL_INCLUDES) $(FE_INCLUDES) $(MACHINE_INCLUDES)
I should note that OpenSees is not working properly in Cygwin (yet) when I have used this makefile.def
Post Reply