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