xref: /illumos-gate/usr/src/cmd/spell/Makefile (revision 69a119caa6570c7077699161b7c28b6ee9f8b0f4)
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
27HASHPROG=	hashmk1 spellin1
28SHPROG=		spell compress
29HASHTAB=	hlista hlistb hstop
30BINPROG=	spellprog spellin hashmake hashcheck
31PROG=		$(SHPROG) $(BINPROG) $(HASHPROG) $(HASHTAB) spellhist
32
33SPELLPROGSRC=	spellprog.c hash.c hashlook.c huff.c
34SPELLPROGOBJ=	$(SPELLPROGSRC:%.c=%.o)
35
36SPELLINSRC=	spellin.c huff.c
37SPELLINOBJ=	$(SPELLINSRC:%.c=%.o)
38
39HASHCHECKSRC=	hashcheck.c hash.c huff.c
40HASHCHECKOBJ=	$(HASHCHECKSRC:%.c=%.o)
41
42HASHMAKESRC=	hashmake.c hash.c
43HASHMAKEOBJ=	$(HASHMAKESRC:%.c=%.o)
44
45SRCS= $(SPELLPROGSRC) spellin.c hashcheck.c hashmake.c
46OBJS= $(SRCS:%.c=%.o)
47
48WORDS=	american british local list extra stop
49TXTS=	compress.sh spell.sh
50
51include ../Makefile.cmd
52
53CFLAGS += $(CCVERBOSE)
54CERRWARN += -_gcc=-Wno-parentheses
55
56XGETFLAGS += -a -x spell.xcl
57
58CLOBBERFILES += htemp1 htemp2
59
60ROOTSPELLD = $(ROOTLIB)/spell
61ROOTVARADMD = $(ROOT)/var/adm
62ROOTDIRS= $(ROOTSPELLD)
63
64BINF= spell
65SPELLF= spellprog hashmake hashcheck spellin hstop hlistb hlista compress
66VARADMF= spellhist
67
68ROOTBINF = $(BINF:%=$(ROOTBIN)/%)
69ROOTSPELLF = $(SPELLF:%=$(ROOTSPELLD)/%)
70ROOTVARADMF = $(VARADMF:%=$(ROOTVARADMD)/%)
71
72HASHFILEMODE = 0644
73$(ROOTSPELLD)/hstop $(ROOTSPELLD)/hlistb \
74$(ROOTSPELLD)/hlista :=	FILEMODE =	0644
75$(ROOTVARADMF) :=	FILEMODE =	0666
76
77spellin1 hashmk1 := CC = $(NATIVECC)
78spellin1 hashmk1 := POST_PROCESS =
79spellin1 hashmk1 := CPPFLAGS =
80spellin1 hashmk1 := LDFLAGS =
81
82$(ROOTSPELLD)/% $(ROOTVARADMD)/% : %
83	$(INS.file)
84
85.KEEP_STATE:
86
87all: 	$(PROG) $(TXTS)
88
89spellprog:		$(SPELLPROGOBJ)
90			$(LINK.c) $(SPELLPROGOBJ) -o $@ $(LDLIBS)
91			$(POST_PROCESS)
92
93spellin spellin1:	$(SPELLINOBJ)
94			$(LINK.c) $(SPELLINOBJ) -o $@ $(LDLIBS)
95			$(POST_PROCESS)
96
97spellhist:
98			$(ECHO) '\c' > spellhist
99
100hashcheck:		$(HASHCHECKOBJ)
101			$(LINK.c) $(HASHCHECKOBJ) -o $@ $(LDLIBS)
102			$(POST_PROCESS)
103
104hashmake hashmk1:	$(HASHMAKEOBJ)
105			$(LINK.c) $(HASHMAKEOBJ) -o $@ $(LDLIBS)
106			$(POST_PROCESS)
107
108htemp1:	list local extra hashmk1
109	$(RM) $@; cat list local extra | $(_SH_) ./hashmk1 > $@
110
111hlista: american $(HASHPROG) htemp1
112	$(RM) htemp2; ./hashmk1 <american |sort -u - htemp1 >htemp2
113	$(RM) $@; ./spellin1 `wc htemp2|sed -n 's/\([^ ]\) .*/\1/p'`<htemp2 >$@
114	$(RM) htemp2
115
116hlistb: british $(HASHPROG) htemp1
117	$(RM) htemp2; ./hashmk1 <british |sort -u - htemp1 >htemp2
118	$(RM) $@; ./spellin1 `wc htemp2|sed -n 's/\([^ ]\) .*/\1/p'`<htemp2 >$@
119	$(RM) htemp2
120
121hstop:	stop $(HASHPROG)
122	$(RM) htemp2; ./hashmk1 <stop | sort -u >htemp2
123	$(RM) $@; ./spellin1 `wc htemp2|sed -n 's/\([^ ]\) .*/\1/p'`<htemp2 >$@
124	$(RM) htemp2
125
126install: all $(ROOTDIRS) $(ROOTBINF) $(ROOTSPELLF) $(ROOTVARADMF)
127
128$(ROOTDIRS):
129	$(INS.dir)
130
131lint:	lint_SRCS
132
133clean:
134	$(RM) $(OBJS)
135
136include ../Makefile.targ
137