xref: /illumos-gate/usr/src/cmd/geniconvtbl/Makefile.com (revision f3f00a64aacc2afa89bdcb978f1263b796aea6b0)
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
27LIB	= geniconvtbl.so
28PROG	= geniconvtbl
29
30SRCDIR  = $(SRC)/cmd/geniconvtbl
31
32MAPFILE	= $(SRCDIR)/mapfile
33
34OBJS    = itmcomp.o assemble.o disassemble.o itm_util.o y.tab.o lex.yy.o
35MSGFILES = itmcomp.i assemble.i disassemble.i itm_util.i y.tab.i lex.yy.i geniconvtbl.i
36
37include $(SRC)/cmd/Makefile.cmd
38
39POFILE	= geniconvtbl_.po
40
41ROOTDIRS32=	$(ROOTLIB)/iconv
42ROOTDIRS64=	$(ROOTLIB)/iconv/$(MACH64)
43ROOTLIB32 =	$(ROOTDIRS32)/$(LIB)
44ROOTLIB64 =	$(ROOTDIRS64)/$(LIB)
45
46CLOBBERFILES=	$(LIB)
47CLEANFILES =	$(OBJS) y.tab.c y.tab.h lex.yy.c \
48		$(POFILE)
49
50CPPFLAGS	+= -I. -I$(SRCDIR)
51CERRWARN	+= $(CNOWARN_UNINIT)
52CERRWARN	+= -_gcc=-Wno-unused-label
53CERRWARN	+= -_gcc=-Wno-switch
54CERRWARN	+= -_gcc=-Wno-unused-variable
55CERRWARN	+= -_gcc=-Wno-implicit-function-declaration
56YFLAGS		+= -d
57CFLAGS		+= -D_FILE_OFFSET_BITS=64
58
59# dump_expr() is too hairy
60SMATCH=off
61
62$(LIB) :=	LDFLAGS += $(GSHARED) -h$@ $(ZTEXT) $(ZDEFS) $(BDIRECT) \
63		$(C_PICFLAGS) $(MAPFILE:%=-Wl,-M%)			\
64		$(MAPFILE.PGA:%=-Wl,-M%) $(MAPFILE.NED:%=-Wl,-M%)
65$(LIB) :=	CPPFLAGS += -D_REENTRANT
66$(LIB) :=	sparc_CFLAGS += -xregs=no%appl
67$(LIB) :=	sparcv9_CFLAGS += -xregs=no%appl
68$(LIB) :=	LDLIBS += -lc
69
70$(PROG) :=	LDLIBS += -lgen
71
72.KEEP_STATE:
73
74.PARALLEL: $(LIB) $(OBJS)
75
76$(PROG): $(OBJS)
77	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
78	$(POST_PROCESS)
79
80$(LIB): $(SRCDIR)/geniconvtbl.c
81	$(LINK.c) -o $@ $(SRCDIR)/geniconvtbl.c $(LDLIBS)
82	$(POST_PROCESS_SO)
83
84y.tab.c + y.tab.h: $(SRCDIR)/itm_comp.y
85	$(YACC) $(YFLAGS) $(SRCDIR)/itm_comp.y
86	@ $(MV) y.tab.c y.tab.c~
87	@ $(SED) -f  $(SRCDIR)/yacc.sed y.tab.c~ > y.tab.c
88	@ $(RM) y.tab.c~
89
90lex.yy.c: $(SRCDIR)/itm_comp.l y.tab.h
91	$(LEX) -t $(SRCDIR)/itm_comp.l | $(SED) -f $(SRCDIR)/lex.sed > $(@)
92
93clean:
94	$(RM) $(CLEANFILES)
95
96$(POFILE): $(MSGFILES)
97	$(BUILDPO.msgfiles)
98
99%.o:	%.c
100	$(COMPILE.c) $<
101
102%.o:	$(SRCDIR)/%.c
103	$(COMPILE.c) $<
104
105%.i:	$(SRCDIR)/%.c
106	$(CPPFORPO) $< > $@
107
108# install rule
109$(ROOTDIRS32)/%: $(ROOTDIRS32) %
110	$(INS.file)
111
112$(ROOTDIRS64)/%: $(ROOTDIRS64) %
113	$(INS.file)
114
115$(ROOTDIRS32): $(ROOTLIB)
116	$(INS.dir)
117
118$(ROOTDIRS64): $(ROOTDIRS32)
119	$(INS.dir)
120
121include $(SRC)/cmd/Makefile.targ
122include $(SRC)/Makefile.msg.targ
123