xref: /illumos-gate/usr/src/cmd/geniconvtbl/Makefile.com (revision dc5e7685b131559c0b7c622baee25a9a0ae50ada)
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#
79# definition for some useful target like clean,
80OBJS	= $(SRCSC1:%.c=%.o) $(YTABC:.c=.o) $(LEXYY:.c=.o)
81
82CHECKHDRS = $(HDRS%.h=%.check)
83
84CLOBBERFILES=	$(ITM) $(SRCYC)
85CLEANFILES = 	$(OBJS) $(YTABC) $(YTABH) $(LEXYY) $(YOUT) \
86		$(POFILES) $(POFILE)
87
88CPPFLAGS	+= -I. -I..
89CERRWARN	+= -_gcc=-Wno-uninitialized
90CERRWARN	+= -_gcc=-Wno-unused-label
91CERRWARN	+= -_gcc=-Wno-switch
92CERRWARN	+= -_gcc=-Wno-unused-variable
93CERRWARN	+= -_gcc=-Wno-implicit-function-declaration
94YFLAGS		+= -d -v
95CFLAGS 		+= -D_FILE_OFFSET_BITS=64
96
97# dump_expr() is too hairy
98SMATCH=off
99
100$(ITM) :=	CFLAGS += $(GSHARED) $(C_PICFLAGS) $(ZTEXT) -h$@
101$(ITM) :=	CPPFLAGS += -D_REENTRANT
102$(ITM) :=	sparc_CFLAGS += -xregs=no%appl
103$(ITM) :=	sparcv9_CFLAGS += -xregs=no%appl
104
105LDLIBS += -lgen
106
107MY_NATIVE_CPPFLAGS = -D_FILE_OFFSET_BITS=64 -I. -I..
108MY_NATIVE_LDFLAGS = $(MAPFILE.NES:%=-M%) $(MAPFILE.PGA:%=-M%) $(MAPFILE.NED:%=-M%)
109MY_NATIVE_LDLIBS = -lgen
110
111#
112# Message catalog
113#
114POFILES= $(SRCSC1:%.c=%.po) $(SRCI1:%.c=%.po) \
115		$(SRCY1:%.y=%.po) $(SRCL1:%.l=%.po)
116
117POFILE= geniconvtbl_.po
118
119
120
121
122
123.KEEP_STATE:
124
125.PARALLEL: $(ITM) $(OBJS)
126
127$(PROG): $(OBJS)
128	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
129	$(POST_PROCESS)
130
131$(ITM): $(SRCI)
132	$(CC) $(CFLAGS) $(CPPFLAGS) -M$(MAPFILE) -o $@ $(SRCI) $(LDLIBS)
133	$(POST_PROCESS_SO)
134
135$(YTABC) $(YTABH): $(SRCY)
136	$(YACC) $(YFLAGS) $(SRCY)
137	@ $(MV) $(YTABC) $(YTABC)~
138	@ $(SED) -f $(YACCSED) $(YTABC)~ > $(YTABC)
139	@ $(RM) $(YTABC)~
140
141$(LEXYY): $(SRCL) $(YTABH)
142	$(LEX) -t $(SRCL) | $(SED) -f $(LEXSED) > $(LEXYY)
143
144
145$(POFILE):  .WAIT $(POFILES)
146	$(RM) $@
147	$(CAT) $(POFILES) >$@
148
149$(POFILES): $(SRCSC) $(SRCI) $(SRCY) $(SRCL)
150
151%.po:	../%.c
152	$(COMPILE.cpp) $<  > $<.i
153	$(BUILD.po)
154
155
156lint : lint_SRCS1  lint_SRCS2
157
158
159lint_SRCS1: $(SRCS)
160	$(LINT.c) $(SRCS) $(LDLIBS)
161
162lint_SRCS2: $(SRCI)
163	$(LINT.c) $(SRCI) $(LDLIBS)
164
165
166
167hdrchk: $(HDRCHECKS)
168
169cstyle: $(SRCS)
170	$(DOT_C_CHECK)
171
172clean:
173	$(RM) $(CLEANFILES)
174
175debug:
176	$(MAKE)	all COPTFLAG='' COPTFLAG64='' CFLAGS='-g -DDEBUG'
177
178
179%.o:	%.c
180	$(COMPILE.c) $<
181
182%.o:	../%.c
183	$(COMPILE.c) $<
184
185
186
187# install rule
188#
189$(ROOTDIRS32)/%: $(ROOTDIRS32) %
190	-$(INS.file)
191
192$(ROOTDIRS64)/%: $(ROOTDIRS64) %
193	-$(INS.file)
194
195$(ROOTDIRS32): $(ROOTLIB)
196	-$(INS.dir)
197
198$(ROOTDIRS64): $(ROOTDIRS32)
199	-$(INS.dir)
200
201$(ROOTLIB) $(ROOTBIN):
202	-$(INS.dir)
203
204include ../../Makefile.targ
205
206