xref: /titanic_51/usr/src/cmd/ast/libcmd/Makefile.com (revision b4dd7d09880f14016feece03929a224eca1cf39a)
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 2021 OmniOS Community Edition (OmniOSce) Association.
26
27SHELL= /usr/bin/ksh93
28
29LIBRARY= libcmd.a
30VERS= .1
31
32include ../Makefile.defs
33
34OBJECTS += $(LIBOBJS)
35
36include $(SRC)/lib/Makefile.lib
37include ../../Makefile.ast
38
39MAPFILES= ../mapfile-vers
40
41LIBS= $(DYNLIB)
42
43LDLIBS += -lsum -last -lsocket -lnsl -lc
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.
50CPPFLAGS= \
51	$(DTEXTDOM) $(DTS_ERRNO) \
52	-I$(ASTSRC) \
53	-Iast -I. \
54	-I$(ROOT)/usr/include/ast \
55	-I$(ROOT)/usr/include \
56	-D_BLD_cmd \
57	-D_PACKAGE_ast \
58	-D_BLD_DLL \
59	'-DERROR_CATALOG="libcmd"' \
60	'-DUSAGE_LICENSE=\
61	    "[-author?Glenn Fowler <gsf@research.att.com>]"\
62	    "[-author?David Korn <dgk@research.att.com>]"\
63	    "[-copyright?Copyright (c) 1992-2012 AT&T Intellectual Property]"\
64	    "[-license?http://www.eclipse.org/org/documents/epl-v10.html]"\
65	    "[--catalog?libcmd]"'
66
67CFLAGS += $(ASTCFLAGS)
68CFLAGS64 += $(ASTCFLAGS64)
69
70CERRWARN	+= -_gcc=-Wno-unused-value
71CERRWARN	+= -_gcc=-Wno-parentheses
72CERRWARN	+= -_gcc=-Wno-uninitialized
73CERRWARN	+= -_gcc=-Wno-unused-variable
74CERRWARN	+= -_gcc=-Wno-implicit-function-declaration
75
76all: install_h .WAIT $(LIBS)
77
78#
79# libcmd is not lint-clean yet; fake up a target.  (You can use
80# "make lintcheck" to actually run lint; please send all lint fixes
81# upstream (to AT&T) so the next update will pull them into ON.)
82#
83lint:
84	@ print "usr/src/lib/libcmd is not lint-clean: skipping"
85
86include $(SRC)/lib/Makefile.targ
87
88pics/%.o: $(ASTSRC)/%.c
89	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
90	$(POST_PROCESS_O)
91
92######################################################################
93# Header file generation
94
95$(HEADERSRC:%=ast/%): FRC
96	$(MKDIR) -p $(@D)
97	$(CP) $(ASTSRC)/$(@F) $@
98
99# This rule is derived from $(CONTRIB)/ast/src/lib/libcmd/Makefile
100ast/cmdext.h:
101	$(MKDIR) -p $(@D)
102	echo '#include <shcmd.h>' > $@.tmp
103	$(SED) \
104	    -e '/^b_[a-z_][a-z_0-9]*(/!d' \
105	    -e 's/^b_//' \
106	    -e 's/(.*//' \
107	    -e 's/.*/extern int     b_&(int, char**, Shbltin_t*);/' \
108	    $(OBJECTS:%.o=$(ASTSRC)/%.c) | \
109	    $(SORT) -u \
110	    >> $@.tmp
111	$(AST_PROTO) -f $@.tmp >> $@
112	rm -f $@.tmp
113	$(POST_PROCESS_AST) $@
114
115CLOBBERFILES += ast/*
116
117install_h: $(HEADERSRC:%=ast/%) $(HEADERGEN:%=ast/%)
118
119.PARALLEL: $(HEADERSRC:%=ast/%) $(HEADERGEN:%=ast/%)
120
121_feature: FRC
122	$(MAKE) -f Makefile.iffe generate
123
124include ../../Makefile.astmsg
125
126FRC:
127