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