Subversion Repositories Open64

[/] [trunk/] [osprey/] [linux/] [make/] [gcommonrules] - Blame information for rev 3901

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 71 marcel
# -*- Makefile -*-
2 2 marcel
#
3
#  Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
4
#
5
#  This program is free software; you can redistribute it and/or modify it
6
#  under the terms of version 2 of the GNU General Public License as
7
#  published by the Free Software Foundation.
8
#
9
#  This program is distributed in the hope that it would be useful, but
10
#  WITHOUT ANY WARRANTY; without even the implied warranty of
11
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
#
13
#  Further, this software is distributed without any warranty that it is
14
#  free of the rightful claim of any third person regarding infringement
15
#  or the like.  Any license provided herein, whether implied or
16
#  otherwise, applies only to this software file.  Patent licenses, if
17
#  any, provided herein do not apply to combinations of this program with
18
#  other software, or any other product whatsoever.
19
#
20
#  You should have received a copy of the GNU General Public License along
21
#  with this program; if not, write the Free Software Foundation, Inc., 59
22
#  Temple Place - Suite 330, Boston MA 02111-1307, USA.
23
#
24
#  Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
25
#  Mountain View, CA 94043, or:
26
#
27
#  http://www.sgi.com
28
#
29
#  For further information regarding this notice, see:
30
#
31
#  http://oss.sgi.com/projects/GenInfo/NoticeExplan
32
#
33
#
34
 
35 767 fengzhou
#ident "$Revision$"
36 2 marcel
#
37
# Common makefile rules.
38
#
39
# Notes:
40
# - After including $(ROOT)/usr/include/make/commondefs, a makefile may
41
#   say ``include $(COMMONRULES)'' to get this file.
42
# - It is up to the including makefile to define a default rule before
43
#   including $(COMMONRULES).
44
# - The parent makefile must define TARGETS in order for clobber to work.
45
#
46
# - if BUILD_SUBDIRS is set, then iterate over that for the COMMONTARGS
47
 
48
#
49
# An always-unsatisfied target.  The name is unlikely to occur in a file tree,
50
# but if _force existed in a make's current directory, this target would be
51
# always-satisfied and targets that depended on it would not be made.
52
#
53
$(_FORCE):
54
 
55
#
56
# File removal rules: there are three.
57
# - clean removes dirt
58
# - clobber removes targets, dirt, and Makedepend
59
# - rmtargets removes targets only
60
# One might 'make clean' in a large tree to reclaim disk space after targets
61
# are built, but before they are archived into distribution images on disk.
62
# One might 'make rmtargets' to remove badly-linked executables, and then
63
# run a 'make' to re-link the good objects.
64
#
65
CWD := $(shell pwd)
66
 
67
ifdef BUILD_SUBDIRS
68
# use separate clobber so don't recurse on each sub-target
69
clobber: $(_FORCE)
70
  rm -rf $(DIRT)
71
  rm -rf $(TARGETS)
72
  rm -rf $(MKDEPFILE)
73
  @for d in $(BUILD_SUBDIRS); do cd $(CWD)/$$d && $(MAKE) $@; done
74
else
75
clobber: clean rmtargets $(_FORCE)
76
  rm -rf $(MKDEPFILE)
77
endif
78
 
79
clean: $(_FORCE)
80
  rm -rf $(DIRT)
81
ifdef BUILD_SUBDIRS
82
  @for d in $(BUILD_SUBDIRS); do cd $(CWD)/$$d && $(MAKE) $@; done
83
endif
84
 
85
rmtargets: $(_FORCE)
86
  rm -rf $(TARGETS)
87
ifdef BUILD_SUBDIRS
88
  @for d in $(BUILD_SUBDIRS); do cd $(CWD)/$$d && $(MAKE) $@; done
89
endif
90
 
91
#
92
# A better version of smake's makelib.mk rule.
93
# XXX fix makelib.mk in next release and remove this rule.
94
#
95
MAKELIB: .USE .PRECIOUS
96
  $(AR) c$(ARFLAGS) $@ $?
