File: commondefs

package info (click to toggle)
khronos-opengl-man4 1.0~svn31251-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,368 kB
  • ctags: 267
  • sloc: xml: 93,382; makefile: 730; python: 627; sh: 50; php: 4
file content (407 lines) | stat: -rw-r--r-- 10,926 bytes parent folder | download | duplicates (10)
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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
# Copyright (c) 1991-2000 Silicon Graphics, Inc.
# This document is licensed under the SGI Free Software B license.
# For details, see
#
# http://oss.sgi.com/projects/FreeB
#
# $Date$ $Revision$
# $Header: //depot/main/tools/include/commondefs#43 $

COMMONRULES=$(ROOT)/usr/include/make/commonrules

# what OS are we running on
OS=$(shell uname)
ifeq ($(subst 64,,$(OS)), IRIX)
OS=IRIX
endif
ifeq (CYGWIN,$(findstring CYGWIN,$(OS)))
OS=Linux
endif

# various source-level directories
TOOLSSRC = $(TOPDIR)/tools
GFXINCLUDESRC = $(TOPDIR)/gfx/include
OGLLIBSRC = $(TOPDIR)/gfx/lib/opengl
GLXLIBSRC = $(TOPDIR)/glx

# SGI Free Software B license
OSSCOPYRIGHT = $(TOPDIR)/doc/release/OSSCOPYRIGHT

# shell-related defs
SHELL	= /bin/sh
AWK	= awk
ifeq ($(OS),IRIX)
ECHO	= /bin/echo
endif
ifeq ($(OS),Linux)
ECHO	= /bin/echo -e
endif
RM	= rm -f
MV	= mv
PERL	= perl
SED	= sed
UNIQ	= uniq

# M4 options - run GNU M4 in compatibility mode
# rdist options - Red Hat 5.2 must have daemon location specified
ifeq ($(OS),IRIX)
M4OPTS	=
endif
ifeq ($(OS),Linux)
M4OPTS	= -G
RDIST_OPTS = -p /usr/sbin/rdistd
endif

# override default gmake CXX with what we have
ifeq ($(OS),IRIX)
CXX	= CC
endif

# what language are we using?  Default to ansi with extended defines
ifeq ($(OS),IRIX)
CVERSION = -xansi
endif
ifeq ($(OS),Linux)
CVERSION= -ansi -include $(ROOT)/usr/include/make/linuxdefs
endif

# WARN is the warning option
ifeq ($(OS),IRIX)
#
# Turn of explicitly some warnings on IRIX.  Specifically:
#	1155:	unrecognized #pragma
#	1174:	parameter/variable "???" was declared but never referenced
#	1201:	trailing comma is nonstandard (last element in struct assnment)
#	1209:	controlling expression is constant
#	1506:	implicit conversion from "???" to "???": rounding, sign
#		extension, or loss of accuracy may result
#	3170:	"???" not marked as intrinsic because it is not declared
#		as a function
#
WARN = -fullwarn \
	-woff 1155,1174,1506,1201,1209,3170
endif
ifeq ($(OS),Linux)
WARN = -Wimplicit \
	-Wreturn-type \
	-Wswitch \
	-Wcomment \
	-Wformat \
	-Wchar-subscripts \
	-Wparentheses \
	-Wpointer-arith \
	-Wcast-qual \
	-Wmissing-prototypes \
	-Wmissing-declarations \
	$(NULL)
endif

# default optimization
ifeq ($(subst y,1,$(GLDEBUG)),1)
OPTIMIZER=-g
else
OPTIMIZER=-O2
ifeq ($(OS),Linux)
WARN += -Wuninitialized
endif
endif

# how to make dependencies
ifeq ($(OS),IRIX)
MKDEPOPT = -MDupdate Makedepend
endif
ifeq ($(OS),Linux)
MKDEPOPT = -MD
endif

override GCOPTS = $(OPTIMIZER) $(MKDEPOPT) $(WARN)
override GCXXOPTS = $(OPTIMIZER) $(MKDEPOPT) $(WARN)

# where is the default include directory?
#  (we don't grab it off $ROOT, to avoid populating $ROOT with system
#  includes.  Yes, I know...  You don't like the idea.
INCLDIR = /usr/include

