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