xref: /illumos-gate/usr/src/cmd/ast/libast/Makefile.com (revision cf409e3f26ef8db450f46ba9760eb9734f603ae0)
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/pathkey.o := CERRWARN += -_gcc10=-Wno-return-local-addr
102pics/path/pathprobe.o := CERRWARN += -_gcc10=-Wno-return-local-addr
103
104SMATCH= off
105
106.KEEP_STATE:
107
108all: install_h mkpicdirs .WAIT $(LIBS)
109
110mkpicdirs:
111	@mkdir -p $(LOBJDIRS:%=pics/%)
112
113include $(SRC)/lib/Makefile.targ
114
115pics/%.o: $(ASTSRC)/%.c
116	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
117	$(POST_PROCESS_O)
118
119######################################################################
120# Header file generation
121
122ast/%:= FILEMODE= 0644
123
124# The HEADERGEN headers are generated from the corresponding FEATURE/ file
125# with any ast_ prefix removed.
126$(HEADERGEN:%=ast/%): $(FEATURES:%=FEATURE/%)
127	src=`echo $(@F:%.h=%) | sed 's/^ast_//'`; \
128	    $(AST_PROTO) FEATURE/$$src > $@
129	$(POST_PROCESS_AST)
130
131ast/prototyped.h: $(AST_TOOLS)/proto
132	$(MKDIR) -p $(@D)
133	$(AST_TOOLS)/proto -f /dev/null > $@
134
135ast/ast_common.h: ast/prototyped.h
136	$(AST_PROTO) FEATURE/common | $(GREP) -v 'define _def_map_' > $@
137	$(POST_PROCESS_AST)
138	$(CP) $@ .
139
140ast/lc.h: lc.h
141	$(AST_PROTO) lc.h > ast/lc.h
142
143ast/%.h: $(ASTSRC)/include/%.h
144	$(INS.file)
145	$(POST_PROCESS_AST)
146
147ast/%.h: $(ASTSRC)/comp/%.h
148	$(INS.file)
149	$(POST_PROCESS_AST)
150
151ast/%.h: $(ASTSRC)/cdt/%.h
152	$(INS.file)
153	$(POST_PROCESS_AST)
154
155ast/%.h: $(ASTSRC)/std/%.h
156	$(INS.file)
157	$(POST_PROCESS_AST)
158
159ast/ast_namval.h: $(ASTSRC)/include/namval.h
160	$(CP) $(ASTSRC)/include/namval.h $@
161	$(POST_PROCESS_AST)
162
163CLOBBERFILES += ast_common.h t.c
164CLOBBERFILES += ast/*
165
166install_h: ast/prototyped.h ast/ast_common.h ast/lc.h \
167	$(HEADERGEN:%=ast/%) $(HEADERSRC:%=ast/%)
168
169.PARALLEL: $(HEADERGEN:%=ast/%) $(HEADERSRC:%=ast/%)
170
171_feature: FRC
172	$(MAKE) -f Makefile.iffe generate
173
174include ../../Makefile.astmsg
175
176FRC:
177