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