1#
2# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3# Use is subject to license terms.
4# Copyright 2016 Nexenta Systems, Inc.
5# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
6#
7include $(SRC)/Makefile.master
8
9.KEEP_STATE:
10
11VERSION		= 0.95
12
13# $(POUND_SIGN) is just a #.  Used to turn a feature off.
14# The $(POUND_SIGN)POUND_SIGN:sh construct is just so make doesn't have to
15# spawn a shell and redefine POUND_SIGN if it is already defined (e.g.
16# $(SRC)/Makefile.master was already included).
17$(POUND_SIGN)POUND_SIGN:sh = echo '\043'
18
19
20#
21# Optional features (set to $(POUND_SIGN) to turn off):
22#
23# OPTION_UTILS:
24#	Build the userland utilities.
25#	NOTE: these utilities will be installed in
26#	      /platform/$(PLATFORM)/boot/grub, not /boot/grub.
27#
28# OPTION_DOCS:
29#	Build and install some GRUB documentations, e.g. man and info files.
30#	NOTE: these docs will be installed in
31#	      /platform/$(PLATFORM)/boot/grub, not /boot/grub.
32#
33# OPTION_FS:
34#	Build additional filesystem support into GRUB. This will increase
35#	the sizes of stage2 and pxegrub and may cause malfunction.
36#
37# STAGE2_NETBOOT:
38#	Include netboot support in stage2 (on by default).
39#	This only affects stage2, not pxegrub (diskless support).
40#
41# STAGE2_NETBOOT	= $(POUND_SIGN)
42OPTION_UTILS	= $(POUND_SIGN)
43OPTION_DOCS	= $(POUND_SIGN)
44OPTION_FS	= $(POUND_SIGN)
45
46
47BASE_CFLAGS	= $($(MACH)_XARCH)
48BASE_CFLAGS	+= -B$(GNUC_ROOT)/bin/ -g $(CPPFLAGS) $(OPTFLAGS) -std=gnu89
49BASE_CCASFLAGS	= $($(MACH)_XARCH)
50BASE_CCASFLAGS	+= -B$(GNUC_ROOT)/bin/ -g $(CPPFLAGS) $(OPTFLAGS)
51BASE_LDFLAGS	= $($(MACH)_XARCH)
52
53CC		= $(GNUC_ROOT)/bin/gcc
54CFLAGS		= $(BASE_CFLAGS)
55CCDEPMODE	= depmode=none
56
57CCAS		= $(CC)
58CCASFLAGS	= $(BASE_CCASFLAGS)
59
60CPP		= $(CC) -E
61
62# $(ENVCPPFLAGS4), if defined, should be something like "-Y I,somepath".
63# We want to get rid of the "-Y I," part but make's pattern replacement
64# macro reference doesn't allow spaces in it, e.g. $(ENVCPPFLAGS4:-Y I,%=%).
65# So we'll get rid of the "-Y" now and then the "I," later.  By the way, this
66# should also work in case $(ENVCPPFLAGS4) is "-YI,somepath" (no space).
67t.ENVCPPFLAGS4	= $(ENVCPPFLAGS4:-Y%=%)
68
69CPPFLAGS	= $(DEFS) $(INCLUDES) $(WARNFLAGS) \
70		  $(ENVCPPFLAGS1:-I%=-isystem %) \
71		  $(ENVCPPFLAGS2:-I%=-isystem %) \
72		  $(ENVCPPFLAGS3:-I%=-isystem %) \
73		  $(t.ENVCPPFLAGS4:I,%=-nostdinc -isystem %)
74
75CCLD		= $(GNU_ROOT)/bin/gld
76GLDTARGET	= -melf_i386_sol2
77LDFLAGS		= $(BASE_LDFLAGS)
78LINKFLAGS	= -g
79LINK		= $(CCLD) $(LINKFLAGS) $(LDFLAGS)
80
81DEFS		= -DHAVE_CONFIG_H -DSOLARIS_NETBOOT
82OPTFLAGS	= -falign-jumps=1 -falign-loops=1 -falign-functions=1
83OPTFLAGS	+= -fno-reorder-functions
84#WARNFLAGS	= -Wall -Wmissing-prototypes -Wunused -Wshadow \
85#		  -Wpointer-arith -Wundef
86
87OBJCOPY		= $(GNU_ROOT)/bin/gobjcopy
88
89AR		= /usr/ccs/bin/ar
90RANLIB		= :
91
92MKDIR		= mkdir -p
93