1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Copyright (c) 2019, Joyent, Inc.
#
LIB = geniconvtbl.so
PROG = geniconvtbl
SRCDIR = $(SRC)/cmd/geniconvtbl
MAPFILE = $(SRCDIR)/mapfile
OBJS = itmcomp.o assemble.o disassemble.o itm_util.o y.tab.o lex.yy.o
MSGFILES = itmcomp.i assemble.i disassemble.i itm_util.i y.tab.i lex.yy.i geniconvtbl.i
include $(SRC)/cmd/Makefile.cmd
POFILE = geniconvtbl_.po
ROOTDIRS32= $(ROOTLIB)/iconv
# Hammerhead: flattened — no amd64 subdir
ROOTDIRS64= $(ROOTLIB)/iconv
ROOTLIB32 = $(ROOTDIRS32)/$(LIB)
ROOTLIB64 = $(ROOTDIRS64)/$(LIB)
CLOBBERFILES= $(LIB)
CLEANFILES = $(OBJS) y.tab.c y.tab.h lex.yy.c \
$(POFILE)
CPPFLAGS += -I. -I$(SRCDIR)
CERRWARN += $(CNOWARN_UNINIT)
CERRWARN += -Wno-switch
CERRWARN += -Wno-unused-variable
CERRWARN += -Wno-implicit-function-declaration
YFLAGS += -d
CFLAGS += -D_FILE_OFFSET_BITS=64
# because of labels from yacc
lex.yy.o : CERRWARN += -Wno-unused-label
y.tab.o : CERRWARN += -Wno-unused-label
# dump_expr() is too hairy
SMATCH=off
$(LIB) : LDFLAGS += $(GSHARED) -Wl,-h$@ $(ZTEXT) $(ZDEFS) $(BDIRECT) \
$(C_PICFLAGS) $(MAPFILE:%=-Wl,-M%) \
$(MAPFILE.PGA:%=-Wl,-M%) $(MAPFILE.NED:%=-Wl,-M%)
$(LIB) : CPPFLAGS += -D_REENTRANT
$(LIB) : LDLIBS += -lc
$(PROG) : LDLIBS += -lgen
.KEEP_STATE:
.PARALLEL: $(LIB) $(OBJS)
$(PROG): $(OBJS)
$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
$(POST_PROCESS)
$(LIB): $(SRCDIR)/geniconvtbl.c
$(LINK.c) -o $@ $(SRCDIR)/geniconvtbl.c $(LDLIBS)
$(POST_PROCESS_SO)
# Hammerhead: GNU Make grouped target (was dmake +)
y.tab.c y.tab.h &: $(SRCDIR)/itm_comp.y
$(YACC) $(YFLAGS) $(SRCDIR)/itm_comp.y
@ $(MV) y.tab.c y.tab.c~
@ $(SED) -f $(SRCDIR)/yacc.sed y.tab.c~ > y.tab.c
@ $(RM) y.tab.c~
lex.yy.c: $(SRCDIR)/itm_comp.l y.tab.h
$(LEX) -t $(SRCDIR)/itm_comp.l | $(SED) -f $(SRCDIR)/lex.sed > $(@)
clean:
$(RM) $(CLEANFILES)
$(POFILE): $(MSGFILES)
$(BUILDPO.msgfiles)
%.o: %.c
$(COMPILE.c) $<
%.o: $(SRCDIR)/%.c
$(COMPILE.c) $<
%.i: $(SRCDIR)/%.c
$(CPPFORPO) $< > $@
# install rule
# Hammerhead: order-only prerequisite so $< is the file, not the directory
$(ROOTDIRS32)/%: % | $(ROOTDIRS32)
$(INS.file)
# Hammerhead: order-only prerequisite so $< is the file, not the directory
$(ROOTDIRS64)/%: % | $(ROOTDIRS64)
$(INS.file)
# Hammerhead: ROOTDIRS64 = ROOTDIRS32 (flattened), single rule
$(ROOTDIRS32): $(ROOTLIB)
$(INS.dir)
include $(SRC)/cmd/Makefile.targ
include $(SRC)/Makefile.msg.targ
|