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, Version 1.0 only
   6 # (the "License").  You may not use this file except in compliance
   7 # with the License.
   8 #
   9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10 # or http://www.opensolaris.org/os/licensing.
  11 # See the License for the specific language governing permissions
  12 # and limitations under the License.
  13 #
  14 # When distributing Covered Code, include this CDDL HEADER in each
  15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16 # If applicable, add the following below this CDDL HEADER, with the
  17 # fields enclosed by brackets "[]" replaced with your own identifying
  18 # information: Portions Copyright [yyyy] [name of copyright owner]
  19 #
  20 # CDDL HEADER END
  21 #
  22 #
  23 # Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  24 # Use is subject to license terms.
  25 #
  26 
  27 HASHPROG=       hashmk1 spellin1
  28 SHPROG=         spell compress
  29 HASHTAB=        hlista hlistb hstop
  30 BINPROG=        spellprog spellin hashmake hashcheck
  31 PROG=           $(SHPROG) $(BINPROG) $(HASHPROG) $(HASHTAB) spellhist
  32 
  33 SPELLPROGSRC=   spellprog.c hash.c hashlook.c huff.c
  34 SPELLPROGOBJ=   $(SPELLPROGSRC:%.c=%.o)
  35 
  36 SPELLINSRC=     spellin.c huff.c
  37 SPELLINOBJ=     $(SPELLINSRC:%.c=%.o)
  38 
  39 HASHCHECKSRC=   hashcheck.c hash.c huff.c
  40 HASHCHECKOBJ=   $(HASHCHECKSRC:%.c=%.o)
  41 
  42 HASHMAKESRC=    hashmake.c hash.c
  43 HASHMAKEOBJ=    $(HASHMAKESRC:%.c=%.o)
  44 
  45 SRCS= $(SPELLPROGSRC) spellin.c hashcheck.c hashmake.c
  46 OBJS= $(SRCS:%.c=%.o)
  47 
  48 WORDS=  american british local list extra stop
  49 TXTS=   compress.sh spell.sh
  50 
  51 include ../Makefile.cmd
  52 
  53 CFLAGS += $(CCVERBOSE)
  54 CERRWARN += -_gcc=-Wno-parentheses
  55 
  56 XGETFLAGS += -a -x spell.xcl
  57 
  58 CLOBBERFILES += htemp1 htemp2
  59 
  60 ROOTSPELLD = $(ROOTLIB)/spell
  61 ROOTVARADMD = $(ROOT)/var/adm
  62 ROOTDIRS= $(ROOTSPELLD)
  63 
  64 BINF= spell
  65 SPELLF= spellprog hashmake hashcheck spellin hstop hlistb hlista compress
  66 VARADMF= spellhist
  67 
  68 ROOTBINF = $(BINF:%=$(ROOTBIN)/%)
  69 ROOTSPELLF = $(SPELLF:%=$(ROOTSPELLD)/%)
  70 ROOTVARADMF = $(VARADMF:%=$(ROOTVARADMD)/%)
  71 
  72 HASHFILEMODE = 0644
  73 $(ROOTSPELLD)/hstop $(ROOTSPELLD)/hlistb \
  74 $(ROOTSPELLD)/hlista := FILEMODE =      0644
  75 $(ROOTVARADMF) :=       FILEMODE =      0666
  76 
  77 #
  78 # The native versions of these share targets with the target ones. Because of
  79 # that it is important that we override these variables. For example, LDLIBS
  80 # will add in the default LDLIBS.cmd which means that we'll link against the
  81 # wrong versions of libc.
  82 #
  83 spellin1 hashmk1 := CC = $(NATIVECC)
  84 spellin1 hashmk1 := POST_PROCESS =
  85 spellin1 hashmk1 := CPPFLAGS =
  86 spellin1 hashmk1 := LDFLAGS = -Bdirect
  87 spellin1 hashmk1 := NATIVE_LIBS = libc.so
  88 spellin1 hashmk1 := LDLIBS =
  89 
  90 $(ROOTSPELLD)/% $(ROOTVARADMD)/% : %
  91         $(INS.file)
  92 
  93 .KEEP_STATE:
  94 
  95 all:    $(PROG) $(TXTS)
  96 
  97 spellprog:              $(SPELLPROGOBJ)
  98                         $(LINK.c) $(SPELLPROGOBJ) -o $@ $(LDLIBS)
  99                         $(POST_PROCESS)
 100 
 101 spellin spellin1:       $(SPELLINOBJ)
 102                         $(LINK.c) $(SPELLINOBJ) -o $@ $(LDLIBS)
 103                         $(POST_PROCESS)
 104 
 105 spellhist:
 106                         $(ECHO) '\c' > spellhist
 107 
 108 hashcheck:              $(HASHCHECKOBJ)
 109                         $(LINK.c) $(HASHCHECKOBJ) -o $@ $(LDLIBS)
 110                         $(POST_PROCESS)
 111 
 112 hashmake hashmk1:       $(HASHMAKEOBJ)
 113                         $(LINK.c) $(HASHMAKEOBJ) -o $@ $(LDLIBS)
 114                         $(POST_PROCESS)
 115 
 116 htemp1: list local extra hashmk1
 117         $(RM) $@; cat list local extra | $(_SH_) ./hashmk1 > $@
 118 
 119 hlista: american $(HASHPROG) htemp1
 120         $(RM) htemp2; ./hashmk1 <american |sort -u - htemp1 >htemp2
 121         $(RM) $@; ./spellin1 `wc htemp2|sed -n 's/\([^ ]\) .*/\1/p'`<htemp2 >$@
 122         $(RM) htemp2
 123 
 124 hlistb: british $(HASHPROG) htemp1
 125         $(RM) htemp2; ./hashmk1 <british |sort -u - htemp1 >htemp2
 126         $(RM) $@; ./spellin1 `wc htemp2|sed -n 's/\([^ ]\) .*/\1/p'`<htemp2 >$@
 127         $(RM) htemp2
 128 
 129 hstop:  stop $(HASHPROG)
 130         $(RM) htemp2; ./hashmk1 <stop | sort -u >htemp2
 131         $(RM) $@; ./spellin1 `wc htemp2|sed -n 's/\([^ ]\) .*/\1/p'`<htemp2 >$@
 132         $(RM) htemp2
 133 
 134 install: all $(ROOTDIRS) $(ROOTBINF) $(ROOTSPELLF) $(ROOTVARADMF)
 135 
 136 $(ROOTDIRS):
 137         $(INS.dir)
 138 
 139 lint:   lint_SRCS
 140 
 141 clean:
 142         $(RM) $(OBJS)
 143 
 144 include ../Makefile.targ