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