xref: /illumos-gate/usr/src/cmd/ast/libshell/Makefile.com (revision 2e07277863d69344215bd0c72e171d0c854dbe56)
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# Copyright (c) 2019, Joyent, Inc.
25# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
26#
27
28SHELL= /usr/bin/ksh93
29
30LIBRARY= libshell.a
31VERS= .1
32
33include ../Makefile.defs
34
35OBJECTS += $(LIBOBJS)
36
37include $(SRC)/lib/Makefile.lib
38include ../../Makefile.ast
39
40MAPFILES= ../mapfile-vers
41
42# Specify the MACH we currently use to build and test ksh
43LIBSHELLMACH= $(TARGETMACH)
44LIBSHELLBASE=..
45
46LIBS= $(DYNLIB)
47LDLIBS += -lcmd -ldll -last -lsocket -lm -lc
48
49# We use "=" here since using $(CPPFLAGS.master) is very tricky in our
50# case - it MUST come as the last element but future changes in -D options
51# may then cause silent breakage in the AST sources because the last -D
52# option specified overrides previous -D options so we prefer the current
53# way to explicitly list each single flag.
54CPPFLAGS= \
55	$(DTEXTDOM) $(DTS_ERRNO) \
56	$(LIBSHELLCPPFLAGS) \
57	-Iast -I.
58
59CFLAGS += $(ASTCFLAGS)
60CFLAGS64 += $(ASTCFLAGS64)
61
62CERRWARN += -_gcc=-Wno-parentheses
63CERRWARN += -_gcc=-Wno-unused-value
64CERRWARN += -_gcc=-Wno-unused-variable
65CERRWARN += -_gcc=-Wno-unused-function
66CERRWARN += $(CNOWARN_UNINIT)
67CERRWARN += -_gcc=-Wno-clobbered
68CERRWARN += -_gcc=-Wno-char-subscripts
69
70pics/bltins/print.o := CERRWARN += -_gcc14=-Wno-dangling-pointer
71
72# smatch gets out of memory on common/sh/macro.c
73SMATCH= off
74
75.KEEP_STATE:
76
77all: install_h mkpicdirs .WAIT $(LIBS)
78
79mkpicdirs:
80	@mkdir -p $(LOBJDIRS:%=pics/%)
81
82include $(SRC)/lib/Makefile.targ
83
84pics/%.o: $(ASTSRC)/%.c
85	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
86	$(POST_PROCESS_O)
87
88######################################################################
89# Header file generation
90
91$(HEADERSRC:%=ast/%): $(HEADERSRC:%=$(ASTSRC)/include/%)
92	$(MKDIR) -p $(@D)
93	$(CP) $(ASTSRC)/include/$(@F) $@
94
95CLOBBERFILES += ast/*
96
97install_h: $(HEADERSRC:%=ast/%)
98
99_feature: FRC
100	$(MAKE) -f Makefile.iffe generate
101
102include ../../Makefile.astmsg
103
104FRC:
105