97
  rm -f $?
98
 
99 71 marcel
_empty :=
100
_space := $(_empty) $(_empty)
101
 
102 1950 laijx
ifeq ($(BUILD_TARGET), NVISA)
103
ar =    $(AR)
104
as =    $(CC)
105
bison =   $(BISON)
106
c++f =    $(C++F)
107
cc =    $(CC)
108
ccf =   $(CCF)
109
cxx =   $(CXX)
110
f77 =   $(F77)
111
f90 =   $(F90)
112
fc =    $(FC)
113
ld =    $(LD)
114
ln =    $(LN)
115
link.c++f = $(C++F)
116
link.ccf =  $(CCF)
117
link.cxxf = $(CXXF)
118
ranlib =  $(RANLIB)
119
run =
120
submake = $(MAKE) -C $(1) $(2)
121 135 marcel
 
122 1950 laijx
else
123 767 fengzhou
ar =    $(if $V,,@echo 'AR     $(CWD)/$@';) $(AR)
124
as =    $(if $V,,@echo 'AS     $(CWD)/$<';) $(CC)
125
bison =   $(if $V,,@echo 'BISON  $(CWD)/$<';) $(BISON)
126
c++f =    $(if $V,,@echo 'C++    $(CWD)/$<';) $(C++F)
127
cc =    $(if $V,,@echo 'C      $(CWD)/$<';) $(CC)
128
ccf =   $(if $V,,@echo 'C      $(CWD)/$@';) $(CCF)
129
cxx =   $(if $V,,@echo 'C++    $(CWD)/$<';) $(CXX)
130
f77 =   $(if $V,,@echo 'F77    $(CWD)/$<';) $(F77)
131
f90 =   $(if $V,,@echo 'F90    $(CWD)/$<';) $(F90)
132
fc =    $(if $V,,@echo 'F90    $(CWD)/$<';) $(FC)
133
ld =    $(if $V,,@echo 'LD     $(CWD)/$@';) $(LD)
134 1950 laijx
ln =    $(if $V,,@echo 'LN     $(CWD)/$@';) $(LN)
135 767 fengzhou
link.c++f = $(if $V,,@echo 'LD     $(CWD)/$@';) $(C++F)
136
link.ccf =  $(if $V,,@echo 'LD     $(CWD)/$@';) $(CCF)
137
link.cxxf = $(if $V,,@echo 'LD     $(CWD)/$@';) $(CXXF)
138
link.f90f = $(if $V,,@echo 'LD     $(CWD)/$@';) $(F90F)
139
ranlib =  $(if $V,,@echo 'RANLIB $(CWD)/$@';) $(RANLIB)
140
run =   $(if $V,,@echo 'RUN    $(CWD)/$<';)
141 71 marcel
submake = +$(if $V,,@echo 'MAKE   $(if $(2),$(2) in )$(CWD)/$(1)';) $(MAKE) -C $(1) $(if $V,,--no-print-directory) $(2)
142 1950 laijx
endif # TARG_NVISA
143 71 marcel
 
144 2 marcel
%.o : %.cxx
145 71 marcel
  $(cxx) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
146 2 marcel
 
147 71 marcel
%.o : %.c
148
  $(cc) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
149
 
150
%.o : %.s
151
  $(as) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
152
 
153 135 marcel
%.o : %.S
154
  $(as) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
155
 
156 71 marcel
%.o : %.F
157
  $(fc) -c $(FFLAGS_NOLANG) $(F90FLAGS) $< -o $@
158
 
159
%.o : %.f
160
  $(fc) -c $(FFLAGS_NOLANG) $(F90FLAGS) $< -o $@
161
 
162
%.o : %.F90
163
  $(fc) -c $(FFLAGS_NOLANG) $(F90FLAGS) $<
164
 
165
pic_flag := -fpic
166
 
