summaryrefslogtreecommitdiff
path: root/usr/src/cmd/ast/Makefile.iffe
blob: cc63315ba770bbadd4ba69bfda041aca32976374 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source.  A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#

#
# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
#

AST_IFFE =	$(AST_TOOLS)/iffe

# The AST sources use a utility called "iffe" (If FEature Exists) to probe the
# build environment, and to generate the header files needed to build the
# libraries and commands. In order to support cross-compilation, the
# generated FEATURE files are bundled with gate, but a TBC target is
# provided to re-generate them if necessary due to a change elsewhere in gate.
#
# NOTES:
#
# Only the primary compiler is used with iffe.
#
# We use big PIC here since pic is too small on 64-bit sparc and on 32-bit
# it's close to the barrier.
#
# "-D_map_libc=1" is needed to force map.c to add a "_ast_" prefix to all
# AST symbol names which may otherwise collide with libc.
#
# "-D_lib_socket=1 -lsocket -lnsl" was added to make sure ksh93 is compiled
# with networking support enabled; the current AST build infrastructure has
# problems with detecting networking support in illumos.
#
# "-D_TS_ERRNO -D_REENTRANT" are flags taken from the default OS/Net
# build system.

IFFECC=		$($(TARGETMACH)_CC)
IFFECPPFLAGS=	$(ASTPLATFORMCPPFLAGS) \
		-D_TS_ERRNO -D_REENTRANT \
		-YI,$(ROOT)/usr/include -D_BLD_DLL -D_BLD_ast \
		-D_lib_socket=1 -D_map_libc=1 \
		$(LIBSHELLFEATUREFLAGS) \
		-I$(ASTSRC)/include -I.
IFFECFLAGS=	$(CSTD_GNU99) $($(TARGETMACH)_COPTFLAG) \
		$($(TARGETMACH)_C_BIGPICFLAGS) $($(TARGETMACH)_CFLAGS)
IFFELDFLAGS=	$(ZASSERTDEFLIB) $(ZFATALWARNINGS) $(LDLIBS)
IFFELIBS=	-lsocket -lnsl
IFFEC=		$(IFFECC) $(IFFECPPFLAGS) $(IFFECFLAGS) \
		$(IFFELDFLAGS) $(IFFELIBS)
IFFEFLAGS=	-v -R $(ROOT)

IFFEPATH=	$(AST_TOOLS):/usr/bin:/usr/sbin:/sbin

FEATURE/% := SHADOW_CCS=

FEATURE/%: $(ASTSRC)/features/%
	PATH=$(IFFEPATH) \
	    $(AST_IFFE) $(IFFEFLAGS) -c '$(IFFEC)' run $< $(IFFE_EXTRA)
	$(POST_PROCESS_AST)

FEATURE/%: $(ASTSRC)/features/%.c
	PATH=$(IFFEPATH) \
	    $(AST_IFFE) $(IFFEFLAGS) -c '$(IFFEC)' run $< $(IFFE_EXTRA)
	$(POST_PROCESS_AST)

FEATURE/%: $(ASTSRC)/features/%.sh
	PATH=$(IFFEPATH) \
	    $(AST_IFFE) $(IFFEFLAGS) -c '$(IFFEC)' run $< $(IFFE_EXTRA)
	$(POST_PROCESS_AST)