xref: /titanic_52/usr/src/cmd/ast/libcmd/Makefile.com (revision 906afcb89d0412cc073b95c2d701a804a8cdb62c)
1*906afcb8SAndy Fiddaman#
2*906afcb8SAndy Fiddaman# CDDL HEADER START
3*906afcb8SAndy Fiddaman#
4*906afcb8SAndy Fiddaman# The contents of this file are subject to the terms of the
5*906afcb8SAndy Fiddaman# Common Development and Distribution License (the "License").
6*906afcb8SAndy Fiddaman# You may not use this file except in compliance with the License.
7*906afcb8SAndy Fiddaman#
8*906afcb8SAndy Fiddaman# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*906afcb8SAndy Fiddaman# or http://www.opensolaris.org/os/licensing.
10*906afcb8SAndy Fiddaman# See the License for the specific language governing permissions
11*906afcb8SAndy Fiddaman# and limitations under the License.
12*906afcb8SAndy Fiddaman#
13*906afcb8SAndy Fiddaman# When distributing Covered Code, include this CDDL HEADER in each
14*906afcb8SAndy Fiddaman# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*906afcb8SAndy Fiddaman# If applicable, add the following below this CDDL HEADER, with the
16*906afcb8SAndy Fiddaman# fields enclosed by brackets "[]" replaced with your own identifying
17*906afcb8SAndy Fiddaman# information: Portions Copyright [yyyy] [name of copyright owner]
18*906afcb8SAndy Fiddaman#
19*906afcb8SAndy Fiddaman# CDDL HEADER END
20*906afcb8SAndy Fiddaman#
21*906afcb8SAndy Fiddaman
22*906afcb8SAndy Fiddaman#
23*906afcb8SAndy Fiddaman# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24*906afcb8SAndy Fiddaman#
25*906afcb8SAndy Fiddaman# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
26*906afcb8SAndy Fiddaman
27*906afcb8SAndy FiddamanSHELL= /usr/bin/ksh93
28*906afcb8SAndy Fiddaman
29*906afcb8SAndy FiddamanLIBRARY= libcmd.a
30*906afcb8SAndy FiddamanVERS= .1
31*906afcb8SAndy Fiddaman
32*906afcb8SAndy Fiddamaninclude ../Makefile.defs
33*906afcb8SAndy Fiddaman
34*906afcb8SAndy FiddamanOBJECTS += $(LIBOBJS)
35*906afcb8SAndy Fiddaman
36*906afcb8SAndy Fiddamaninclude $(SRC)/lib/Makefile.lib
37*906afcb8SAndy Fiddamaninclude ../../Makefile.ast
38*906afcb8SAndy Fiddaman
39*906afcb8SAndy FiddamanMAPFILES= ../mapfile-vers
40*906afcb8SAndy Fiddaman
41*906afcb8SAndy FiddamanLIBS= $(DYNLIB)
42*906afcb8SAndy Fiddaman
43*906afcb8SAndy FiddamanLDLIBS += -lsum -last -lsocket -lnsl -lc
44*906afcb8SAndy Fiddaman
45*906afcb8SAndy Fiddaman# We use "=" here since using $(CPPFLAGS.master) is very tricky in our
46*906afcb8SAndy Fiddaman# case - it MUST come as the last element but future changes in -D options
47*906afcb8SAndy Fiddaman# may then cause silent breakage in the AST sources because the last -D
48*906afcb8SAndy Fiddaman# option specified overrides previous -D options so we prefer the current
49*906afcb8SAndy Fiddaman# way to explicitly list each single flag.
50*906afcb8SAndy FiddamanCPPFLAGS= \
51*906afcb8SAndy Fiddaman	$(DTEXTDOM) $(DTS_ERRNO) \
52*906afcb8SAndy Fiddaman	-I$(ASTSRC) \
53*906afcb8SAndy Fiddaman	-Iast -I. \
54*906afcb8SAndy Fiddaman	-I$(ROOT)/usr/include/ast \
55*906afcb8SAndy Fiddaman	-I$(ROOT)/usr/include \
56*906afcb8SAndy Fiddaman	-D_BLD_cmd \
57*906afcb8SAndy Fiddaman	-D_PACKAGE_ast \
58*906afcb8SAndy Fiddaman	-D_BLD_DLL \
59*906afcb8SAndy Fiddaman	'-DERROR_CATALOG="libcmd"' \
60*906afcb8SAndy Fiddaman	'-DUSAGE_LICENSE=\
61*906afcb8SAndy Fiddaman	    "[-author?Glenn Fowler <gsf@research.att.com>]"\
62*906afcb8SAndy Fiddaman	    "[-author?David Korn <dgk@research.att.com>]"\
63*906afcb8SAndy Fiddaman	    "[-copyright?Copyright (c) 1992-2012 AT&T Intellectual Property]"\
64*906afcb8SAndy Fiddaman	    "[-license?http://www.eclipse.org/org/documents/epl-v10.html]"\
65*906afcb8SAndy Fiddaman	    "[--catalog?libcmd]"'
66*906afcb8SAndy Fiddaman
67*906afcb8SAndy FiddamanCFLAGS += $(ASTCFLAGS)
68*906afcb8SAndy FiddamanCFLAGS64 += $(ASTCFLAGS64)
69*906afcb8SAndy Fiddaman
70*906afcb8SAndy FiddamanCERRWARN	+= -_gcc=-Wno-unused-value
71*906afcb8SAndy FiddamanCERRWARN	+= -_gcc=-Wno-parentheses
72*906afcb8SAndy FiddamanCERRWARN	+= -_gcc=-Wno-uninitialized
73*906afcb8SAndy FiddamanCERRWARN	+= -_gcc=-Wno-unused-variable
74*906afcb8SAndy FiddamanCERRWARN	+= -_gcc=-Wno-implicit-function-declaration
75*906afcb8SAndy Fiddaman
76*906afcb8SAndy Fiddamanall: install_h .WAIT $(LIBS)
77*906afcb8SAndy Fiddaman
78*906afcb8SAndy Fiddaman#
79*906afcb8SAndy Fiddaman# libcmd is not lint-clean yet; fake up a target.  (You can use
80*906afcb8SAndy Fiddaman# "make lintcheck" to actually run lint; please send all lint fixes
81*906afcb8SAndy Fiddaman# upstream (to AT&T) so the next update will pull them into ON.)
82*906afcb8SAndy Fiddaman#
83*906afcb8SAndy Fiddamanlint:
84*906afcb8SAndy Fiddaman	@ print "usr/src/lib/libcmd is not lint-clean: skipping"
85*906afcb8SAndy Fiddaman
86*906afcb8SAndy Fiddamaninclude $(SRC)/lib/Makefile.targ
87*906afcb8SAndy Fiddaman
88*906afcb8SAndy Fiddamanpics/%.o: $(ASTSRC)/%.c
89*906afcb8SAndy Fiddaman	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
90*906afcb8SAndy Fiddaman	$(POST_PROCESS_O)
91*906afcb8SAndy Fiddaman
92*906afcb8SAndy Fiddaman######################################################################
93*906afcb8SAndy Fiddaman# Header file generation
94*906afcb8SAndy Fiddaman
95*906afcb8SAndy Fiddaman$(HEADERSRC:%=ast/%): FRC
96*906afcb8SAndy Fiddaman	$(MKDIR) -p $(@D)
97*906afcb8SAndy Fiddaman	$(CP) $(ASTSRC)/$(@F) $@
98*906afcb8SAndy Fiddaman
99*906afcb8SAndy Fiddaman# This rule is derived from $(CONTRIB)/ast/src/lib/libcmd/Makefile
100*906afcb8SAndy Fiddamanast/cmdext.h:
101*906afcb8SAndy Fiddaman	$(MKDIR) -p $(@D)
102*906afcb8SAndy Fiddaman	echo '#include <shcmd.h>' > $@.tmp
103*906afcb8SAndy Fiddaman	$(SED) \
104*906afcb8SAndy Fiddaman	    -e '/^b_[a-z_][a-z_0-9]*(/!d' \
105*906afcb8SAndy Fiddaman	    -e 's/^b_//' \
106*906afcb8SAndy Fiddaman	    -e 's/(.*//' \
107*906afcb8SAndy Fiddaman	    -e 's/.*/extern int     b_&(int, char**, Shbltin_t*);/' \
108*906afcb8SAndy Fiddaman	    $(OBJECTS:%.o=$(ASTSRC)/%.c) | \
109*906afcb8SAndy Fiddaman	    $(SORT) -u \
110*906afcb8SAndy Fiddaman	    >> $@.tmp
111*906afcb8SAndy Fiddaman	$(AST_PROTO) -f $@.tmp >> $@
112*906afcb8SAndy Fiddaman	rm -f $@.tmp
113*906afcb8SAndy Fiddaman	$(POST_PROCESS_AST) $@
114*906afcb8SAndy Fiddaman
115*906afcb8SAndy FiddamanCLOBBERFILES += ast/*
116*906afcb8SAndy Fiddaman
117*906afcb8SAndy Fiddamaninstall_h: $(HEADERSRC:%=ast/%) $(HEADERGEN:%=ast/%)
118*906afcb8SAndy Fiddaman
119*906afcb8SAndy Fiddaman.PARALLEL: $(HEADERSRC:%=ast/%) $(HEADERGEN:%=ast/%)
120*906afcb8SAndy Fiddaman
121*906afcb8SAndy Fiddaman_feature: FRC
122*906afcb8SAndy Fiddaman	$(MAKE) -f Makefile.iffe generate
123*906afcb8SAndy Fiddaman
124*906afcb8SAndy Fiddamaninclude ../../Makefile.astmsg
125*906afcb8SAndy Fiddaman
126*906afcb8SAndy FiddamanFRC:
127