# where to install include files?
INCLUDE_LOCATION = $(ROOT)/usr/include

# we would like to use nostdinc on Linux, but unfortunately, it also
# removes include directories with no well-known fixed path (ie. the
# gcc install directory).
ifeq ($(OS),IRIX)
override GCINCS = -nostdinc -I$(ROOT)$(INCLDIR) -I$(INCLDIR)
override GCXXINCS = -nostdinc -I$(ROOT)$(INCLDIR) -I$(INCLDIR)
endif
ifeq ($(OS),Linux)
override GCINCS = -I$(ROOT)$(INCLDIR)
override GCXXINCS = -I$(ROOT)$(INCLDIR) -I$(INCLDIR)
endif

ifeq ($(GLDEBUG),1)
override GCDEFS = -DDEBUG -UNDEBUG
override GCXXDEFS = -DDEBUG -UNDEBUG
else
override GCDEFS = -UDEBUG -DNDEBUG
override GCXXDEFS = -UDEBUG -DNDEBUG
endif

#
# Cc flags, composed of:
#	variable (V*) (set on the command line)
#	local (L*) (set in the makefile)
#	global (G*) (defined in this file, not overrideable)
# in that order.  This is done so that the locally defined includes
# are searched before the globally defined ones.
#
CFLAGS	= $(CVERSION) $(VCFLAGS) $(LCFLAGS) $(GCFLAGS)

#
# Each of these three components is divided into defines (-D's and -U's),
# includes (-I's), and other options.  By segregating the different
# classes of flag to cc, the defines (CDEFS) and includes (CINCS) can be
# easily given to other programs, e.g., lint.
#
# Notes:
#   - The local assignments should be to LCOPTS, LCDEFS, and LCINCS, not to
#     LCFLAGS, although CFLAGS will be correctly set if this is done.
#   - If a program cannot be optimized, it should override the setting of
#     OPTIMIZER with a line such as "OPTIMIZER=" in its make file.
#   - If a program cannot be compiled with ANSI C, its makefile
#     should set CVERSION=-cckr
#
VCFLAGS = $(VCDEFS) $(VCINCS) $(VCOPTS)
LCFLAGS = $(LCDEFS) $(LCINCS) $(LCOPTS)
GCFLAGS = $(GCDEFS) $(GCINCS) $(GCOPTS)

COPTS	= $(VCOPTS) $(LCOPTS) $(GCOPTS)
CDEFS	= $(VCDEFS) $(LCDEFS) $(GCDEFS)
CINCS	= $(VCINCS) $(LCINCS) $(GCINCS)

#
# CXX flags are decomposed using the same hierarchy as C flags.
#
CXXFLAGS  = $(CVERSION) $(VCXXFLAGS) $(LCXXFLAGS) $(GCXXFLAGS)

VCXXFLAGS = $(VCXXDEFS) $(VCXXINCS) $(VCXXOPTS)
LCXXFLAGS = $(LCXXDEFS) $(LCXXINCS) $(LCXXOPTS)
GCXXFLAGS = $(GCXXDEFS) $(GCXXINCS) $(GCXXOPTS)

CXXOPTS   = $(VCXXOPTS) $(LCXXOPTS) $(GCXXOPTS)
CXXDEFS   = $(VCXXDEFS) $(LCXXDEFS) $(GCXXDEFS)
CXXINCS   = $(VCXXINCS) $(LCXXINCS) $(GCXXINCS)

#
# Do something for the linker
#
#
# Library paths (-L's) are part of LDOPTS.
# Libraries (-l's) are part of LDLIBS.
# This is done so that there is a guarantee that all library paths are
# included before the libraries.
#
override GLDOPTS=
override GLDDSOOPTS=
ifeq ($(OS),IRIX)
override GLDOPTS += -L$(ROOT)/usr/lib32
override GLDDSOOPTS += -L$(ROOT)/usr/lib32
endif
ifeq ($(OS),Linux)
override GLDOPTS += -L$(ROOT)/usr/lib -L$(XTOPDIR)/xc/exports/lib
override GLDDSOOPTS += -L$(ROOT)/usr/lib -L$(XTOPDIR)/xc/exports/lib
endif

