File: Makefile.global

package info (click to toggle)
aolserver 3.4.2-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 22,692 kB
  • ctags: 33,612
  • sloc: ansic: 171,340; tcl: 10,218; sh: 3,821; cpp: 2,779; makefile: 2,041; yacc: 1,648; perl: 456; php: 13
file content (304 lines) | stat: -rw-r--r-- 6,542 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
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
#
# Makefile.global --
#
#      This is the common Makefile that contains all variables and
#      utilities used by AOLserver source code and modules.
#

#
# To build, type "gmake"
# To override the default compiler on SOME platforms, type:
# "gmake nativeme=1" or "gmake gccme=1".
# To use Purify, type "gmake nativeme=1 PURIFY=/path/to/purify/executable".
#

#
# Installation directories.
#
#PREFIX       =   /usr/local/aolserver
PREFIX       =   $(NSHOME)/debian/tmp/usr/lib/aolserver
INST         =   $(PREFIX)
INSTBIN      =   $(INST)/bin
INSTLIB      =   $(INST)/lib
INSTINC      =   $(INST)/include
INSTLOG      =   $(INST)/log
INSTMOD      =   $(INST)/modules
INSTTCL      =   $(INSTMOD)/tcl
INSTSRV      =   $(INST)/servers/server1
INSTSRVMOD   =   $(INSTSRV)/modules
INSTSRVPAG   =   $(INSTSRV)/pages


#
# Common build variables.
#
CC           =   gcc
LD           =   ld
LDSO	     =   $(CC) -shared -nostartfiles
#GCCOPTIMIZE  =   -O2
GCCOPTIMIZE  =   -g
GCCOPT       =   $(GCCOPTIMIZE) -fPIC -Wall -Wno-unused
CFLAGS       +=  -I$(NSHOME)/include -D_REENTRANT=1 -DNDEBUG=1
LIBNSTHREAD  =   $(NSHOME)/thread/libnsthread.a
LIBS         +=  
MKDIR        =   mkdir -p
RM           =   /bin/rm -f
CP           =   /bin/cp -fp
ECHO         =   /bin/echo
FIND         =   find
MV           =   /bin/mv
LN           =   ln -s
AR           =   ar
ARFLAGS      =   rv
RANLIB       =   true
RPATH = $(PREFIX)/lib:/usr/local/aolserver/lib:/opt/aolserver/lib:/usr/local/lib


#
# Figure the OS and architecture.
#
PLATFORM = unknown
PLAT     = $(shell uname -a)

#
# HP/UX
#
ifneq (,$(findstring HP-UX,$(PLAT)))
    PLATFORM=hp10

    ifndef gccme
        CC=$(PURIFY) cc
        CFLAGS+=-O2 -Ae +DAportable +z
    else
        CFLAGS+=$(GCCOPT) -mpa-risc-1-0
    endif

    LDSO=$(LD) -b
    NSDLIBS=-lm
    LDFLAGS=-Wl,-E
    LIBS+=-ldce -lc_r
    CFLAGS+=-D__hp10=1 -DHAVE_PTHREAD_D4=1 -DUSE_DLSHL=1 -DNEED_HERRNO=1
endif


#
# Linux
#
ifneq (,$(findstring Linux,$(PLAT)))
    PLATFORM=linux
    LDFLAGS+=-Wl,-E

    CFLAGS+=$(GCCOPT)
    ifneq (,$(findstring arm,$(PLAT)))
		CFLAGS+= -mcpu=arm3
    else
		ifneq (,$(findstring 680,$(PLAT)))
	    	CFLAGS+= -m68020-40
		endif
    endif

    NSDLIBS=-lm
    LIBS+=-ldl -lpthread 
    CFLAGS+=-DHAVE_CMMSG=1 -DUSE_FIONREAD=1 -DHAVE_COND_EINTR=1
endif


#
# Solaris
#
#    Note: Purify works only on Solaris 7 SPARC with SUNWspro or gcc-2.8.1.
#
ifneq (,$(findstring SunOS,$(PLAT)))
    PLATFORM=solaris

    ifdef nativeme
        CC=$(PURIFY) /opt/SUNWspro/bin/cc
        #CCOPTIMIZE = -x02
        CCOPTIMIZE = -g
        CFLAGS+=$(CCOPTIMIZE) -KPIC -erroff=%none
        LD=/usr/ccs/bin/ld
        LDSO=$(LD) -G
        ifneq (,$(findstring sparc,$(PLAT)))
            CFLAGS+=-xarch=v8plusa
        else
            CFLAGS+=-xpentium
        endif
    else
        ifneq (,$(findstring sparc,$(PLAT)))
            CFLAGS+=$(GCCOPT) -mcpu=ultrasparc
        else
            CFLAGS+=$(GCCOPT) -mcpu=pentium
        endif
    endif

    NSDLIBS=-lm
    LIBS+=-lsocket -lnsl -ldl -lposix4 -lthread -lresolv -R $(RPATH)
    AR=/usr/ccs/bin/ar
    CFLAGS+=-D_POSIX_PTHREAD_SEMANTICS=1 -DUSE_PTHREAD_SYSSCOPE=1 \
            -DUSE_PTHREAD_PSHARED=1 -DHAVE_ETIME_BUG=1 \
            -DUSE_DUPHIGH=1 -DHAVE_FORK1=1
endif


