xref: /illumos-gate/usr/src/cmd/ast/libast/Makefile.com (revision 33efde4275d24731ef87927237b0ffb0630b6b2d)
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
22#
23# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24#
25# Copyright (c) 2019, Joyent, Inc.
26# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
27
28SHELL= /usr/bin/ksh93
29
30LIBRARY= libast.a
31VERS= .1
32
33include ../Makefile.defs
34
35OBJECTS += $(LIBOBJS)
36
37include $(SRC)/lib/Makefile.lib
38include ../../Makefile.ast
39
40MAPFILES= ../mapfile-vers
41
42LIBS= $(DYNLIB)
43LDLIBS += -lm -lc -lsocket
44
45# We use "=" here since using $(CPPFLAGS.master) is very tricky in our
46# case - it MUST come as the last element but future changes in -D options
47# may then cause silent breakage in the AST sources because the last -D
48# option specified overrides previous -D options so we prefer the current
49# way to explicitly list each single flag.
50# Notes:
51#   - "-D_BLD_DLL" comes from ${mam_cc_DLL} in Mamfile
52#   - Be careful with "-D__OBSOLETE__=xxx". Make sure this is in sync with
53#     upstream (see Mamfile) and do not change the |__OBSOLETE__| value
54#     without examining the symbols that will be removed, and evaluating
55#     whether that breaks compatibility with upstream binaries.
56CPPFLAGS= \
57	$(DTEXTDOM) $(DTS_ERRNO) \
58	$(ASTPLATFORMCPPFLAGS) \
59	-Iast -I. \
60	-I$(ASTSRC) \
61	-I$(ASTSRC)/comp \
62	-I$(ASTSRC)/include \
63	-I$(ASTSRC)/std \
64	-I$(ASTSRC)/dir \
65	-I$(ASTSRC)/port \
66	-I$(ASTSRC)/sfio \
67	-I$(ASTSRC)/misc \
68	-I$(ASTSRC)/string \
69	-I$(ROOT)/usr/include \
70	'-DCONF_LIBSUFFIX=".so"' \
71	'-DCONF_LIBPREFIX="lib"' \
72	-DERROR_CATALOG=\""libast"\" \
73	-D__OBSOLETE__=20120101 \
74	-D_BLD_ast \
75	-D_PACKAGE_ast \
76	-D_BLD_DLL \
77	-D_AST_std_malloc=1
78
79CFLAGS += $(ASTCFLAGS)
80CFLAGS64 += $(ASTCFLAGS64)
81
82CERRWARN += -_gcc=-Wno-parentheses
83CERRWARN += $(CNOWARN_UNINIT)
84CERRWARN += -_gcc=-Wno-char-subscripts
85CERRWARN += -_gcc=-Wno-clobbered
86CERRWARN += -_gcc=-Wno-unused-variable
87CERRWARN += -_gcc=-Wno-unused-but-set-variable
88CERRWARN += -_gcc=-Wno-unused-but-set-parameter
89CERRWARN += -_gcc=-Wno-unused-value
90CERRWARN += -_gcc=-Wno-unused-function
91CERRWARN += -_gcc=-Wno-implicit-function-declaration
92CERRWARN += -_gcc=-Wno-empty-body
93CERRWARN += -_gcc=-Wno-type-limits
94CERRWARN += -_gcc=-Wno-address
95
96# It seems, we get false positives with following three files.
97# Since this is third party source, silencing this warning seems to be
98# reasonable path to take.
99pics/path/pathpath.o := CERRWARN += -_gcc10=-Wno-return-local-addr
100pics/path/pathpath.o := CERRWARN += -_gcc14=-Wno-return-local-addr
101pics/path/pathkey.o := CERRWARN += -_gcc10=-Wno-return-local-addr
102pics/path/pathkey.o := CERRWARN += -_gcc14=-Wno-return-local-addr
103pics/path/pathprobe.o := CERRWARN += -_gcc10=-Wno-return-local-addr
104pics/path/pathprobe.o := CERRWARN += -_gcc14=-Wno-return-local-addr
105
106# The code layout after macro expansion is upsetting gcc 14, silence it.
107pics/sfio/sfdisc.o := CERRWARN += -_gcc14=-Wno-misleading-indentation
108pics/sfio/sfstack.o := CERRWARN += -_gcc14=-Wno-misleading-indentation
109
110pics/port/astconf.o := CERRWARN += -_gcc=-Wno-unused-label
111
112SMATCH= off
113
114.KEEP_STATE:
115
116all: install_h mkpicdirs .WAIT $(LIBS)
117
118mkpicdirs:
119	@mkdir -p $(LOBJDIRS:%=pics/%)
120
121include $(SRC)/lib/Makefile.targ
122
123pics/%.o: $(ASTSRC)/%.c
124	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
125	$(POST_PROCESS_O)
126
127######################################################################
128# Header file generation
129
130ast/%:= FILEMODE= 0644
131
132# The HEADERGEN headers are generated from the corresponding FEATURE/ file
133# with any ast_ prefix removed.
134$(HEADERGEN:%=ast/%): $(FEATURES:%=FEATURE/%)
135	src=`echo $(@F:%.h=%) | sed 's/^ast_//'`; \
136	    $(AST_PROTO) FEATURE/$$src > $@
137	$(POST_PROCESS_AST)
138
139ast/prototyped.h: $(AST_TOOLS)/proto
140	$(MKDIR) -p $(@D)
141	$(AST_TOOLS)/proto -f /dev/null > $@
142
143ast/ast_common.h: ast/prototyped.h
144	$(AST_PROTO) FEATURE/common | $(GREP) -v 'define _def_map_' > $@
145	$(POST_PROCESS_AST)
146	$(CP) $@ .
147
148ast/lc.h: lc.h
149	$(AST_PROTO) lc.h > ast/lc.h
150
151ast/%.h: $(ASTSRC)/include/%.h
152	$(INS.file)
153	$(POST_PROCESS_AST)
154
155ast/%.h: $(ASTSRC)/comp/%.h
156	$(INS.file)
157	$(POST_PROCESS_AST)
158
159ast/%.h: $(ASTSRC)/cdt/%.h
160	$(INS.file)
161	$(POST_PROCESS_AST)
162
163ast/%.h: $(ASTSRC)/std/%.h
164	$(INS.file)
165	$(POST_PROCESS_AST)
166
167ast/ast_namval.h: $(ASTSRC)/include/namval.h
168	$(CP) $(ASTSRC)/include/namval.h $@
169	$(POST_PROCESS_AST)
170
171CLOBBERFILES += ast_common.h t.c
172CLOBBERFILES += ast/*
173
174install_h: ast/prototyped.h ast/ast_common.h ast/lc.h \
175	$(HEADERGEN:%=ast/%) $(HEADERSRC:%=ast/%)
176
177.PARALLEL: $(HEADERGEN:%=ast/%) $(HEADERSRC:%=ast/%)
178
179_feature: FRC
180	$(MAKE) -f Makefile.iffe generate
181
182include ../../Makefile.astmsg
183
184FRC:
185