1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308
|
#
# Maketmpl Makefile template for the Yorick-based codes
# If this is Maketmpl.in, run configure (in ..) to create Maketmpl
#
# $Id$
#
# @configure_input@
#
# Note: symbols between two ats @some thing@ are filled in by configure
# The configure script in the Yorick distribution should be able to do
# most of this correctly. The major exception is the Fortran section.
# Wait until you have installed Maketmpl in Y_HOME before you fix that;
# Yorick itself uses no FORTRAN.
# ---------------------------------------------------------------------------
# Variables to be set in Makefile before including this template:
# CODE_NAME
# NON_SHARABLE
# the name of the code you want to build
# use the NON_SHARABLE for if you are not building a library
# CODE_LIBRARY
# libpkg.a to build a library called pkg
#
# your all:: target should be $(CODE_LIBRARY) $(CODE_NAME)
# or $(NON_SHARABLE)
# depending on whether you want a library or not
#
# OBJS
# list of object files to be built (use \ to continue)
# PKG_LIBS
# -lpkg at least, put any other package libraries here too
# PKG_OBJS
# if you are building without a library, at least $(OBJS) $(YWRAP_O)
# Y_INCLUDE
# startup include files in this directory
# Y_OTHERS
# startup include files for other packages (in Y_HOME/startup or
# Y_HOME/contrib)
# YWRAP_O
# ywrap.o if there are any PROTOTYPE comments in Y_INCLUDE files
# else nil
# SYS_LIBS
# additional system libraries (beyond -lX11 -lm -lc)
# use $(FORTRAN_LIBS) to get Fortran libraries
# FORTRAN_STYLE
# $(WKS_FORTRAN) or $(CRAY_FORTRAN) -- latter is deprecated
# CLEAN_UP
# TIDY_UP
# any special filenames for the clean and tidy targets
# $(CODE_NAME) or $(NON_SHARABLE) should go in CLEAN_UP
# many of these can be generated automatically by running
# the make function defined in Y_SITE/include/make.i
# ---------------------------------------------------------------------------
# Generic make targets defined below--
# $(CODE_NAME): (builds my_code custom version of Yorick)
# $(CODE_LIBRARY): (builds my_code library)
# clean:: (removes everything except source code)
# tidy:: (removes backups and object files)
# Makefile:: (to port this Makefile to another site)
# tags: (make TAGS file for GNU Emacs)
# index: (make index file for vgrind C beautifier)
# ---------------------------------------------------------------------------
# The following paths may be set by the configure script:
# I don't know whether these do what they're supposed to do (for autoconf).
# They actually confuse GNU make sometimes, since they cause Yorick/ycode.c
# to be found when making the MathC and Drat directories.
srcdir = @srcdir@
VPATH = @srcdir@
# Directory for the architecture-independent parts of the public Yorick.
# This
Y_SITE = @Y_SITE@
# Directory for the architecture-dependent parts of the public Yorick.
# Y_HOME affects builds of future custom versions of Yorick, but has no
# effect at runtime.
Y_HOME = @Y_HOME@
Y_BINDIR = @Y_BINDIR@
Y_VERSION = @Y_VERSION@
D_Y_VERSION = '-DY_VERSION="$(Y_VERSION)"'
# Directories for the architecture-dependent parts of Yorick
Y_LIBDIR = $(Y_HOME)/lib
Y_INCDIR = $(Y_HOME)/h
Y_CONTRIBDIR = $(Y_LIBDIR)/contrib
# Typical values:
# Y_SITE = /usr/local/share/yorick/1.3
# Y_HOME = /usr/local/lib/yorick/1.3
# Y_BINDIR = /usr/local/bin
# These are separate variables so they can be
# overridden on the make command line
YORINCL = -I$(Y_INCDIR)
YORLIB = -L$(Y_LIBDIR)
GISTINCL = -I$(Y_INCDIR)
GISTLIB = -L$(Y_LIBDIR)
Y_CONTRIB_LIB = -L$(Y_CONTRIBDIR)
# Filled in by configure script
XLOAD = @XLOAD@
D_NO_XLIB = @D_NO_XLIB@
# ---------------------------------------------------------------------------
# Redefine these to nil to get a no-graphics version of Yorick.
GRAPH_LIBS = $(GISTLIB) -lgist $(XLOAD)
# Solaris needs: -lsocket -lnsl -lw -lintl -ldl
# when loading with -Bstatic -- however, Sun doesn't supply libdl.a!?
GRAPH_I = graph.i
GRAPH_O = graph.o graph0.o style.o
# ---------------------------------------------------------------------------
# Choose C compiler appropriate to this machine - must be an ANSI C compiler
CC = @CC@
DEFS = @DEFS@
CFLAGS = $(C_OPTIMIZE) $(DEFS) $(D_SIZE_T) -I$(srcdir) $(YORINCL)
LDOPTS = @LDOPTS@
LDFLAGS = $(LD_OPTIMIZE) $(LDOPTS)
# Usage: $(Y_LD) $(OBJS) $(LIBS)
Y_LD = $(CC) $(LDFLAGS) -o $@
# The lowest level (last) libraries required on the load line go here.
# LOWLIBS = -lm -lc (if Y_LD is not your C compiler)
LOWLIBS = @LOWLIBS@
.c.o:
$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
.c:
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS)
# Some versions of make have an implicit rule to make .i from .c
.c.i:
@touch $<
# ---------------------------------------------------------------------------
# Repeat for FORTRAN compiler
FC = @FC@
FFLAGS = $(F_OPTIMIZE) $(FORTRAN_STYLE)
# CRAY_FORTRAN = -r8 -i4 Sun SPARC workstation
# CRAY_FORTRAN = +autodbl4 HP PA-RISC workstation (OS<=8)
# CRAY_FORTRAN = -R8 HP PA-RISC workstation (OS>=9)
# doesn't really work, and +autodblpad is totally wrong
# This is the most important case, since Crays are the only deviants:
# CRAY_FORTRAN =
# WKS_FORTRAN = -dp UNICOS Crays
CRAY_FORTRAN = -r8 -i4
WKS_FORTRAN =
# (May be best to leave these commented out...)
# .f.o:
# $(FC) $(FFLAGS) -c $<
# .f:
# $(FC) $(FFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS)
# Since the rule used to build the custom Yorick version generally
# uses the C compiler to load, the user will need to select the
# FORTRAN libraries explicitly. Yorick packages should generally
# avoid FORTRAN I/O, so I don't put the I/O library here...
# FORTRAN_LIBS = -lf77 Sun SPARC workstation
# On Suns, use ar to remove the file main.o from the libF77.a
# in /usr/lang. Call the result libf77.a and put it in Y_HOME.
# Also, Sun FORTRAN uses yacc to stupidly cause a yyparse and
# yylex to appear if you use any formatted I/O -- needless to
# say, this conflicts with Yorick's parser. I could also use
# macros to redefine these names in yorick.y/yorick.c...
# FORTRAN_LIBS = -lF77 Sun SPARC workstation (someday)
# FORTRAN_LIBS = -lM77 -lF77 Solaris
# FORTRAN_LIBS = -lvec -lcl HP PA-RISC workstation
# FORTRAN_LIBS = -l?? IBM workstations
# FORTRAN_LIBS = -lf UNICOS Crays
FORTRAN_LIBS = @FORTRAN_LIBS@
# Codger, Yorick's automatic wrapper and initialization code generator,
# understands four possible FORTRAN external name linkage conventions:
# All lowercase or all uppercase, with or without a trailing underscore.
# Use exactly one of the following lines:
# FORTRAN_LINKAGE = -Df_linkage
# FORTRAN_LINKAGE = -Df_linkage_
# FORTRAN_LINKAGE = -DF_LINKAGE
# FORTRAN_LINKAGE = -DF_LINKAGE_
FORTRAN_LINKAGE = @FORTRAN_LINKAGE@
# ---------------------------------------------------------------------------
# Repeat for C++ compiler
CXX = @CXX@
CCC = $(CXX)
CXXFLAGS = $(CXX_OPTIMIZE) $(DEFS) -I$(srcdir) $(YORINCL)
CCFLAGS = $(CXXFLAGS)
# If C++, YORMAIN will be just main.o and Y_LD will use CXX instead of CC
# Thus, main.o needs a rule to build it:
CXXMAIN = fake_main.o
$(CXXMAIN):
$(CXX) $(CPPFLAGS) -g -c $(Y_INCDIR)/main.c
# ---------------------------------------------------------------------------
# The timing routines in sysdep.c are a perennial problem. The default
# is POSIX 1003.1 standard, but this doesn't work on Suns...
# You will need to edit sysdep.c if neither of these works.
# HAS_BSD_TIMER = -DBSD_TIMER
# HAS_BSD_TIMER =
HAS_BSD_TIMER = @D_TIMER@
# Other weird operating system flags
D_HAS_LIBMSET = @D_HAS_LIBMSET@
D_HAS_GETCWD = @D_HAS_GETCWD@
D_NO_STRTOUL = @D_NO_STRTOUL@
# Other utilities
SHELL = /bin/sh
MAKE = make
RM = rm -f
MV = mv
SED = sed
AR = ar
# If your ar does not take the "l" flag (local temporary files), use this.
ARFLAGS = rc
# ARFLAGS = rcl
RANLIB = @RANLIB@
# ---------------------------------------------------------------------------
# No user serviceable parts beyond this point.
# ---------------------------------------------------------------------------
CODGER = $(Y_LIBDIR)/codger
# A generic main.o is located in Y_HOME, along with main.c.
# yinit.o is made by Codger from ycode.c, which will include all the
# packages specified as Y_INCLUDE, plus the std.i package in Y_HOME.
MAIN_OBJS = yinit.o $(PKG_OBJS)
YORMAIN = $(Y_LIBDIR)/main.o
# ---------------------------------------------------------------------------
# The first three targets are generic rules for building the custom code
# and the package library required for inserting this package into any
# version of Yorick, in combination with other packages.
OTHER_LIBS = $(GRAPH_LIBS) $(SYS_LIBS) $(LOWLIBS)
ALL_LIBS = -L. $(Y_CONTRIB_LIB) $(YORLIB) $(PKG_LIBS) -lyor $(OTHER_LIBS)
$(CODE_NAME): $(MAIN_OBJS) $(CODE_LIBRARY)
$(Y_LD) $(YORMAIN) $(MAIN_OBJS) $(ALL_LIBS)
$(RM) ycode.c
$(NON_SHARABLE): $(MAIN_OBJS)
$(Y_LD) $(YORMAIN) $(MAIN_OBJS) $(ALL_LIBS)
$(RM) ycode.c
# The ywrap.o file is generated by Codger from ycode.c, as controlled
# by the Y_INCLUDE variable.
$(CODE_LIBRARY): $(OBJS) $(YWRAP_O)
$(AR) $(ARFLAGS) $@ $(OBJS) $(YWRAP_O)
$(RANLIB) $@
# The Codger code generator produces a single output file ycode.c
# which must be compiled into two object files -- ywrap.o to be
# included in an object file library for a Yorick package, and
# yinit.o to be loaded into a specific version of Yorick.
ycode.c: $(Y_INCLUDE)
$(CODGER) $(Y_HOME) $(Y_SITE) $(Y_INCLUDE) - $(GRAPH_I) $(Y_OTHERS)
ywrap.o: ycode.c $(Y_INCLUDE)
$(CC) $(CPPFLAGS) $(CFLAGS) -DYWRAP_C -c ycode.c
$(MV) ycode.o ywrap.o
yinit.o: ycode.c $(Y_INCLUDE)
$(CC) $(CPPFLAGS) $(CFLAGS) -DYINIT_C -c ycode.c
$(MV) ycode.o yinit.o
# Housekeeping targets--
# make clean to wipe everything but source files
# make tidy to clean out junk, but leave executables and libraries
clean: tidy
$(RM) *.a $(CLEAN_UP)
tidy:
$(RM) ycode.c *.o *~ *.bak core $(TIDY_UP)
# TAGS table for Emacs
tags:
etags -t *.h *.c *.y
# index for vgrind (a pretty C printing routine)
index:
etags -tv *.h *.c >index
# ---------------------------------------------------------------------------
|