xref: /illumos-gate/usr/src/cmd/ast/Makefile.iffe (revision 78f5fe53)
1b30d1939SAndy Fiddaman#
2b30d1939SAndy Fiddaman# This file and its contents are supplied under the terms of the
3b30d1939SAndy Fiddaman# Common Development and Distribution License ("CDDL"), version 1.0.
4b30d1939SAndy Fiddaman# You may only use this file in accordance with the terms of version
5b30d1939SAndy Fiddaman# 1.0 of the CDDL.
6b30d1939SAndy Fiddaman#
7b30d1939SAndy Fiddaman# A full copy of the text of the CDDL should have accompanied this
8b30d1939SAndy Fiddaman# source.  A copy of the CDDL is also available via the Internet at
9b30d1939SAndy Fiddaman# http://www.illumos.org/license/CDDL.
10b30d1939SAndy Fiddaman#
11b30d1939SAndy Fiddaman
12b30d1939SAndy Fiddaman#
13b30d1939SAndy Fiddaman# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
14b30d1939SAndy Fiddaman#
15b30d1939SAndy Fiddaman
16b30d1939SAndy FiddamanAST_IFFE =	$(AST_TOOLS)/iffe
17b30d1939SAndy Fiddaman
18b30d1939SAndy Fiddaman# The AST sources use a utility called "iffe" (If FEature Exists) to probe the
19b30d1939SAndy Fiddaman# build environment, and to generate the header files needed to build the
20b30d1939SAndy Fiddaman# libraries and commands. In order to support cross-compilation, the
21b30d1939SAndy Fiddaman# generated FEATURE files are bundled with gate, but a TBC target is
22b30d1939SAndy Fiddaman# provided to re-generate them if necessary due to a change elsewhere in gate.
23b30d1939SAndy Fiddaman#
24b30d1939SAndy Fiddaman# NOTES:
25b30d1939SAndy Fiddaman#
26b30d1939SAndy Fiddaman# Only the primary compiler is used with iffe.
27b30d1939SAndy Fiddaman#
28b30d1939SAndy Fiddaman# We use big PIC here since pic is too small on 64-bit sparc and on 32-bit
29b30d1939SAndy Fiddaman# it's close to the barrier.
30b30d1939SAndy Fiddaman#
31b30d1939SAndy Fiddaman# "-D_map_libc=1" is needed to force map.c to add a "_ast_" prefix to all
32b30d1939SAndy Fiddaman# AST symbol names which may otherwise collide with libc.
33b30d1939SAndy Fiddaman#
34b30d1939SAndy Fiddaman# "-D_lib_socket=1 -lsocket -lnsl" was added to make sure ksh93 is compiled
35b30d1939SAndy Fiddaman# with networking support enabled; the current AST build infrastructure has
36b30d1939SAndy Fiddaman# problems with detecting networking support in illumos.
37b30d1939SAndy Fiddaman#
38b30d1939SAndy Fiddaman# "-D_TS_ERRNO -D_REENTRANT" are flags taken from the default OS/Net
39b30d1939SAndy Fiddaman# build system.
40b30d1939SAndy Fiddaman
41b30d1939SAndy FiddamanIFFECC=		$($(TARGETMACH)_CC)
43b30d1939SAndy Fiddaman		-D_TS_ERRNO -D_REENTRANT \
44b30d1939SAndy Fiddaman		-YI,$(ROOT)/usr/include -D_BLD_DLL -D_BLD_ast \
45b30d1939SAndy Fiddaman		-D_lib_socket=1 -D_map_libc=1 \
46b30d1939SAndy Fiddaman		$(LIBSHELLFEATUREFLAGS) \
47b30d1939SAndy Fiddaman		-I$(ASTSRC)/include -I.
48b30d1939SAndy FiddamanIFFECFLAGS=	$(CSTD_GNU99) $($(TARGETMACH)_COPTFLAG) \
51b30d1939SAndy FiddamanIFFELIBS=	-lsocket -lnsl
52b30d1939SAndy FiddamanIFFEC=		$(IFFECC) $(IFFECPPFLAGS) $(IFFECFLAGS) \
53b30d1939SAndy Fiddaman		$(IFFELDFLAGS) $(IFFELIBS)
54b30d1939SAndy FiddamanIFFEFLAGS=	-v -R $(ROOT)
55b30d1939SAndy Fiddaman
56*78f5fe53SAndy FiddamanIFFEPATH=	$(AST_TOOLS):/usr/bin:/usr/sbin:/sbin
57*78f5fe53SAndy Fiddaman
58b30d1939SAndy FiddamanFEATURE/% := SHADOW_CCS=
59b30d1939SAndy Fiddaman
60b30d1939SAndy FiddamanFEATURE/%: $(ASTSRC)/features/%
61*78f5fe53SAndy Fiddaman	PATH=$(IFFEPATH) \
62b30d1939SAndy Fiddaman	    $(AST_IFFE) $(IFFEFLAGS) -c '$(IFFEC)' run $< $(IFFE_EXTRA)
6344ce9f4bSAndy Fiddaman	$(POST_PROCESS_AST)
64b30d1939SAndy Fiddaman
65b30d1939SAndy FiddamanFEATURE/%: $(ASTSRC)/features/%.c
66*78f5fe53SAndy Fiddaman	PATH=$(IFFEPATH) \
67b30d1939SAndy Fiddaman	    $(AST_IFFE) $(IFFEFLAGS) -c '$(IFFEC)' run $< $(IFFE_EXTRA)
6844ce9f4bSAndy Fiddaman	$(POST_PROCESS_AST)
69b30d1939SAndy Fiddaman
70b30d1939SAndy FiddamanFEATURE/%: $(ASTSRC)/features/%.sh
71*78f5fe53SAndy Fiddaman	PATH=$(IFFEPATH) \
72b30d1939SAndy Fiddaman	    $(AST_IFFE) $(IFFEFLAGS) -c '$(IFFEC)' run $< $(IFFE_EXTRA)
7344ce9f4bSAndy Fiddaman	$(POST_PROCESS_AST)