1# /**************************************************************** 2# Copyright (C) 1997-2001 Lucent Technologies 3# All Rights Reserved 4# 5# Permission to use, copy, modify, and distribute this software and 6# its documentation for any purpose and without fee is hereby 7# granted, provided that the above copyright notice appear in all 8# copies and that both that the copyright notice and this 9# permission notice and warranty disclaimer appear in supporting 10# documentation, and that the name of Lucent or any of its entities 11# not be used in advertising or publicity pertaining to 12# distribution of the software without specific, written prior 13# permission. 14# 15# LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 16# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. 17# IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY 18# SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 19# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER 20# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 21# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 22# THIS SOFTWARE. 23# ****************************************************************/ 24 25# For making amplsolver.a on Unix systems. 26 27.SUFFIXES: .c .o 28CC = cc 29CFLAGS = -g -O 30SHELL=/bin/sh 31 32# Add -DNO_RUSAGE to the CFLAGS assignment if your system 33# lacks getrusage(). This only matters for compiling xectim.c. 34 35# Add -DKR_headers to CFLAGS if your C compiler does not 36# understand ANSI C function headers, e.g. 37# CFLAGS = -O -DKR_headers 38# You may also need to add 39# strerror.c \ 40# to the "a =" assignment below (if you get an error message about 41# strerror not being found when you try to link a solver). 42# If things don't run right, you may need to change -O to -g 43# so you can poke around with a debugger. 44# You may also need to add -D_SIZE_T to CFLAGS, or to 45# comment out the definition of size_t in nlp.h . 46 47# For non-Solaris SunOS systems (i.e., for SunOS 4.x but not 5.x), try 48# CFLAGS = -O -DKR_headers -D_SIZE_T 49 50# For the DEC Alpha, try 51# CFLAGS = -O -ieee_with_no_inexact 52 53# For HP, try 54# CFLAGS = -O -Aa -Ae 55# or (if the compiler does not recognize -Aa for ANSI syntax) 56# CFLAGS = -O -DKR_headers 57 58# For IBM RS6000 machines, add 59# -qnomaf 60# to CFLAGS (to avoid surprises from fused mutiply-add instructions), 61# and for AIX versions less than 4.3, remove funcadd1.c from the "a =" 62# assignment below. 63 64# For some versions of MacOSX (e.g., 10.5), it is necessary to add 65# -D_NONSTD_SOURCE to CFLAGS (for reasons that perhaps Apple can explain): 66# CFLAGS = -O2 -D_NONSTD_SOURCE 67 68# For compilation by PGI's pgcc compiler, try using 69# CFLAGS = -fast -Kieee -DNO_fpu_control -pc 64 70 71# For Solaris on the i386 architecture, add fpsetprec.s to the "a =" 72# assignment below. For compilation with Sun's cc and -xarch=generic64 73# or -xarch=amd64, add fpsetprec64.s rather than fpsetprec.s to the "a =" 74# assignment. If you use gcc (try "cc --version" to see if cc is really gcc), 75# no changes to the "a =" assignment are needed. 76 77# For cygwin, change a.out to a.exe in the rule below for arith.h, and use 78# CC = gcc 79# CFLAGS = -O2 80 81# For MinGW, change a.out to a.exe in the rule below for arith.h, 82# change fpinit.c to fpinitmt.c in the "a =" list below, and use 83# CC = gcc 84# CFLAGS = -O2 -DNO_RUSAGE 85 86.c.o: 87 $(CC) -c $(CFLAGS) $*.c 88 89all: arith.h stdio1.h amplsolver.a funcadd0.o 90 91a = \ 92 asldate.c \ 93 atof.c \ 94 auxinfo.c \ 95 avltree.c \ 96 b_search.c \ 97 basename.c \ 98 bscanf.c \ 99 com2eval.c \ 100 comeval.c \ 101 con1ival.c \ 102 con2ival.c \ 103 con2val.c \ 104 conadj.c \ 105 conpval.c \ 106 conscale.c \ 107 conval.c \ 108 degree.c \ 109 derprop.c \ 110 details.c \ 111 dtoa1.c \ 112 duthes.c \ 113 dynlink.c \ 114 f_read.c \ 115 fg_read.c \ 116 fg_write.c \ 117 fgh_read.c \ 118 fpecatch.c \ 119 fpinit.c \ 120 fullhes.c \ 121 func_add.c \ 122 funcadd1.c \ 123 g_fmt.c \ 124 genrowno.c \ 125 getenv.c \ 126 getstub.c \ 127 htcl.c \ 128 indic_cons.c \ 129 jac0dim.c \ 130 jac2dim.c \ 131 jacdim.c \ 132 jacinc.c \ 133 jacinc1.c \ 134 libnamsave.c \ 135 mach.c \ 136 mainexit.c \ 137 mip_pri.c \ 138 misc.c \ 139 mpec_adj.c \ 140 mqpcheckv.c \ 141 mypow.c \ 142 names.c \ 143 nl_obj.c \ 144 nqpcheck.c \ 145 nqpcheckZ.c \ 146 obj2val.c \ 147 obj_adj.c \ 148 obj_prec.c \ 149 objconst.c \ 150 objval.c \ 151 objval_.c \ 152 op_type.c \ 153 pfg_read.c \ 154 pfghread.c \ 155 printf.c \ 156 pshvprod.c \ 157 punknown.c \ 158 qp_read.c \ 159 qpcheck.c \ 160 qpcheckZ.c \ 161 qsortv.c \ 162 readsol.c \ 163 repwhere.c \ 164 rops.c \ 165 rops2.c \ 166 sigcatch.c \ 167 sos_add.c \ 168 sphes.c \ 169 sscanf.c \ 170 stderr.c \ 171 studchk0.c \ 172 suf_sos.c \ 173 value.c \ 174 writesol.c \ 175 wrtsol_.c \ 176 ws_desc.c \ 177 wsu_desc.c \ 178 x2check.c \ 179 xectim.c \ 180 xp1known.c \ 181 xp2known.c 182 183ARFLAGS = ruv 184amplsolver.a: $a 185 $(CC) -c $(CFLAGS) $? 186 x=`echo $? | sed 's/\.[cs]/.o/g'` && ar $(ARFLAGS) amplsolver.a $$x && rm $$x 187 ranlib amplsolver.a || true 188# If your system lacks ranlib, add a dummy ranlib to your 189# search path, e.g. 190# exec true 191# or just comment out the ranlib invocation above. 192 193Aslh = arith.h asl.h funcadd.h stdio1.h 194auxinfo.o libnamsave.o: funcadd.h stdio1.h 195mach.o: arith.h 196avltree.o bscanf.o conscale.o derprop.o dynlink.o func_add.o\ 197 funcadd.o funcadd1.o funcaddk.o funcaddr.o funcadd0.o g_fmt.o\ 198 genrowno.o jac0dim.o jacdim.o jac2dim.o jacinc.o jacinc1.o\ 199 names.o obj_prec.o objval_.o sigcatch.o sjac0dim.o studchk0.o: $(Aslh) 200avltree.o: avltree.h 201repwhere.o: errchk.h $(Aslh) 202xp1known.o: asl_pfg.h psinfo.h nlp.h $(Aslh) 203duthes.o fullhes.o htcl.o sphes.o: asl_pfgh.h psinfo.h nlp2.h $(Aslh) 204getstub.o value.o writesol.o wrtsol_.o: getstub.h $(Aslh) 205com2eval.o con2ival.o con2val.o obj2val.o\ 206 x2check.o: jac2dim.h nlp2.h $(Aslh) 207conpval.o pshvprod.o xp2known.o:\ 208 jacpdim.h asl_pfgh.h psinfo.h nlp2.h $(Aslh) 209comeval.o con1ival.o conval.o degree.o mip_pri.o objval.o qpcheck.o\ 210 qpcheckZ.o readsol.o: nlp.h $(Aslh) 211indic_cons.o misc.o mpec_adj.o nl_obj.o obj_adj.o sos_add.o suf_sos.o:\ 212 nlp.h nlp2.h asl_pfg.h asl_pfgh.h psinfo.h $(Aslh) 213op_type.o: op_type.hd op_typeb.hd 214fgh_read.o: jac2dim.h opnos.hd op_type.hd dvalue.hd nlp2.h $(Aslh) 215rops.o: nlp.h errchk.h $(Aslh) 216rops2.o: nlp2.h errchk.h $(Aslh) 217conadj.o fg_write.o qp_read.o: nlp.h r_opn.hd $(Aslh) 218f_read.o fg_read.o: fg_read.c nlp.h r_opn.hd dvalue.hd $(Aslh) 219objconst.o: r_opn0.hd nlp.h nlp2.h asl_pfg.h asl_pfgh.h psinfo.h $(Aslh) 220pfg_read.o: asl_pfg.h r_opn0.hd dvalue.hd nlp.h psinfo.h $(Aslh) 221pfghread.o: pfg_read.c jacpdim.h asl_pfgh.h opnos.hd r_opn0.hd dvalue.hd\ 222 psinfo.h nlp2.h $(Aslh) 223nqpcheck.o nqpcheckZ.o: nlp.h r_qp.hd $(Aslh) 224printf.o punknown.o sscanf.o: stdio1.h 225dtoa1.o: dtoa.c arith.h stdio1.h 226nl_obj.o nqpcheck.o nqpcheckZ.o obj_adj.o objconst.o: obj_adj.h 227mqpcheckv.o: mqpcheckv.c avltree.h nlp.h obj_adj.h r_qp.hd 228 229# Use CFLAGS in compiling arithchk.c in case something in CFLAGS affects 230# the number of bits in integral data types. (It's probably best not to 231# add such options to CFLAGS.) 232 233arith.h: arithchk.c fpinit.c 234 $(CC) -c $(CFLAGS) -DASL_NO_FPINITMT fpinit.c 235 $(CC) $(CFLAGS) arithchk.c fpinit.o -lm ||\ 236 $(CC) -DNO_LONG_LONG $(CFLAGS) arithchk.c fpinit.o -lm ||\ 237 $(CC) -DNO_SSIZE_T $(CFLAGS) arithchk.c fpinit.o -lm ||\ 238 $(CC) -DNO_LONG_LONG -DNO_SSIZE_T $(CFLAGS) arithchk.c fpinit.o -lm 239 ./a.out >arith.h 240 rm -f a.out arithchk.o fpinit.o 241 242### Alternative to arithchk.c: copy arith.h0 to arith.h, then edit 243### arith.h to activate the appropriate #define line, as explained 244### in the comments at the top. For systems with IBM-mainframe 245### arithmetic, see README. You'll need to #define Arith_Kind_ASL 246### suitably. If "make arith.h" works, use the #define it gives 247### (and don't fool with arith.h0). Otherwise use 248### #define Arith_Kind_ASL 0 249 250# If compiling dtoa1.c reveals that your system lacks float.h, malloc.h 251# or memory.h, you could try 252# 253# make float.h 254# 255# make malloc.h 256# and/or 257# make memory.h 258# 259# as appropriate. 260 261# For possible use with nested parallel make invocations, make details.c 262# depend artifically on arith.h and stdio1.h, so the big amplsolver.a compile 263# will start only after arith.h and stdio1.h have been created. 264 265details.c: details.c0 arith.h stdio1.h 266 sed "s!System_details!`uname -sm`!" details.c0 >details.c 267 268float.h: float.h0 269 ln float.h0 float.h 270 271malloc.h: 272 echo 'extern char *malloc();' >malloc.h 273 274memory.h: 275 echo 'extern char *memcpy();' >memory.h 276 277stdio1.h: stdio1.h0 278 cat stdio1.h0 >stdio1.h 279 280### The rule above arranges for amplsolver.a to use printf, fprintf, 281### and sprintf (renamed Printf, Fprintf, and Sprintf) as described 282### in the comments at the start of printf.c, rather than the 283### system-supplied routines (whose sprintf has the wrong return 284### type and values on some systems). In your solver, say 285### #include "stdio1.h" rather than <stdio.h> for consistency 286### with amplsolver.a . To use the system-supplied printf (etc.), 287### say "make systemprintf", and change printf.c to sprintf.c 288### in the "a =" assignment above. 289 290systemprintf: 291 echo '#define NO_STDIO1' >stdio1.h 292 cat stdio1.h0 >>stdio1.h 293 294# "make xsum.out" to check for transmission errors. 295# This assumes you have the xsum program, whose source is 296# /netlib/f2c/src/xsum.c, e.g., 297# http://www.netlib.org/f2c/src/xsum.c 298# or 299# http://netlib.sandia.gov/f2c/src/xsum.c.gz 300 301xs0 = \ 302 README \ 303 README.f77 \ 304 amplsolv.lbc \ 305 amplsolv.sy \ 306 arith.ibm \ 307 arith.h0 \ 308 arith.h1 \ 309 arithchk.c \ 310 asl.h \ 311 asl_pfg.h \ 312 asl_pfgh.h \ 313 asldate.c \ 314 atof.c \ 315 auxinfo.c \ 316 avltree.c \ 317 avltree.h \ 318 b_search.c \ 319 basename.c \ 320 bscanf.c \ 321 com2eval.c \ 322 comeval.c \ 323 comptry.bat \ 324 con1ival.c \ 325 con2ival.c \ 326 con2val.c \ 327 conadj.c \ 328 configure \ 329 configurehere \ 330 conpval.c \ 331 conscale.c \ 332 conval.c \ 333 degree.c \ 334 derprop.c \ 335 details.c0 \ 336 dtoa.c \ 337 dtoa1.c \ 338 duthes.c \ 339 dvalue.hd \ 340 dynlink.c \ 341 errchk.h \ 342 f_read.c \ 343 fg_read.c \ 344 fg_write.c \ 345 fgh_read.c \ 346 float.h0 \ 347 fpecatch.c \ 348 fpinit.c \ 349 fpinitmt.c \ 350 fpsetprec.s \ 351 fpsetprec64.s \ 352 fullhes.c \ 353 func_add.c \ 354 funcadd.c \ 355 funcadd.h \ 356 funcadd0.c \ 357 funcadd1.c \ 358 funcaddk.c \ 359 funcaddr.c \ 360 g_fmt.c \ 361 genrowno.c \ 362 getenv.c \ 363 getstub.c \ 364 getstub.h \ 365 htcl.c \ 366 indic_cons.c \ 367 jac0dim.c \ 368 jac2dim.c \ 369 jac2dim.h \ 370 jacdim.c \ 371 jacinc.c \ 372 jacinc1.c \ 373 jacpdim.h \ 374 libnamsave.c \ 375 mach.c \ 376 mainexit.c \ 377 makefile.lc \ 378 makefile.sy \ 379 makefile.u \ 380 makefile.vc \ 381 makefile.wat \ 382 mip_pri.c \ 383 misc.c \ 384 mpec_adj.c \ 385 mpec_adj0.c \ 386 mqpcheckv.c \ 387 mypow.c \ 388 names.c \ 389 nl_obj.c \ 390 nlp.h \ 391 nlp2.h \ 392 nqpcheck.c \ 393 nqpcheckZ.c \ 394 obj2val.c \ 395 obj_adj.c \ 396 obj_adj.h \ 397 obj_adj0.c \ 398 obj_prec.c \ 399 objconst.c \ 400 objval.c \ 401 objval_.c \ 402 op_type.c \ 403 op_type.hd \ 404 op_typeb.hd \ 405 opcode.hd \ 406 opnos.hd \ 407 pfg_read.c \ 408 pfghread.c \ 409 printf.c \ 410 pshvprod.c \ 411 psinfo.h \ 412 punknown.c \ 413 qp_read.c \ 414 qpcheck.c \ 415 qpcheckZ.c \ 416 qsortv.c \ 417 r_op.hd \ 418 r_opn.hd \ 419 r_opn0.hd \ 420 r_qp.hd \ 421 readsol.c \ 422 repwhere.c \ 423 rnd_prod.s \ 424 rops.c \ 425 rops2.c \ 426 sigcatch.c \ 427 sjac0dim.c \ 428 sos_add.c \ 429 sphes.c \ 430 sprintf.c \ 431 sscanf.c \ 432 stderr.c \ 433 stdio1.h0 \ 434 strerror.c \ 435 studchk0.c \ 436 suf_sos.c \ 437 value.c \ 438 writesol.c \ 439 wrtsol_.c \ 440 ws_desc.c \ 441 wsu_desc.c \ 442 x2check.c \ 443 xectim.c \ 444 xp1known.c \ 445 xp2known.c 446 447xsum.out: xsum0.out $(xs0) 448 xsum $(xs0) >xsum1.out 449 cmp xsum0.out xsum1.out && mv xsum1.out xsum.out || diff xsum[01].out 450 451clean: 452 rm -f amplsolver.a *.o arith.h details.c float.h stdio1.h 453