167
%.pic.o : %.cxx
168
  $(cxx) $(pic_flag) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
169
 
170
%.pic.o : %.c
171
  $(cc) $(pic_flag) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
172
 
173
%.pic.o : %.s
174
  $(as) $(pic_flag) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
175
 
176 135 marcel
%.pic.o : %.S
177
  $(as) $(pic_flag) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
178
 
179 71 marcel
%.pic.o : %.f
180
  $(fc) $(pic_flag) -c $(FFLAGS_NOLANG) $(F90FLAGS) $< -o $@
181
 
182
%.pic.o : %.F
183
  $(fc) $(pic_flag) -c $(FFLAGS_NOLANG) $(F90FLAGS) $< -o $@
184
 
185
%.pic.o : %.F90
186 767 fengzhou
  $(fc) $(pic_flag) -c $(FFLAGS_NOLANG) $(F90FLAGS) $< -o $@
187 71 marcel
 
188 83 marcel
prof_flag := -pg
189
 
190
%.pg.o : %.cxx
191
  $(cxx) $(prof_flag) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
192
 
193
%.pg.o : %.c
194
  $(cc) $(prof_flag) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
195
 
196
%.pg.o : %.s
197
  $(as) $(prof_flag) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
198
 
199 135 marcel
%.pg.o : %.S
200
  $(as) $(prof_flag) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
201
 
202 83 marcel
%.pg.o : %.f
203
  $(fc) $(prof_flag) -c $(FFLAGS_NOLANG) $(F90FLAGS) $< -o $@
204
 
205
%.pg.o : %.F
206
  $(fc) $(prof_flag) -c $(FFLAGS_NOLANG) $(F90FLAGS) $< -o $@
207
 
208
%.pg.o : %.F90
209 767 fengzhou
  $(fc) $(prof_flag) -c $(FFLAGS_NOLANG) $(F90FLAGS) $< -o $@
210 83 marcel
 
211
ipa_flag := -ipa
212
 
213
%.ipa.o : %.cxx
214
  $(cxx) $(ipa_flag) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
215
 
216
%.ipa.o : %.c
217
  $(cc) $(ipa_flag) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
218
 
219
%.ipa.o : %.s
220
  $(as) $(ipa_flag) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
221
 
222 135 marcel
%.ipa.o : %.S
223
  $(as) $(ipa_flag) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
224
 
225 83 marcel
%.ipa.o : %.f
226
  $(fc) $(ipa_flag) -c $(FFLAGS_NOLANG) $(F90FLAGS) $< -o $@
227
 
228
%.ipa.o : %.F
229
  $(fc) $(ipa_flag) -c $(FFLAGS_NOLANG) $(F90FLAGS) $< -o $@
230
 
231
%.ipa.o : %.F90
232
  $(fc) $(ipa_flag) -c $(FFLAGS_NOLANG) $(F90FLAGS) $<
233
 
234 2 marcel
make_deps:
235
  -@cat *.d > $(MKDEPFILE)
236
 
237 1950 laijx
ifeq ($(BUILD_TARGET), NVISA)
238
make_libdeps :
239
  -@cat *.d > $(MKDEPFILE)
240 3901 dgilmore
else ifeq ($(BUILD_TARGET), X8664)
241
make_libdeps :
242
  -@cat *.d > $(MKDEPFILE)
243 1950 laijx
else
244 2 marcel
# make dependencies be for library(foo.o) not for foo.o,
245
# thus we don't need to preserve intermediate .o files.
246
make_libdeps :
247 2000 ycwu
  -@cat *.d | sed -e "s/^.*\.o/$(LIBRARY)(&)/" > $(MKDEPFILE)
248 1950 laijx
endif
249 2 marcel
 
250
#
251
# Include the make dependency file if it exists.
252
#
253
-include $(MKDEPFILE)
254
 
255
#
256
# Local make rules
257
#
258
-include $(LOCALRULES)