xref: /illumos-gate/usr/src/cmd/ast/Makefile.iffe (revision 6ff4183c538023f1acb277f9d3b05296bb816e66)
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
56FEATURE/% := SHADOW_CCS=
57
58FEATURE/%: $(ASTSRC)/features/%
59	PATH=$(AST_TOOLS):$$PATH \
60	    $(AST_IFFE) $(IFFEFLAGS) -c '$(IFFEC)' run $< $(IFFE_EXTRA)
61	$(POST_PROCESS_AST)
62
63FEATURE/%: $(ASTSRC)/features/%.c
64	PATH=$(AST_TOOLS):$$PATH \
65	    $(AST_IFFE) $(IFFEFLAGS) -c '$(IFFEC)' run $< $(IFFE_EXTRA)
66	$(POST_PROCESS_AST)
67
68FEATURE/%: $(ASTSRC)/features/%.sh
69	PATH=$(AST_TOOLS):$$PATH \
70	    $(AST_IFFE) $(IFFEFLAGS) -c '$(IFFEC)' run $< $(IFFE_EXTRA)
71	$(POST_PROCESS_AST)
72