xref: /illumos-gate/usr/src/cmd/geniconvtbl/Makefile.com (revision 5c58caeac352c4d3ed663d574c60d6a0e998d2ba)
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-switch
53CERRWARN	+= -_gcc=-Wno-unused-variable
54CERRWARN	+= -_gcc=-Wno-implicit-function-declaration
55YFLAGS		+= -d
56CFLAGS		+= -D_FILE_OFFSET_BITS=64
57
58# because of labels from yacc
59lex.yy.o := CERRWARN += -_gcc=-Wno-unused-label
60y.tab.o := CERRWARN += -_gcc=-Wno-unused-label
61
62# dump_expr() is too hairy
63SMATCH=off
64
65$(LIB) :=	LDFLAGS += $(GSHARED) -Wl,-h$@ $(ZTEXT) $(ZDEFS) $(BDIRECT) \
66		$(C_PICFLAGS) $(MAPFILE:%=-Wl,-M%)			\
67		$(MAPFILE.PGA:%=-Wl,-M%) $(MAPFILE.NED:%=-Wl,-M%)
68$(LIB) :=	CPPFLAGS += -D_REENTRANT
69$(LIB) :=	LDLIBS += -lc
70
71$(PROG) :=	LDLIBS += -lgen
72
73.KEEP_STATE:
74
75.PARALLEL: $(LIB) $(OBJS)
76
77$(PROG): $(OBJS)
78	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
79	$(POST_PROCESS)
80
81$(LIB): $(SRCDIR)/geniconvtbl.c
82	$(LINK.c) -o $@ $(SRCDIR)/geniconvtbl.c $(LDLIBS)
83	$(POST_PROCESS_SO)
84
85y.tab.c + y.tab.h: $(SRCDIR)/itm_comp.y
86	$(YACC) $(YFLAGS) $(SRCDIR)/itm_comp.y
87	@ $(MV) y.tab.c y.tab.c~
88	@ $(SED) -f  $(SRCDIR)/yacc.sed y.tab.c~ > y.tab.c
89	@ $(RM) y.tab.c~
90
91lex.yy.c: $(SRCDIR)/itm_comp.l y.tab.h
92	$(LEX) -t $(SRCDIR)/itm_comp.l | $(SED) -f $(SRCDIR)/lex.sed > $(@)
93
94clean:
95	$(RM) $(CLEANFILES)
96
97$(POFILE): $(MSGFILES)
98	$(BUILDPO.msgfiles)
99
100%.o:	%.c
101	$(COMPILE.c) $<
102
103%.o:	$(SRCDIR)/%.c
104	$(COMPILE.c) $<
105
106%.i:	$(SRCDIR)/%.c
107	$(CPPFORPO) $< > $@
108
109# install rule
110$(ROOTDIRS32)/%: $(ROOTDIRS32) %
111	$(INS.file)
112
113$(ROOTDIRS64)/%: $(ROOTDIRS64) %
114	$(INS.file)
115
116$(ROOTDIRS32): $(ROOTLIB)
117	$(INS.dir)
118
119$(ROOTDIRS64): $(ROOTDIRS32)
120	$(INS.dir)
121
122include $(SRC)/cmd/Makefile.targ
123include $(SRC)/Makefile.msg.targ
124