# options used for DSO's.
ifeq ($(OS),IRIX)
DSONAMEOPT = -soname $(DSONAME)
ifneq ($(DSOEXPORTS),)
DSOEXPORTSOPT = -exports_file $(DSOEXPORTS)
endif
override GLDDSOOPTS += -elf -shared -all $(DSOEXPORTSOPT) $(DSONAMEOPT)
endif

ifeq ($(OS),Linux)
DSONAMEOPT = -soname=$(DSONAME)
ifneq ($(DSOEXPORTS),)
DSOEXPORTSOPT = $(addprefix -u ,$(shell cat $(DSOEXPORTS)))
else
DSOEXPORTSOPT = --whole-archive
endif
override GLDDSOOPTS += -shared $(DSOEXPORTSOPT) $(DSONAMEOPT)
endif

LDDSOOPTS  = $(VLDDSOOPTS) $(LLDDSOOPTS) $(GLDDSOOPTS)
LDDSOLIBS  = $(VLDDSOLIBS) $(LLDDSOLIBS) $(GLDDSOLIBS)
LDDSOFLAGS = $(LDDSOOPTS) $(LDDSOLIBS) $(ENDIAN)

LDOPTS	= $(VLDOPTS) $(LLDOPTS) $(GLDOPTS)
LDLIBS	= $(VLDLIBS) $(LLDLIBS) $(GLDLIBS)
LDFLAGS = $(LDOPTS) $(LDLIBS) $(ENDIAN)

# where to install libraries
ifeq ($(OS),IRIX)
OBJECT_STYLE = N32
LIB_LOCATION = $(ROOT)/usr/lib32
endif
ifeq ($(OS),Linux)
LIB_LOCATION = $(ROOT)/usr/lib
endif

#
# as flags are just like cc flags.
# By default, ASTYLE is the same as CSTYLE, but some may need to make
# the asm more aggressive than 'C' and can set ASTYLE. Users of 'make'
# always get ASTYLE == CSTYLE
#
ASFLAGS = $(VASFLAGS) $(LASFLAGS) $(GASFLAGS)

VASFLAGS = $(VASDEFS) $(VASINCS) $(VASOPTS)
LASFLAGS = $(LASDEFS) $(LASINCS) $(LASOPTS)
GASFLAGS = $(GASDEFS) $(GASINCS) $(GASOPTS)

ASOPTS	= $(VASOPTS) $(LASOPTS) $(GASOPTS)
ASDEFS	= $(VASDEFS) $(LASDEFS) $(GASDEFS)
ASINCS	= $(VASINCS) $(LASINCS) $(GASINCS)

override GASOPTS = $(OPTIMIZER) $(MKDEPOPT)
override GASDEFS = $(GCDEFS)
override GASINCS = $(GCINCS)

#
# the install command to use
#
INSTALL = $(ROOT)/usr/bin/gfxinstall
INSTALLFLAGS = -v -m 0444

#
# Convenient command macros that include the flags macros.
#
# You should always invoke make in makefiles via $(MAKE), as make passes
# all command-line variables through the environment to sub-makes.
#
# Never use just $(CCF), etc. in rules that link executables; LDFLAGS
# needs to be included after your objects in the command line.
#
ASF	= $(AS) $(ASFLAGS)
CXXF	= $(CXX) $(CXXFLAGS)
C++F	= $(CXXF)
CCF	= $(CC) $(CFLAGS)
LDF	= $(LD) $(LDFLAGS)
LEXF	= $(LEX) $(LFLAGS)
YACCF	= $(YACC) $(YFLAGS)

# Targets

COMMONTARGS = clobber clean rmtargets

ALLTARGS = headers headers_install libs libs_install install apps distsi \
	   $(COMMONTARGS)

