File: Make_kernel

package info (click to toggle)
libtsp 2r8-1
  • links: PTS
  • area: non-free
  • in suites: slink
  • size: 4,908 kB
  • ctags: 1,409
  • sloc: ansic: 12,525; sh: 1,044; makefile: 164
file content (126 lines) | stat: -rw-r--r-- 2,233 bytes parent folder | download
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
#
#  Generic make commands (common part of other Make files)
#  For GNU make; will not work with most other make programs
#
#  Variables:  (examples for cc on SunOS5:
#    bindir		$(tspdir)/bin/sun5
#    includedir		$(tspdir)/include
#    LIB		$(tspdir)/lib/sun5/libtsp.a
#    CFLAGS		-xO4 -Xc -v
#    FFLAGS		-u -O
#    LDFLAGS		-s
#    LINTFLAGS		-u -x
#    COFLAGS		-M
#    LNSFLAGS		-f
#    COMPILER		cc
#    LOADLIBES		$(LIB) -lm
#    BINDIR		bin/sun5

# $Id: Make_kernel,v 1.3 1997/03/08 libtsp-V2R8 $

SHELL = /bin/sh

# Get the OS name
OS := $(shell /bin/uname -s)
ifeq ($(OS),SunOS)
  rev := $(shell /bin/uname -r | cut -c1)
  ifeq ($(rev),4)
    OS = SunOS4
  else
    ifeq ($(rev),5)
      OS = SunOS5
    endif
  endif
endif

ifeq ($(OS),SunOS5)
  BINDIR = bin/sun5
  LIBDIR = lib/sun5
else
  BINDIR = bin
  LIBDIR = lib
endif

# Set a default for exec_prefix
ifdef tspdir
  exec_prefix = $(tspdir)
else
  ifeq ($(OS),SunOS5)
    tspdir = /opt/local
  else
    tspdir = /usr/local
  endif
endif

libdir = $(exec_prefix)/$(LIBDIR)
bindir = $(exec_prefix)/$(BINDIR)
includedir = $(exec_prefix)/include
htmldir = $(exec_prefix)/html
mandir = $(exec_prefix)/man

# Determine which language will be used
LANG = C
ifeq (.f,$(findstring .f,$(SOURCES)))
  LANG = FORTRAN
endif
ifeq (.F,$(findstring .F,$(SOURCES)))
  LANG = FORTRAN
endif

# Set the default library name
ifeq ($(LANG),FORTRAN)
  DEF_LIBNAME = libuti
else
  ifeq ($(CC),CC)
    DEF_LIBNAME = libtspCC
  else
    ifeq ($(CC),gcc)
      DEF_LIBNAME = libtspgcc
    else
      DEF_LIBNAME = libtsp
    endif
  endif
endif

# Library name
ifndef LIBNAME
  LIBNAME = $(DEF_LIBNAME)
endif
LIB = $(addsuffix .a,$(addprefix $(libdir)/,$(LIBNAME)))

# Compile and link flags
ifndef CFLAGS
  ifeq ($(CC),gcc)
    CFLAGS = -O3 -Wall
  else
    ifeq ($(OS),SunOS5)
      CFLAGS = -xO4 -Xc -v
    else
      CFLAGS = -O2
    endif
  endif
endif
ifndef FFLAGS
  FFLAGS = -u -O
endif
ifndef LDFLAGS
  LDFLAGS = -s
endif
ifndef LINTFLAGS
  LINTFLAGS = -u -x
endif
ifndef COFLAGS
  COFLAGS = -M
endif

LNS = linksoft
LNSFLAGS = -f

# Choose which compiler to use
ifeq ($(LANG),FORTRAN)
  COMPILER = $(FC)
  LOADLIBES = $(LIB)
else
  COMPILER = $(CC)
  LOADLIBES = $(LIB) -lm
endif