1#	$NetBSD: Makefile.inc,v 1.20 2023/08/30 18:44:48 christos Exp $
2#
3#	Configuration variables (default values are below):
4#
5#	S	must be set to the top of the 'sys' tree.
6#	I386DST	may be set to the location of the directory where library
7#		objects are to be built.  Defaults to ${.OBJDIR}/lib/i386.
8#	I386MISCCPPFLAGS
9#		Miscellaneous cpp flags to be passed to the library's Makefile
10#		when building.
11#	I386MISCMAKEFLAGS
12#		Miscellaneous flags to be passed to the library's Makefile when
13#		building.  See library's Makefile for more details about
14#		supported flags and their default values.
15
16# Default values:
17I386DST?=		${.OBJDIR}/lib/i386
18
19#I386DIR=		$S/arch/i386/stand/lib
20I386LIB=		${I386DST}/libi386.a
21
22CWARNFLAGS.clang+=	-Wno-tautological-compare
23
24I386MAKE= \
25	cd ${I386DIR} && MAKEOBJDIRPREFIX= && unset MAKEOBJDIRPREFIX && \
26	    MAKEOBJDIR=${I386DST} ${MAKE} \
27	    CC=${CC:q} CFLAGS=${CFLAGS:q} \
28	    AS=${AS:q} AFLAGS=${AFLAGS:q} \
29	    COPTS=${COPTS:q} \
30	    LD=${LD:q} STRIP=${STRIP:q} \
31	    MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:q} \
32	    I386CPPFLAGS=${CPPFLAGS:S@^-I.@-I../../.@g:q} \
33	    I386MISCCPPFLAGS=${I386MISCCPPFLAGS:q} \
34	    ${I386MISCMAKEFLAGS}
35
36${I386LIB}:		.NOTMAIN __always_make_i386lib
37	@echo making sure the i386 library is up to date...
38	@${I386MAKE} libi386.a
39
40clean:			.NOTMAIN cleani386lib
41cleani386lib:		.NOTMAIN
42	@echo cleaning the i386 library objects
43	@if [ -d "${I386DST}" ]; then ${I386MAKE} clean; fi
44
45cleandir distclean:	.NOTMAIN cleandiri386lib
46cleandiri386lib:	.NOTMAIN
47	@echo cleandiring the i386 library objects
48	@if [ -d "${I386DST}" ]; then ${I386MAKE} cleandir; fi
49
50dependall depend:	.NOTMAIN dependi386lib
51dependi386lib:		.NOTMAIN __always_make_i386lib
52	@echo depending the i386 library objects
53	@${I386MAKE} depend
54
55__always_make_i386lib:	.NOTMAIN
56	@mkdir -p ${I386DST}
57