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 -lsecdb -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
70# smatch gets out of memory on common/sh/macro.c
71SMATCH= off
72
73all: install_h mkpicdirs .WAIT $(LIBS)
74
75mkpicdirs:
76	mkdir -p $(LOBJDIRS:%=pics/%)
77
78include $(SRC)/lib/Makefile.targ
79
80pics/%.o: $(ASTSRC)/%.c
81	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
82	$(POST_PROCESS_O)
83
84######################################################################
85# Header file generation
86
87$(HEADERSRC:%=ast/%): FRC
88	$(MKDIR) -p $(@D)
89	$(CP) $(ASTSRC)/include/$(@F) $@
90
91CLOBBERFILES += ast/*
92
93install_h: $(HEADERSRC:%=ast/%)
94
95_feature: FRC
96	$(MAKE) -f Makefile.iffe generate
97
98include ../../Makefile.astmsg
99
100FRC:
101