#
# DEC OSF/1, Digital UNIX, Tru64 UNIX
#
ifneq (,$(findstring OSF1,$(PLAT)))
    PLATFORM=osf
    CC=$(PURIFY) cc
    CFLAGS+=$(GCCOPT) -std1 -pthread
    LDFLAGS+=-pthread
    LDSO=$(LD) -shared -expect_unresolved '*'
    NSDLIBS=-lm
    LIBS+=-lrt
endif


#
# SGI Irix
#
ifneq (,$(findstring IRIX,$(PLAT)))
    PLATFORM=irix

    ## Purify seems to work on Irix o32 only.
    ifndef gccme
        ABI=o32
        CC=$(PURIFY) cc
        ##CCOPTIMIZE = -g3 -O2
        CCOPTIMIZE = -g
        CFLAGS  += $(CCOPTIMIZE) -$(ABI) -KPIC -fullwarn -DUSE_DUPHIGH=1
    else
        ABI=n32
        CFLAGS+=$(GCCOPT) -mcpu=mips
    endif

    LDFLAGS += -$(ABI)
    LDSO=$(LD) -$(ABI) -shared
    NSDLIBS=-lm
    CFLAGS+=-DUSE_SPROC=1 -D_SGI_MP_SOURCE=1 -DNO_VSNPRINTF

endif


#
# FreeBSD
#
ifneq (,$(findstring FreeBSD,$(PLAT)))
    PLATFORM=freebsd
    CFLAGS+=$(GCCOPT) -pthread

    ## FreeBSD doesn't make a distinction among processors in the x86 class.
    ifneq (,$(findstring i386,$(PLAT)))
        CFLAGS+=-mcpu=pentium
    endif

    LDFLAGS+=-pthread -Wl,-E
    RANLIB=ranlib
    CFLAGS+=-D_THREAD_SAFE=1 -DHAVE_CMMSG=1 -DNO_TIMEZONE=1 -DHAVE_TIMEGM=1
    NSDLIBS=-lm
endif


#
# OpenBSD
#
ifneq (,$(findstring OpenBSD,$(PLAT)))
    PLATFORM=openbsd
    CFLAGS+=$(GCCOPT) -pthread

    ## OpenBSD doesn't make a distinction among processors in the x86 class.
    ifneq (,$(findstring i386,$(PLAT)))
        CFLAGS+=-mcpu=pentium
    endif

    LDFLAGS+=-pthread -Wl
    RANLIB=ranlib
    CFLAGS+=-DHAVE_CMMSG=1 -DUSE_DLSYMPREFIX=1 -DUSE_RTLD_LAZY=1 \
           -DNO_TIMEZONE=1 -DHAVE_TIMEGM=1 -D_THREAD_SAFE=1
    NSDLIBS=-lm
endif


#
# SCO Unixware
#
ifneq (,$(findstring UnixWare,$(PLAT)))
    PLATFORM=unixware
    CC=cc
    CFLAGS+=-O2 -Kpic -Kthread -D__unixware
    LDFLAGS=-Wl,-B export
    LDSO=$(LD) -G
    LIBS+=-Kthread -lsocket
    NSDLIBS=-lm
    CLFAGS+=-DUSE_PTHREAD_SYSSCOPE=1 -DHAVE_SENDV=1 -DHAVE_CMMSG=1
endif


#
# Mac OS X
#
ifneq (,$(findstring Rhapsody,$(PLAT)))
    PLATFORM=osx
endif
ifneq (,$(findstring Darwin,$(PLAT)))
    PLATFORM=osx
endif
ifeq (osx,$(PLATFORM))
    CC=cc
    LD=cc
    CFLAGS+=$(GCCOPT) -dynamic -traditional-cpp
    LDSO=$(LD) -bundle -undefined suppress
    RANLIB=ranlib
    NSDLIBS=
    CFLAGS+=-DHAVE_CMMSG=1 -DUSE_DYLD=1 -DUSE_DLSYMPREFIX=1 \
            -DNO_RAND48=1 -DNO_TIMEZONE=1 -DMACOSX=1
endif

ifeq (unknown,$(PLATFORM))
    error unknown platform
endif

#
# Set the names of the Tcl libraries
#
#    Note:  Tcl 7.6 on *BSD has a different name for no apparent reason.
#
TCL8X_DIR=tcl8.3.2
TCL76_DIR=tcl7.6
ifeq (bsd, $(findstring bsd, $(PLATFORM)))
  TCL76_LIB=libtcl76.a
  TCL8X_LIB=libtcl83g.a
else
  TCL76_LIB=libtcl7.6.a
  TCL8X_LIB=libtcl8.3g.a
endif

LIBTCL76=$(NSHOME)/$(TCL76_DIR)/unix/$(TCL76_LIB)
LIBTCL8X=$(NSHOME)/$(TCL8X_DIR)/unix/$(TCL8X_LIB)

#
# Rules for library dependencies.
#

all:

libnspd:
	(cd $(NSHOME)/nspd && $(MAKE) all)

libtcl76:
	(cd $(NSHOME)/$(TCL76_DIR) && $(MAKE) all)

libtcl76-clean:
	(cd $(NSHOME)/$(TCL76_DIR) && $(MAKE) clean)

libtcl8x:
	(cd $(NSHOME)/$(TCL8X_DIR) && $(MAKE) all)

libtcl8x-clean:
	(cd $(NSHOME)/$(TCL8X_DIR) && $(MAKE) clean)

libnsthread:
	(cd $(NSHOME)/thread && $(MAKE) all)

libnsthread-clean:
	(cd $(NSHOME)/thread && $(MAKE) clean)