4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
21 # Copyright 2003 Sun Microsystems, Inc. All rights reserved.
22 # Use is subject to license terms.
25 SUFFIXES = .o .c .c~ .cc .cc~ .y .y~ .l .l~ .s .s~ .sh .sh~ .S .S~ .i .ln \
26 .h .h~ .f .f~ .for .for~ .F .F~ .f90 .f90~ .ftn .ftn~ .mod .mod~ \
27 .sym .def .def~ .p .p~ .r .r~ .cps .cps~ .C .C~ .Y .Y~ .L .L~ \
30 .SUFFIXES: $(SUFFIXES)
32 # OUTPUT_OPTION should be defined to "-o $@" when
33 # the default rules are used for non-local files.
42 COMPILE.c=$(CC) $(CFLAGS) $(CPPFLAGS) -c
43 LINK.c=$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
44 LINT.c=$(LINT) $(LINTFLAGS) $(CPPFLAGS)
46 $(LINK.c) -o $@ $< $(LDLIBS)
48 $(GET) $(GFLAGS) -p $< > $*.c
49 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $*.c
51 $(COMPILE.c) $(OUTPUT_OPTION) $<
53 $(GET) $(GFLAGS) -p $< > $*.c
54 $(CC) $(CFLAGS) -c $*.c
56 $(CC) $(CFLAGS) $(CPPFLAGS) -P $<
58 $(GET) $(GFLAGS) -p $< > $*.c
59 $(CC) $(CFLAGS) $(CPPFLAGS) -P $*.c
61 $(LINT.c) $(OUTPUT_OPTION) -c $<
63 $(GET) $(GFLAGS) -p $< > $*.c
64 $(LINT.c) $(OUTPUT_OPTION) -c $*.c
67 $(AR) $(ARFLAGS) $@ $%
70 $(GET) $(GFLAGS) -p $< > $*.c
71 $(COMPILE.c) -o $% $*.c
72 $(AR) $(ARFLAGS) $@ $%
75 # C language section. yacc.
78 YACC.y=$(YACC) $(YFLAGS)
81 $(LINK.c) -o $@ y.tab.c $(LDLIBS)
84 $(GET) $(GFLAGS) -p $< > $*.y
85 $(YACC) $(YFLAGS) $*.y
86 $(COMPILE.c) -o $@ y.tab.c
93 $(GET) $(GFLAGS) -p $< > $*.y
94 $(YACC) $(YFLAGS) $*.y
98 $(LINT.c) -o $@ -i y.tab.c
101 $(GET) $(GFLAGS) -p $< > $*.y
103 $(LINT.c) -o $@ -i y.tab.c
107 $(COMPILE.c) -o $@ y.tab.c
110 $(GET) $(GFLAGS) -p $< > $*.y
111 $(YACC) $(YFLAGS) $*.y
112 $(CC) $(CFLAGS) -c y.tab.c
116 # C language section. lex.
119 LEX.l=$(LEX) $(LFLAGS) -t
123 $(LINK.c) -o $@ $*.c -ll $(LDLIBS)
126 $(GET) $(GFLAGS) -p $< > $*.l
127 $(LEX) $(LFLAGS) $*.l
128 $(CC) $(CFLAGS) -c lex.yy.c
136 $(GET) $(GFLAGS) -p $< > $*.l
137 $(LEX) $(LFLAGS) $*.l
142 $(LINT.c) -o $@ -i $*.c
145 $(GET) $(GFLAGS) -p $< > $*.l
148 $(LINT.c) -o $@ -i $*.c
153 $(COMPILE.c) -o $@ $*.c
156 $(GET) $(GFLAGS) -p $< > $*.l
157 $(LEX) $(LFLAGS) $*.l
158 $(CC) $(CFLAGS) -c lex.yy.c
162 # C++ language section.
165 COMPILE.cc=$(CCC) $(CCFLAGS) $(CPPFLAGS) -c
166 LINK.cc=$(CCC) $(CCFLAGS) $(CPPFLAGS) $(LDFLAGS)
167 COMPILE.C=$(CCC) $(CCFLAGS) $(CPPFLAGS) -c
168 LINK.C=$(CCC) $(CCFLAGS) $(CPPFLAGS) $(LDFLAGS)
170 $(LINK.cc) -o $@ $< $(LDLIBS)
172 $(GET) $(GFLAGS) -p $< > $*.cc
173 $(LINK.cc) -o $@ $*.cc $(LDLIBS)
175 $(COMPILE.cc) $(OUTPUT_OPTION) $<
177 $(GET) $(GFLAGS) -p $< > $*.cc
178 $(COMPILE.cc) $(OUTPUT_OPTION) $*.cc
180 $(CCC) $(CCFLAGS) $(CPPFLAGS) -P $<
182 $(GET) $(GFLAGS) -p $< > $*.cc
183 $(CCC) $(CCFLAGS) $(CPPFLAGS) -P $*.cc
185 $(COMPILE.cc) -o $% $<
186 $(AR) $(ARFLAGS) $@ $%
189 $(GET) $(GFLAGS) -p $< > $*.cc
190 $(COMPILE.cc) -o $% $*.cc
191 $(AR) $(ARFLAGS) $@ $%
195 $(LINK.C) -o $@ $< $(LDLIBS)
197 $(GET) $(GFLAGS) -p $< > $*.C
198 $(LINK.C) -o $@ $*.C $(LDLIBS)
200 $(COMPILE.C) $(OUTPUT_OPTION) $<
202 $(GET) $(GFLAGS) -p $< > $*.C
203 $(COMPILE.C) $(OUTPUT_OPTION) $*.C
205 $(CCC) $(CCFLAGS) $(CPPFLAGS) -P $<
207 $(GET) $(GFLAGS) -p $< > $*.C
208 $(CCC) $(CCFLAGS) $(CPPFLAGS) -P $*.C
210 $(COMPILE.C) -o $% $<
211 $(AR) $(ARFLAGS) $@ $%
214 $(GET) $(GFLAGS) -p $< > $*.C
215 $(COMPILE.C) -o $% $*.C
216 $(AR) $(ARFLAGS) $@ $%
222 COMPILE.f=$(FC) $(FFLAGS) -c
223 LINK.f=$(FC) $(FFLAGS) $(LDFLAGS)
224 COMPILE.F=$(FC) $(FFLAGS) $(CPPFLAGS) -c
225 LINK.F=$(FC) $(FFLAGS) $(CPPFLAGS) $(LDFLAGS)
227 $(LINK.f) -o $@ $< $(LDLIBS)
229 $(GET) $(GFLAGS) -p $< > $*.f
230 $(FC) $(FFLAGS) $(LDFLAGS) -o $@ $*.f
232 $(COMPILE.f) $(OUTPUT_OPTION) $<
234 $(GET) $(GFLAGS) -p $< > $*.f
235 $(FC) $(FFLAGS) -c $*.f
237 $(COMPILE.f) -o $% $<
238 $(AR) $(ARFLAGS) $@ $%
241 $(GET) $(GFLAGS) -p $< > $*.f
242 $(COMPILE.f) -o $% $*.f
243 $(AR) $(ARFLAGS) $@ $%
246 $(LINK.f) -o $@ $< $(LDLIBS)
248 $(GET) $(GFLAGS) -p $< > $*.for
249 $(FC) $(FFLAGS) $(LDFLAGS) -o $@ $*.for
251 $(COMPILE.f) $(OUTPUT_OPTION) $<
253 $(GET) $(GFLAGS) -p $< > $*.for
254 $(FC) $(FFLAGS) -c $*.for
256 $(COMPILE.f) -o $% $<
257 $(AR) $(ARFLAGS) $@ $%
260 $(GET) $(GFLAGS) -p $< > $*.for
261 $(COMPILE.f) -o $% $*.for
262 $(AR) $(ARFLAGS) $@ $%
265 $(LINK.F) -o $@ $< $(LDLIBS)
267 $(GET) $(GFLAGS) -p $< > $*.F
268 $(FC) $(FFLAGS) $(LDFLAGS) -o $@ $*.F
270 $(COMPILE.F) $(OUTPUT_OPTION) $<
272 $(GET) $(GFLAGS) -p $< > $*.F
273 $(FC) $(FFLAGS) -c $*.F
275 $(COMPILE.F) -o $% $<
276 $(AR) $(ARFLAGS) $@ $%
279 $(GET) $(GFLAGS) -p $< > $*.F
280 $(COMPILE.F) -o $% $*.F
281 $(AR) $(ARFLAGS) $@ $%
284 # FORTRAN section. ratfor.
286 COMPILE.r=$(FC) $(FFLAGS) $(RFLAGS) -c
287 LINK.r=$(FC) $(FFLAGS) $(RFLAGS) $(LDFLAGS)
289 $(LINK.r) -o $@ $< $(LDLIBS)
291 $(GET) $(GFLAGS) -p $< > $*.r
292 $(LINK.r) -o $@ $*.r $(LDLIBS)
294 $(COMPILE.r) $(OUTPUT_OPTION) $<
296 $(GET) $(GFLAGS) -p $< > $*.r
297 $(COMPILE.r) $(OUTPUT_OPTION) $*.r
299 $(COMPILE.r) -o $% $<
300 $(AR) $(ARFLAGS) $@ $%
303 $(GET) $(GFLAGS) -p $< > $*.r
304 $(COMPILE.r) -o $% $*.r
305 $(AR) $(ARFLAGS) $@ $%
308 # FORTRAN 90 section.
311 COMPILE.f90=$(F90C) $(F90FLAGS) -c
312 LINK.f90=$(F90C) $(F90FLAGS) $(LDFLAGS)
313 COMPILE.ftn=$(F90C) $(F90FLAGS) -c
314 LINK.ftn=$(F90C) $(F90FLAGS) $(LDFLAGS)
316 $(LINK.f90) -o $@ $< $(LDLIBS)
318 $(GET) $(GFLAGS) -p $< > $*.f90
319 $(LINK.f90) -o $@ $*.f90 $(LDLIBS)
321 $(COMPILE.f90) $(OUTPUT_OPTION) $<
323 $(GET) $(GFLAGS) -p $< > $*.f90
324 $(COMPILE.f90) $(OUTPUT_OPTION) $*.f90
326 $(COMPILE.f90) -o $% $<
327 $(AR) $(ARFLAGS) $@ $%
330 $(GET) $(GFLAGS) -p $< > $*.f90
331 $(COMPILE.f90) -o $% $*.f90
332 $(AR) $(ARFLAGS) $@ $%
335 $(LINK.ftn) -o $@ $< $(LDLIBS)
337 $(GET) $(GFLAGS) -p $< > $*.ftn
338 $(LINK.ftn) -o $@ $*.ftn $(LDLIBS)
340 $(COMPILE.ftn) $(OUTPUT_OPTION) $<
342 $(GET) $(GFLAGS) -p $< > $*.ftn
343 $(COMPILE.ftn) $(OUTPUT_OPTION) $*.ftn
345 $(COMPILE.ftn) -o $% $<
346 $(AR) $(ARFLAGS) $@ $%
349 $(GET) $(GFLAGS) -p $< > $*.ftn
350 $(COMPILE.ftn) -o $% $*.ftn
351 $(AR) $(ARFLAGS) $@ $%
359 COMPILE.def=$(M2C) $(M2FLAGS) $(DEFFLAGS)
360 COMPILE.mod=$(M2C) $(M2FLAGS) $(MODFLAGS)
362 $(COMPILE.def) -o $@ $<
364 $(GET) $(GFLAGS) -p $< > $*.def
365 $(COMPILE.def) -o $@ $*.def
367 $(COMPILE.mod) -o $@ -e $@ $<
369 $(GET) $(GFLAGS) -p $< > $*.mod
370 $(COMPILE.mod) -o $@ -e $@ $*.mod
372 $(COMPILE.mod) -o $@ $<
374 $(GET) $(GFLAGS) -p $< > $*.mod
375 $(COMPILE.mod) -o $@ $*.mod
377 $(COMPILE.mod) -o $% $<
378 $(AR) $(ARFLAGS) $@ $%
381 $(GET) $(GFLAGS) -p $< > $*.mod
382 $(COMPILE.mod) -o $% $*.mod
383 $(AR) $(ARFLAGS) $@ $%
389 COMPILE.p=$(PC) $(PFLAGS) $(CPPFLAGS) -c
390 LINK.p=$(PC) $(PFLAGS) $(CPPFLAGS) $(LDFLAGS)
392 $(LINK.p) -o $@ $< $(LDLIBS)
394 $(GET) $(GFLAGS) -p $< > $*.p
395 $(LINK.p) -o $@ $*.p $(LDLIBS)
397 $(COMPILE.p) $(OUTPUT_OPTION) $<
399 $(GET) $(GFLAGS) -p $< > $*.p
400 $(COMPILE.p) $(OUTPUT_OPTION) $*.p
402 $(COMPILE.p) -o $% $<
403 $(AR) $(ARFLAGS) $@ $%
406 $(GET) $(GFLAGS) -p $< > $*.p
407 $(COMPILE.p) -o $% $*.p
408 $(AR) $(ARFLAGS) $@ $%
414 COMPILE.s=$(AS) $(ASFLAGS)
415 COMPILE.S=$(CC) $(ASFLAGS) $(CPPFLAGS) -c
417 $(COMPILE.s) -o $@ $<
419 $(GET) $(GFLAGS) -p $< > $*.s
420 $(COMPILE.s) -o $@ $*.s
422 $(COMPILE.s) -o $% $<
423 $(AR) $(ARFLAGS) $@ $%
426 $(GET) $(GFLAGS) -p $< > $*.s
427 $(COMPILE.s) -o $% $*.s
428 $(AR) $(ARFLAGS) $@ $%
431 $(COMPILE.S) -o $@ $<
433 $(GET) $(GFLAGS) -p $< > $*.S
434 $(COMPILE.S) -o $@ $*.S
436 $(COMPILE.S) -o $% $<
437 $(AR) $(ARFLAGS) $@ $%
440 $(GET) $(GFLAGS) -p $< > $*.S
441 $(COMPILE.S) -o $% $*.S
442 $(AR) $(ARFLAGS) $@ $%
451 $(GET) $(GFLAGS) -p $< > $*.sh
459 $(CPS) $(CPSFLAGS) $*.cps
461 $(GET) $(GFLAGS) -p $< > $*.cps
462 $(CPS) $(CPSFLAGS) $*.cps
468 $(JAVAC) $(JAVACFLAGS) $<
470 $(GET) $(GFLAGS) -p $< > $*.java
471 $(JAVAC) $(JAVACFLAGS) $<
473 # Miscellaneous section.
485 echo "static char _sccsid[] = \"`grep @'(#)' markfile`\";" > markfile.c
492 sccs $(SCCSFLAGS) get $(SCCSGETFLAGS) $@ -G$@
495 sccs $(SCCSFLAGS) get $(SCCSGETFLAGS) $@
498 $(GET) $(GFLAGS) s.$@