rename upstream-man-pages to upstream-doc
[clinton/guile-figl.git] / upstream-doc / man4 / usr / include / make / commondefs
CommitLineData
7faf1d71
AW
1# Copyright (c) 1991-2000 Silicon Graphics, Inc.
2# This document is licensed under the SGI Free Software B license.
3# For details, see
4#
5# http://oss.sgi.com/projects/FreeB
6#
7# $Date$ $Revision$
8# $Header: //depot/main/tools/include/commondefs#43 $
9
10COMMONRULES=$(ROOT)/usr/include/make/commonrules
11
12# what OS are we running on
13OS=$(shell uname)
14ifeq ($(subst 64,,$(OS)), IRIX)
15OS=IRIX
16endif
17ifeq (CYGWIN,$(findstring CYGWIN,$(OS)))
18OS=Linux
19endif
20
21# various source-level directories
22TOOLSSRC = $(TOPDIR)/tools
23GFXINCLUDESRC = $(TOPDIR)/gfx/include
24OGLLIBSRC = $(TOPDIR)/gfx/lib/opengl
25GLXLIBSRC = $(TOPDIR)/glx
26
27# SGI Free Software B license
28OSSCOPYRIGHT = $(TOPDIR)/doc/release/OSSCOPYRIGHT
29
30# shell-related defs
31SHELL = /bin/sh
32AWK = awk
33ifeq ($(OS),IRIX)
34ECHO = /bin/echo
35endif
36ifeq ($(OS),Linux)
37ECHO = /bin/echo -e
38endif
39RM = rm -f
40MV = mv
41PERL = perl
42SED = sed
43UNIQ = uniq
44
45# M4 options - run GNU M4 in compatibility mode
46# rdist options - Red Hat 5.2 must have daemon location specified
47ifeq ($(OS),IRIX)
48M4OPTS =
49endif
50ifeq ($(OS),Linux)
51M4OPTS = -G
52RDIST_OPTS = -p /usr/sbin/rdistd
53endif
54
55# override default gmake CXX with what we have
56ifeq ($(OS),IRIX)
57CXX = CC
58endif
59
60# what language are we using? Default to ansi with extended defines
61ifeq ($(OS),IRIX)
62CVERSION = -xansi
63endif
64ifeq ($(OS),Linux)
65CVERSION= -ansi -include $(ROOT)/usr/include/make/linuxdefs
66endif
67
68# WARN is the warning option
69ifeq ($(OS),IRIX)
70#
71# Turn of explicitly some warnings on IRIX. Specifically:
72# 1155: unrecognized #pragma
73# 1174: parameter/variable "???" was declared but never referenced
74# 1201: trailing comma is nonstandard (last element in struct assnment)
75# 1209: controlling expression is constant
76# 1506: implicit conversion from "???" to "???": rounding, sign
77# extension, or loss of accuracy may result
78# 3170: "???" not marked as intrinsic because it is not declared
79# as a function
80#
81WARN = -fullwarn \
82 -woff 1155,1174,1506,1201,1209,3170
83endif
84ifeq ($(OS),Linux)
85WARN = -Wimplicit \
86 -Wreturn-type \
87 -Wswitch \
88 -Wcomment \
89 -Wformat \
90 -Wchar-subscripts \
91 -Wparentheses \
92 -Wpointer-arith \
93 -Wcast-qual \
94 -Wmissing-prototypes \
95 -Wmissing-declarations \
96 $(NULL)
97endif
98
99# default optimization
100ifeq ($(subst y,1,$(GLDEBUG)),1)
101OPTIMIZER=-g
102else
103OPTIMIZER=-O2
104ifeq ($(OS),Linux)
105WARN += -Wuninitialized
106endif
107endif
108
109# how to make dependencies
110ifeq ($(OS),IRIX)
111MKDEPOPT = -MDupdate Makedepend
112endif
113ifeq ($(OS),Linux)
114MKDEPOPT = -MD
115endif
116
117override GCOPTS = $(OPTIMIZER) $(MKDEPOPT) $(WARN)
118override GCXXOPTS = $(OPTIMIZER) $(MKDEPOPT) $(WARN)
119
120# where is the default include directory?
121# (we don't grab it off $ROOT, to avoid populating $ROOT with system
122# includes. Yes, I know... You don't like the idea.
123INCLDIR = /usr/include
124
125# where to install include files?
126INCLUDE_LOCATION = $(ROOT)/usr/include
127
128# we would like to use nostdinc on Linux, but unfortunately, it also
129# removes include directories with no well-known fixed path (ie. the
130# gcc install directory).
131ifeq ($(OS),IRIX)
132override GCINCS = -nostdinc -I$(ROOT)$(INCLDIR) -I$(INCLDIR)
133override GCXXINCS = -nostdinc -I$(ROOT)$(INCLDIR) -I$(INCLDIR)
134endif
135ifeq ($(OS),Linux)
136override GCINCS = -I$(ROOT)$(INCLDIR)
137override GCXXINCS = -I$(ROOT)$(INCLDIR) -I$(INCLDIR)
138endif
139
140ifeq ($(GLDEBUG),1)
141override GCDEFS = -DDEBUG -UNDEBUG
142override GCXXDEFS = -DDEBUG -UNDEBUG
143else
144override GCDEFS = -UDEBUG -DNDEBUG
145override GCXXDEFS = -UDEBUG -DNDEBUG
146endif
147
148#
149# Cc flags, composed of:
150# variable (V*) (set on the command line)
151# local (L*) (set in the makefile)
152# global (G*) (defined in this file, not overrideable)
153# in that order. This is done so that the locally defined includes
154# are searched before the globally defined ones.
155#
156CFLAGS = $(CVERSION) $(VCFLAGS) $(LCFLAGS) $(GCFLAGS)
157
158#
159# Each of these three components is divided into defines (-D's and -U's),
160# includes (-I's), and other options. By segregating the different
161# classes of flag to cc, the defines (CDEFS) and includes (CINCS) can be
162# easily given to other programs, e.g., lint.
163#
164# Notes:
165# - The local assignments should be to LCOPTS, LCDEFS, and LCINCS, not to
166# LCFLAGS, although CFLAGS will be correctly set if this is done.
167# - If a program cannot be optimized, it should override the setting of
168# OPTIMIZER with a line such as "OPTIMIZER=" in its make file.
169# - If a program cannot be compiled with ANSI C, its makefile
170# should set CVERSION=-cckr
171#
172VCFLAGS = $(VCDEFS) $(VCINCS) $(VCOPTS)
173LCFLAGS = $(LCDEFS) $(LCINCS) $(LCOPTS)
174GCFLAGS = $(GCDEFS) $(GCINCS) $(GCOPTS)
175
176COPTS = $(VCOPTS) $(LCOPTS) $(GCOPTS)
177CDEFS = $(VCDEFS) $(LCDEFS) $(GCDEFS)
178CINCS = $(VCINCS) $(LCINCS) $(GCINCS)
179
180#
181# CXX flags are decomposed using the same hierarchy as C flags.
182#
183CXXFLAGS = $(CVERSION) $(VCXXFLAGS) $(LCXXFLAGS) $(GCXXFLAGS)
184
185VCXXFLAGS = $(VCXXDEFS) $(VCXXINCS) $(VCXXOPTS)
186LCXXFLAGS = $(LCXXDEFS) $(LCXXINCS) $(LCXXOPTS)
187GCXXFLAGS = $(GCXXDEFS) $(GCXXINCS) $(GCXXOPTS)
188
189CXXOPTS = $(VCXXOPTS) $(LCXXOPTS) $(GCXXOPTS)
190CXXDEFS = $(VCXXDEFS) $(LCXXDEFS) $(GCXXDEFS)
191CXXINCS = $(VCXXINCS) $(LCXXINCS) $(GCXXINCS)
192
193#
194# Do something for the linker
195#
196#
197# Library paths (-L's) are part of LDOPTS.
198# Libraries (-l's) are part of LDLIBS.
199# This is done so that there is a guarantee that all library paths are
200# included before the libraries.
201#
202override GLDOPTS=
203override GLDDSOOPTS=
204ifeq ($(OS),IRIX)
205override GLDOPTS += -L$(ROOT)/usr/lib32
206override GLDDSOOPTS += -L$(ROOT)/usr/lib32
207endif
208ifeq ($(OS),Linux)
209override GLDOPTS += -L$(ROOT)/usr/lib -L$(XTOPDIR)/xc/exports/lib
210override GLDDSOOPTS += -L$(ROOT)/usr/lib -L$(XTOPDIR)/xc/exports/lib
211endif
212
213# options used for DSO's.
214ifeq ($(OS),IRIX)
215DSONAMEOPT = -soname $(DSONAME)
216ifneq ($(DSOEXPORTS),)
217DSOEXPORTSOPT = -exports_file $(DSOEXPORTS)
218endif
219override GLDDSOOPTS += -elf -shared -all $(DSOEXPORTSOPT) $(DSONAMEOPT)
220endif
221
222ifeq ($(OS),Linux)
223DSONAMEOPT = -soname=$(DSONAME)
224ifneq ($(DSOEXPORTS),)
225DSOEXPORTSOPT = $(addprefix -u ,$(shell cat $(DSOEXPORTS)))
226else
227DSOEXPORTSOPT = --whole-archive
228endif
229override GLDDSOOPTS += -shared $(DSOEXPORTSOPT) $(DSONAMEOPT)
230endif
231
232LDDSOOPTS = $(VLDDSOOPTS) $(LLDDSOOPTS) $(GLDDSOOPTS)
233LDDSOLIBS = $(VLDDSOLIBS) $(LLDDSOLIBS) $(GLDDSOLIBS)
234LDDSOFLAGS = $(LDDSOOPTS) $(LDDSOLIBS) $(ENDIAN)
235
236LDOPTS = $(VLDOPTS) $(LLDOPTS) $(GLDOPTS)
237LDLIBS = $(VLDLIBS) $(LLDLIBS) $(GLDLIBS)
238LDFLAGS = $(LDOPTS) $(LDLIBS) $(ENDIAN)
239
240# where to install libraries
241ifeq ($(OS),IRIX)
242OBJECT_STYLE = N32
243LIB_LOCATION = $(ROOT)/usr/lib32
244endif
245ifeq ($(OS),Linux)
246LIB_LOCATION = $(ROOT)/usr/lib
247endif
248
249#
250# as flags are just like cc flags.
251# By default, ASTYLE is the same as CSTYLE, but some may need to make
252# the asm more aggressive than 'C' and can set ASTYLE. Users of 'make'
253# always get ASTYLE == CSTYLE
254#
255ASFLAGS = $(VASFLAGS) $(LASFLAGS) $(GASFLAGS)
256
257VASFLAGS = $(VASDEFS) $(VASINCS) $(VASOPTS)
258LASFLAGS = $(LASDEFS) $(LASINCS) $(LASOPTS)
259GASFLAGS = $(GASDEFS) $(GASINCS) $(GASOPTS)
260
261ASOPTS = $(VASOPTS) $(LASOPTS) $(GASOPTS)
262ASDEFS = $(VASDEFS) $(LASDEFS) $(GASDEFS)
263ASINCS = $(VASINCS) $(LASINCS) $(GASINCS)
264
265override GASOPTS = $(OPTIMIZER) $(MKDEPOPT)
266override GASDEFS = $(GCDEFS)
267override GASINCS = $(GCINCS)
268
269#
270# the install command to use
271#
272INSTALL = $(ROOT)/usr/bin/gfxinstall
273INSTALLFLAGS = -v -m 0444
274
275#
276# Convenient command macros that include the flags macros.
277#
278# You should always invoke make in makefiles via $(MAKE), as make passes
279# all command-line variables through the environment to sub-makes.
280#
281# Never use just $(CCF), etc. in rules that link executables; LDFLAGS
282# needs to be included after your objects in the command line.
283#
284ASF = $(AS) $(ASFLAGS)
285CXXF = $(CXX) $(CXXFLAGS)
286C++F = $(CXXF)
287CCF = $(CC) $(CFLAGS)
288LDF = $(LD) $(LDFLAGS)
289LEXF = $(LEX) $(LFLAGS)
290YACCF = $(YACC) $(YFLAGS)
291
292# Targets
293
294COMMONTARGS = clobber clean rmtargets
295
296ALLTARGS = headers headers_install libs libs_install install apps distsi \
297 $(COMMONTARGS)
298
299#
300# Rule macros for nonterminal makefiles that iterate over subdirectories,
301# making the current target. Set *SUBDIRS to the relevant list of kids.
302#
303# Set NOSUBMESG to any value to suppress a warning that subdirectories
304# are not present. This is useful with mandefs/rules
305#
306SUBDIR_MAKERULE= \
307 if test ! -d $$d; then \
308 if test "$(NOSUBMESG)" = "" ; then \
309 echo "SKIPPING $$d: No such directory."; \
310 fi \
311 else \
312 $(ECHO) "\t$(MAKE) -C $$d $${RULE:=$@}"; \
313 $(MAKE) -C $$d $${RULE:=$@}; \
314 fi
315
316SUBDIRS_MAKERULE= \
317 +@for d in $(SUBDIRS); do $(SUBDIR_MAKERULE); done
318
319#
320# One problem with the above rules is that if a make fails, and -k is
321# set, the entire for loop might stop. This is because make still can
322# (and XPG requires it) exit with an error status if the -k option is set.
323# This is an alternate rule for SUBDIRS when it is desired that -k keep
324# working on the next SUBDIR if the previous one failed. Its not quite
325# as compact a rule as the previous ones.
326# A standard usage would be:
327# default install $(COMMONTARGS): $(_FORCE)
328# $(MAKE) __DORULE=$@ $(SUBDIRS)
329# $(SUBDIRS): $(_FORCE)
330# @$(NSUBDIR_MAKERULE)
331
332NSUBDIR_MAKERULE= \
333 if test ! -d $@; then \
334 if test "$(NOSUBMESG)" = "" ; then \
335 echo "SKIPPING $@: No such directory."; \
336 fi \
337 else \
338 echo "\t(cd $@; $(MAKE) $(__DORULE))"; \
339 (cd $@; ${MAKE} $(__DORULE)); \
340 fi
341
342#
343# Convenience file list macros:
344# - Commondefs defines the following lists: SOURCES, enumerating all
345# source files; OBJECTS, the .o files derived from compilable source;
346# and DIRT, which lists intermediates and temporary files to be
347# removed by clean.
348# - The including (parent) makefile may define source file lists for
349# the standard suffixes: CFILES for .c, ASFILES for .s, YFILES for
350# .y, etc. We combine all such lists into SOURCES. The including
351# makefile need not define CFILES &c before including commondefs.
352#
353SOURCES=$(HFILES) $(ASFILES) $(CCFILES) $(C++FILES) $(CXXFILES) $(CFILES) \
354 $(EFILES) $(FFILES) $(LFILES) $(PFILES) $(RFILES) $(SHFILES) $(YFILES)
355
356CXXO1=$(CXXFILES:.c++=.o) $(C++FILES:.c++=.o) $(CCFILES:.c++=.o)
357CXXO2=$(CXXO1:.cxx=.o)
358CXXO3=$(CXXO2:.C=.o)
359CXXO4=$(CXXO3:.cc=.o)
360CXXOALL=$(CXXO4)
361YO1=$(YFILES:.y=.o)
362YO2=$(YO1:.yxx=.o)
363YO3=$(YO2:.Y=.o)
364YOALL=$(YO3)
365LO1=$(LFILES:.l=.o)
366LO2=$(LO1:.lxx=.o)
367LO3=$(LO2:.L=.o)
368LOALL=$(LO3)
369OBJECTS=$(ASFILES:.s=.o) $(CXXOALL) $(CFILES:.c=.o) $(EFILES:.e=.o) \
370 $(FFILES:.f=.o) $(LOALL) $(PFILES:.p=.o) $(RFILES:.r=.o) \
371 $(YOALL)
372
373#
374# dependency file(s)
375#
376ifeq ($(OS),IRIX)
377MKDEPFILE = Makedepend
378endif
379ifeq ($(OS),Linux)
380MKDEPFILE = $(OBJECTS:.o=.d)
381endif
382
383#
384# distribution file
385#
386DISTFILE_EXT = Distfile
387DISTFILE_INT = Distfile.int
388ifeq ($(OS),IRIX)
389DISTFILE = $(DISTFILE_EXT)
390else
391ifeq ($(OS),Linux)
392DISTFILE = $(DISTFILE_EXT)
393else
394DISTFILE = $(DISTFILE_EXT) $(DISTFILE_INT)
395endif
396endif
397
398#
399# dirt stuff
400#
401DIRT=$(GDIRT) $(VDIRT) $(LDIRT)
402override GDIRT=*.o a.out core lex.yy.[co] y.tab.[cho] ar.tmp.* so_locations
403
404LOCALDEFS = ./localdefs
405LOCALRULES = ./localrules
406
407-include $(LOCALDEFS)