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# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# Use is subject to license terms.
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28# cmd/geniconvtbl/Makefile.com
29
30
31ITM	= geniconvtbl.so
32PROG	= geniconvtbl
33NATIVEPROG=	$(PROG).native
34$(NATIVEPROG) :=        CC=$(NATIVECC)
35$(NATIVEPROG) :=        CPPFLAGS= -I. -I..
36$(NATIVEPROG) :=        LDLIBS= -lgen
37
38SRCSH1  = iconv_tm.h hash.h
39SRCCH1  = itmcomp.h itm_util.h maptype.h
40SRCSC1  = itmcomp.c assemble.c disassemble.c itm_util.c
41SRCY1   = itm_comp.y
42SRCL1   = itm_comp.l
43SRCI1   = geniconvtbl.c
44
45
46YTABC   = y.tab.c
47YTABH   = y.tab.h
48LEXYY   = lex.yy.c
49YOUT    = y.output
50MAPFILE	= ../mapfile
51
52
53
54SRCSH	= $(SRCSH1:%.h=../%.h)
55SRCCH	= $(SRCCH1:%.h=../%.h)
56SRCSC	= $(SRCSC1:%.c=../%.c)
57SRCI	= $(SRCI1:%.c=../%.c)
58SRCY    = $(SRCY1:%.y=../%.y)
59SRCL    = $(SRCL1:%.l=../%.l)
60
61SRCYC	= $(SRCY:%.y=%.c)
62SRCLC	= $(SRCL:%.l=%.c)
63
64SRCS    = $(SRCSC) $(YTABC) $(LEXYY)
65HDRS	= $(SRCCH1) $(ERNOSTRH)
66
67
68
69SED	= sed
70LEXSED	= ../lex.sed
71YACCSED	= ../yacc.sed
72
73
74
75# include ../../../lib/Makefile.lib
76include ../../Makefile.cmd
77
78
79ROOTDIRS32=	$(ROOTLIB)/iconv
80ROOTDIRS64=	$(ROOTLIB)/iconv/$(MACH64)
81ROOTITM32 =	$(ROOTDIRS32)/$(ITM)
82ROOTITM64 =	$(ROOTDIRS64)/$(ITM)
83
84#
85# definition for some useful target like clean,
86OBJS	= $(SRCSC1:%.c=%.o) $(YTABC:.c=.o) $(LEXYY:.c=.o)
87
88CHECKHDRS = $(HDRS%.h=%.check)
89
90CLOBBERFILES=	$(ITM) $(NATIVEPROG)
91CLEANFILES = 	$(OBJS) $(YTABC) $(YTABH) $(LEXYY) $(YOUT) \
92		$(POFILES) $(POFILE)
93
94CPPFLAGS	+= -I. -I..
95YFLAGS		+= -d -v
96CFLAGS 		+= -D_FILE_OFFSET_BITS=64
97
98$(ITM) :=	CFLAGS += $(GSHARED) $(C_PICFLAGS) $(ZTEXT) -h $@
99$(ITM) :=	CPPFLAGS += -D_REENTRANT
100$(ITM) :=	sparc_CFLAGS += -xregs=no%appl
101$(ITM) :=	sparcv9_CFLAGS += -xregs=no%appl
102
103LDLIBS += -lgen
104
105#
106# Message catalog
107#
108POFILES= $(SRCSC1:%.c=%.po) $(SRCI1:%.c=%.po) \
109		$(SRCY1:%.y=%.po) $(SRCL1:%.l=%.po)
110
111POFILE= geniconvtbl_.po
112
113
114
115
116
117.KEEP_STATE:
118
119.PARALLEL: $(ITM) $(OBJS)
120
121$(PROG): $(OBJS)
122	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
123	$(POST_PROCESS)
124
125$(NATIVEPROG): $(SRCS)
126	$(LINK.c) $(SRCS) -o $@ $(LDLIBS)
127
128$(ITM): $(SRCI)
129	$(CC) $(CFLAGS) $(CPPFLAGS) -M$(MAPFILE) -o $@ $(SRCI) $(LDLIBS)
130	$(POST_PROCESS_SO)
131
132$(YTABC) $(YTABH): $(SRCY)
133	$(YACC) $(YFLAGS) $(SRCY)
134	@ $(MV) $(YTABC) $(YTABC)~
135	@ $(SED) -f $(YACCSED) $(YTABC)~ > $(YTABC)
136	@ $(RM) $(YTABC)~
137
138$(LEXYY): $(SRCL) $(YTABH)
139	$(LEX) -t $(SRCL) | $(SED) -f $(LEXSED) > $(LEXYY)
140
141
142$(POFILE):  .WAIT $(POFILES)
143	$(RM) $@
144	$(CAT) $(POFILES) >$@
145
146$(POFILES): $(SRCSC) $(SRCI) $(SRCY) $(SRCL)
147
148%.po:	../%.c
149	$(COMPILE.cpp) $<  > $<.i
150	$(BUILD.po)
151
152
153lint : lint_SRCS1  lint_SRCS2
154
155
156lint_SRCS1: $(SRCS)
157	$(LINT.c) $(SRCS) $(LDLIBS)
158
159lint_SRCS2: $(SRCI)
160	$(LINT.c) $(SRCI) $(LDLIBS)
161
162
163
164hdrchk: $(HDRCHECKS)
165
166cstyle: $(SRCS)
167	$(DOT_C_CHECK)
168
169clean:
170	$(RM) $(CLEANFILES)
171
172debug:
173	$(MAKE)	all COPTFLAG='' COPTFLAG64='' CFLAGS='-g -DDEBUG'
174
175
176%.o:	%.c
177	$(COMPILE.c) $<
178
179%.o:	../%.c
180	$(COMPILE.c) $<
181
182
183
184# install rule
185#
186$(ROOTDIRS32)/%: $(ROOTDIRS32) %
187	-$(INS.file)
188
189$(ROOTDIRS64)/%: $(ROOTDIRS64) %
190	-$(INS.file)
191
192$(ROOTDIRS32): $(ROOTLIB)
193	-$(INS.dir)
194
195$(ROOTDIRS64): $(ROOTDIRS32)
196	-$(INS.dir)
197
198$(ROOTLIB) $(ROOTBIN):
199	-$(INS.dir)
200
201include ../../Makefile.targ
202
203