xref: /illumos-gate/usr/src/cmd/ast/libast/Makefile.com (revision 3cff04e7)
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-unused-label
92CERRWARN += -_gcc=-Wno-implicit-function-declaration
93CERRWARN += -_gcc=-Wno-empty-body
94CERRWARN += -_gcc=-Wno-type-limits
95CERRWARN += -_gcc=-Wno-address
96
97# It seems, we get false positives with following three files.
98# Since this is third party source, silencing this warning seems to be
99# reasonable path to take.
100pics/path/pathpath.o := CERRWARN += -_gcc10=-Wno-return-local-addr
101pics/path/pathpath.o := CERRWARN += -_gcc11=-Wno-return-local-addr
102pics/path/pathkey.o := CERRWARN += -_gcc10=-Wno-return-local-addr
103pics/path/pathkey.o := CERRWARN += -_gcc11=-Wno-return-local-addr
104pics/path/pathprobe.o := CERRWARN += -_gcc10=-Wno-return-local-addr
105pics/path/pathprobe.o := CERRWARN += -_gcc11=-Wno-return-local-addr
106
107# The code layout after macro expansion is upsetting gcc 11, silence it.
108pics/sfio/sfdisc.o := CERRWARN += -_gcc11=-Wno-misleading-indentation
109pics/sfio/sfstack.o := CERRWARN += -_gcc11=-Wno-misleading-indentation
110
111SMATCH= off
112
113.KEEP_STATE:
114
115all: install_h mkpicdirs .WAIT $(LIBS)
116
117mkpicdirs:
118	@mkdir -p $(LOBJDIRS:%=pics/%)
119
120include $(SRC)/lib/Makefile.targ
121
122pics/%.o: $(ASTSRC)/%.c
123	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
124	$(POST_PROCESS_O)
125
126######################################################################
127# Header file generation
128
129ast/%:= FILEMODE= 0644
130
131# The HEADERGEN headers are generated from the corresponding FEATURE/ file
132# with any ast_ prefix removed.
133$(HEADERGEN:%=ast/%): $(FEATURES:%=FEATURE/%)
134	src=`echo $(@F:%.h=%) | sed 's/^ast_//'`; \
135	    $(AST_PROTO) FEATURE/$$src > $@
136	$(POST_PROCESS_AST)
137
138ast/prototyped.h: $(AST_TOOLS)/proto
139	$(MKDIR) -p $(@D)
140	$(AST_TOOLS)/proto -f /dev/null > $@
141
142ast/ast_common.h: ast/prototyped.h
143	$(AST_PROTO) FEATURE/common | $(GREP) -v 'define _def_map_' > $@
144	$(POST_PROCESS_AST)
145	$(CP) $@ .
146
147ast/lc.h: lc.h
148	$(AST_PROTO) lc.h > ast/lc.h
149
150ast/%.h: $(ASTSRC)/include/%.h
151	$(INS.file)
152	$(POST_PROCESS_AST)
153
154ast/%.h: $(ASTSRC)/comp/%.h
155	$(INS.file)
156	$(POST_PROCESS_AST)
157
158ast/%.h: $(ASTSRC)/cdt/%.h
159	$(INS.file)
160	$(POST_PROCESS_AST)
161
162ast/%.h: $(ASTSRC)/std/%.h
163	$(INS.file)
164	$(POST_PROCESS_AST)
165
166ast/ast_namval.h: $(ASTSRC)/include/namval.h
167	$(CP) $(ASTSRC)/include/namval.h $@
168	$(POST_PROCESS_AST)
169
170CLOBBERFILES += ast_common.h t.c
171CLOBBERFILES += ast/*
172
173install_h: ast/prototyped.h ast/ast_common.h ast/lc.h \
174	$(HEADERGEN:%=ast/%) $(HEADERSRC:%=ast/%)
175
176.PARALLEL: $(HEADERGEN:%=ast/%) $(HEADERSRC:%=ast/%)
177
178_feature: FRC
179	$(MAKE) -f Makefile.iffe generate
180
181include ../../Makefile.astmsg
182
183FRC:
184