xref: /illumos-gate/usr/src/cmd/spell/Makefile (revision 8226594fdd4479be135127f43632f1f995074654)
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 := LD = $(NATIVELD)
79spellin1 hashmk1 := CFLAGS = $(NATIVE_CFLAGS)
80spellin1 hashmk1 := POST_PROCESS =
81spellin1 hashmk1 := CPPFLAGS =
82spellin1 hashmk1 := LDLIBS =
83spellin1 hashmk1 := LDFLAGS = $(BDIRECT)
84spellin1 hashmk1 := NATIVE_LIBS = libc.so
85
86$(ROOTSPELLD)/% $(ROOTVARADMD)/% : %
87	$(INS.file)
88
89.KEEP_STATE:
90
91all:	$(PROG) $(TXTS)
92
93spellprog:		$(SPELLPROGOBJ)
94			$(LINK.c) $(SPELLPROGOBJ) -o $@ $(LDLIBS)
95			$(POST_PROCESS)
96
97spellin spellin1:	$(SPELLINOBJ)
98			$(LINK.c) $(SPELLINOBJ) -o $@ $(LDLIBS)
99			$(POST_PROCESS)
100
101spellhist:
102			$(ECHO) '\c' > spellhist
103
104hashcheck:		$(HASHCHECKOBJ)
105			$(LINK.c) $(HASHCHECKOBJ) -o $@ $(LDLIBS)
106			$(POST_PROCESS)
107
108hashmake hashmk1:	$(HASHMAKEOBJ)
109			$(LINK.c) $(HASHMAKEOBJ) -o $@ $(LDLIBS)
110			$(POST_PROCESS)
111
112htemp1:	list local extra hashmk1
113	$(RM) $@; cat list local extra | $(_SH_) ./hashmk1 > $@
114
115hlista: american $(HASHPROG) htemp1
116	$(RM) htemp2a; ./hashmk1 <american |sort -u - htemp1 >htemp2a
117	$(RM) $@; ./spellin1 `wc htemp2a|sed -n 's/\([^ ]\) .*/\1/p'`<htemp2a >$@
118	$(RM) htemp2a
119
120hlistb: british $(HASHPROG) htemp1
121	$(RM) htemp2b; ./hashmk1 <british |sort -u - htemp1 >htemp2b
122	$(RM) $@; ./spellin1 `wc htemp2b|sed -n 's/\([^ ]\) .*/\1/p'`<htemp2b >$@
123	$(RM) htemp2b
124
125hstop:	stop $(HASHPROG)
126	$(RM) htemp2s; ./hashmk1 <stop | sort -u >htemp2s
127	$(RM) $@; ./spellin1 `wc htemp2s|sed -n 's/\([^ ]\) .*/\1/p'`<htemp2s >$@
128	$(RM) htemp2s
129
130install: all $(ROOTDIRS) $(ROOTBINF) $(ROOTSPELLF) $(ROOTVARADMF)
131
132$(ROOTDIRS):
133	$(INS.dir)
134
135lint:	lint_SRCS
136
137clean:
138	$(RM) $(OBJS)
139
140include ../Makefile.targ
141