#
# Rule macros for nonterminal makefiles that iterate over subdirectories,
# making the current target.  Set *SUBDIRS to the relevant list of kids.
#
# Set NOSUBMESG to any value to suppress a warning that subdirectories
# are not present. This is useful with mandefs/rules
#
SUBDIR_MAKERULE= \
	if test ! -d $$d; then \
		if test "$(NOSUBMESG)" = "" ; then \
			echo "SKIPPING $$d: No such directory."; \
		fi \
	else \
		$(ECHO) "\t$(MAKE) -C $$d $${RULE:=$@}"; \
		$(MAKE) -C $$d $${RULE:=$@}; \
	fi

SUBDIRS_MAKERULE= \
	+@for d in $(SUBDIRS); do $(SUBDIR_MAKERULE); done

#
# One problem with the above rules is that if a make fails, and -k is
# set, the entire for loop might stop. This is because make still can
# (and XPG requires it) exit with an error status if the -k option is set.
# This is an alternate rule for SUBDIRS when it is desired that -k keep
# working on the next SUBDIR if the previous one failed. Its not quite
# as compact a rule as the previous ones.
# A standard usage would be:
#	default install $(COMMONTARGS): $(_FORCE)
#		$(MAKE) __DORULE=$@ $(SUBDIRS)
#	$(SUBDIRS): $(_FORCE)
#		@$(NSUBDIR_MAKERULE)

NSUBDIR_MAKERULE= \
	if test ! -d $@; then \
		if test "$(NOSUBMESG)" = "" ; then \
			echo "SKIPPING $@: No such directory."; \
		fi \
	else \
		echo "\t(cd $@; $(MAKE) $(__DORULE))"; \
		(cd $@; ${MAKE} $(__DORULE)); \
	fi

#
# Convenience file list macros:
#	- Commondefs defines the following lists: SOURCES, enumerating all
#	  source files; OBJECTS, the .o files derived from compilable source;
#	  and DIRT, which lists intermediates and temporary files to be
#	  removed by clean.
#	- The including (parent) makefile may define source file lists for
#	  the standard suffixes: CFILES for .c, ASFILES for .s, YFILES for
#	  .y, etc.  We combine all such lists into SOURCES.  The including
#	  makefile need not define CFILES &c before including commondefs.
#
SOURCES=$(HFILES) $(ASFILES) $(CCFILES) $(C++FILES) $(CXXFILES) $(CFILES) \
	$(EFILES) $(FFILES) $(LFILES) $(PFILES) $(RFILES) $(SHFILES) $(YFILES)

CXXO1=$(CXXFILES:.c++=.o) $(C++FILES:.c++=.o) $(CCFILES:.c++=.o)
CXXO2=$(CXXO1:.cxx=.o)
CXXO3=$(CXXO2:.C=.o)
CXXO4=$(CXXO3:.cc=.o)
CXXOALL=$(CXXO4)
YO1=$(YFILES:.y=.o)
YO2=$(YO1:.yxx=.o)
YO3=$(YO2:.Y=.o)
YOALL=$(YO3)
LO1=$(LFILES:.l=.o)
LO2=$(LO1:.lxx=.o)
LO3=$(LO2:.L=.o)
LOALL=$(LO3)
OBJECTS=$(ASFILES:.s=.o) $(CXXOALL) $(CFILES:.c=.o) $(EFILES:.e=.o) \
	$(FFILES:.f=.o) $(LOALL) $(PFILES:.p=.o) $(RFILES:.r=.o) \
	$(YOALL)

#
# dependency file(s)
#
ifeq ($(OS),IRIX)
MKDEPFILE = Makedepend
endif
ifeq ($(OS),Linux)
MKDEPFILE = $(OBJECTS:.o=.d)
endif

#
# distribution file
#
DISTFILE_EXT = Distfile
DISTFILE_INT = Distfile.int
ifeq ($(OS),IRIX)
DISTFILE = $(DISTFILE_EXT)
else
ifeq ($(OS),Linux)
DISTFILE = $(DISTFILE_EXT)
else
DISTFILE = $(DISTFILE_EXT) $(DISTFILE_INT)
endif
endif

#
# dirt stuff
#
DIRT=$(GDIRT) $(VDIRT) $(LDIRT)
override GDIRT=*.o a.out core lex.yy.[co] y.tab.[cho] ar.tmp.* so_locations

LOCALDEFS	= ./localdefs
LOCALRULES	= ./localrules

-include $(LOCALDEFS)