1 #
   2 # CDDL HEADER START
   3 #
   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.
   7 #
   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.
  12 #
  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]
  18 #
  19 # CDDL HEADER END
  20 #
  21 # Copyright 1993 Sun Microsystems, Inc. All rights reserved.
  22 # Use is subject to license terms.
  23 #
  24 # @(#)default.mk.file 1.4 06/12/12
  25 #
  26 
  27 SUFFIXES = .o .c .c~ .cc .cc~ .s .s~ .S .S~ .ln .f .f~ .F .F~ .l .l~ \
  28         .mod .mod~ .sym .def .def~ .p .p~ .r .r~ .y .y~ .h .h~ .sh .sh~ \
  29         .cps .cps~
  30 .SUFFIXES: $(SUFFIXES)
  31 
  32 # OUTPUT_OPTION should be defined to "-o $@" when
  33 # the default rules are used for non-local files.
  34 OUTPUT_OPTION=
  35 
  36 #       C language section.
  37 CC=cc
  38 CFLAGS=
  39 CPPFLAGS=
  40 LINT=lint
  41 LINTFLAGS=
  42 COMPILE.c=$(CC) $(CFLAGS) $(CPPFLAGS) -target $(TARGET_ARCH:-%=%) -c
  43 LINK.c=$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -target $(TARGET_ARCH:-%=%)
  44 LINT.c=$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)
  45 .c:
  46         $(LINK.c) -o $@ $< $(LDLIBS)
  47 .c.ln:
  48         $(LINT.c) $(OUTPUT_OPTION) -i $<
  49 .c.o:
  50         $(COMPILE.c) $(OUTPUT_OPTION) $<
  51 .c.a:
  52         $(COMPILE.c) -o $% $<
  53         $(AR) $(ARFLAGS) $@ $%
  54         $(RM) $%
  55 
  56 #       C language section. yacc.
  57 YACC=yacc
  58 YFLAGS=
  59 YACC.y=$(YACC) $(YFLAGS)
  60 .y:
  61         $(YACC.y) $<
  62         $(LINK.c) -o $@ y.tab.c $(LDLIBS)
  63         $(RM) y.tab.c
  64 .y.c:
  65         $(YACC.y) $<
  66         mv y.tab.c $@
  67 .y.ln:
  68         $(YACC.y) $<
  69         $(LINT.c) -o $@ -i y.tab.c
  70         $(RM) y.tab.c
  71 .y.o:
  72         $(YACC.y) $<
  73         $(COMPILE.c) -o $@ y.tab.c
  74         $(RM) y.tab.c
  75 
  76 #       C language section. lex.
  77 LEX=lex
  78 LFLAGS=
  79 LEX.l=$(LEX) $(LFLAGS) -t
  80 .l:
  81         $(RM) $*.c
  82         $(LEX.l) $< > $*.c
  83         $(LINK.c) -o $@ $*.c -ll $(LDLIBS)
  84         $(RM) $*.c
  85 .l.c :
  86         $(RM) $@
  87         $(LEX.l) $< > $@
  88 .l.ln:
  89         $(RM) $*.c
  90         $(LEX.l) $< > $*.c
  91         $(LINT.c) -o $@ -i $*.c
  92         $(RM) $*.c
  93 .l.o:
  94         $(RM) $*.c
  95         $(LEX.l) $< > $*.c
  96         $(COMPILE.c) -o $@ $*.c
  97         $(RM) $*.c
  98 
  99 #       C++ language section.
 100 CCC=CC
 101 CCFLAGS=
 102 COMPILE.cc=$(CCC) $(CCFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
 103 LINK.cc=$(CCC) $(CCFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
 104 .cc:
 105         $(LINK.cc) -o $@ $< $(LDLIBS)
 106 .cc.o:
 107         $(COMPILE.cc) $(OUTPUT_OPTION) $<
 108 .cc.a:
 109         $(COMPILE.cc) -o $% $<
 110         $(AR) $(ARFLAGS) $@ $%
 111         $(RM) $%
 112 
 113 #       FORTRAN section.
 114 FC=f77
 115 FFLAGS=
 116 COMPILE.f=$(FC) $(FFLAGS) $(TARGET_ARCH) -c
 117 LINK.f=$(FC) $(FFLAGS) $(LDFLAGS) $(TARGET_ARCH)
 118 COMPILE.F=$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
 119 LINK.F=$(FC) $(FFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
 120 .f:
 121         $(LINK.f) -o $@ $< $(LDLIBS)
 122 .f.o:
 123         $(COMPILE.f) $(OUTPUT_OPTION) $<
 124 .f.a:
 125         $(COMPILE.f) -o $% $<
 126         $(AR) $(ARFLAGS) $@ $%
 127         $(RM) $%
 128 .F:
 129         $(LINK.F) -o $@ $< $(LDLIBS)
 130 .F.o:
 131         $(COMPILE.F) $(OUTPUT_OPTION) $<
 132 .F.a:
 133         $(COMPILE.F) -o $% $<
 134         $(AR) $(ARFLAGS) $@ $%
 135         $(RM) $%
 136 
 137 #       FORTRAN section. ratfor.
 138 RFLAGS=
 139 COMPILE.r=$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -c
 140 LINK.r=$(FC) $(FFLAGS) $(RFLAGS) $(LDFLAGS) $(TARGET_ARCH)
 141 .r:
 142         $(LINK.r) -o $@ $< $(LDLIBS)
 143 .r.o:
 144         $(COMPILE.r) $(OUTPUT_OPTION) $<
 145 .r.a:
 146         $(COMPILE.r) -o $% $<
 147         $(AR) $(ARFLAGS) $@ $%
 148         $(RM) $%
 149 
 150 #       Modula-2 section.
 151 M2C=m2c
 152 M2FLAGS=
 153 MODFLAGS=
 154 DEFFLAGS=
 155 COMPILE.def=$(M2C) $(M2FLAGS) $(DEFFLAGS) $(TARGET_ARCH)
 156 COMPILE.mod=$(M2C) $(M2FLAGS) $(MODFLAGS) $(TARGET_ARCH)
 157 .def.sym:
 158         $(COMPILE.def) -o $@ $<
 159 .mod:
 160         $(COMPILE.mod) -o $@ -e $@ $<
 161 .mod.o:
 162         $(COMPILE.mod) -o $@ $<
 163 .mod.a:
 164         $(COMPILE.mod) -o $% $<
 165         $(AR) $(ARFLAGS) $@ $%
 166         $(RM) $%
 167 
 168 #       Pascal section.
 169 PC=pc
 170 PFLAGS=
 171 COMPILE.p=$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
 172 LINK.p=$(PC) $(PFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
 173 .p:
 174         $(LINK.p) -o $@ $< $(LDLIBS)
 175 .p.o:
 176         $(COMPILE.p) $(OUTPUT_OPTION) $<
 177 .p.a:
 178         $(COMPILE.p) -o $% $<
 179         $(AR) $(ARFLAGS) $@ $%
 180         $(RM) $%
 181 
 182 #       Assembly section.
 183 AS=as
 184 ASFLAGS=
 185 COMPILE.s=$(AS) $(ASFLAGS) $(TARGET_MACH)
 186 COMPILE.S=$(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
 187 .s.o:
 188         $(COMPILE.s) -o $@ $<
 189 .s.a:
 190         $(COMPILE.s) -o $% $<
 191         $(AR) $(ARFLAGS) $@ $%
 192         $(RM) $%
 193 .S.o:
 194         $(COMPILE.S) -o $@ $<
 195 .S.a:
 196         $(COMPILE.S) -o $% $<
 197         $(AR) $(ARFLAGS) $@ $%
 198         $(RM) $%
 199 
 200 #       Shell section.
 201 .sh:
 202         $(RM) $@
 203         cat $< > $@
 204         chmod +x $@
 205 
 206 #       NeWS section
 207 CPS=cps
 208 CPSFLAGS=
 209 .cps.h:
 210         $(CPS) $(CPSFLAGS) $*.cps
 211 
 212 #       Miscellaneous section.
 213 LD=ld
 214 LDFLAGS=
 215 LDLIBS=
 216 MAKE=make
 217 RM=rm -f
 218 AR=ar
 219 ARFLAGS=rv
 220 GET=/usr/sccs/get
 221 GFLAGS=
 222 
 223 markfile.o:     markfile
 224         echo "static char _sccsid[] = \"`grep @'(#)' markfile`\";" > markfile.c
 225         cc -c markfile.c
 226         $(RM) markfile.c
 227 
 228 SCCSFLAGS=
 229 SCCSGETFLAGS=-s
 230 .SCCS_GET:
 231         sccs $(SCCSFLAGS) get $(SCCSGETFLAGS) $@ -G$@