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