1#
2# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
3# Use is subject to license terms.
4#
5# ident	"%Z%%M%	%I%	%E% SMI"
6#
7include ../../Makefile.grub
8include ../Makefile.solaris.defs
9
10
11GRUB		= grub
12GRUB_OBJS	= asmstub.o main.o
13$(GRUB)		:= LIBS = ../stage2/libgrub.a ../lib/libcommon.a -lcurses
14$(GRUB)		:= LDFLAGS += $(LDLIBS.cmd)
15$(GRUB)		:= CCLD = $(CC)
16
17#
18# The grub shell interposes on the getopt() family.  Should direct bindings be
19# enabled, these interfaces should be explicitly defined as interposes.  Use a
20# mapfile to associate the necessary interposer definitions.
21#
22MAPFILES	= $(MAPFILE.INT)
23
24INCLUDES	= -I. -I.. -I../stage1 -I../stage2 -I../lib
25CFLAGS		+= -O2
26LINKFLAGS	+= -O2 $(MAPFILES:%=-Wl,-M%)
27CPPFLAGS	+= -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \
28		   -DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 \
29		   -DFSYS_REISERFS=1 -DFSYS_ZFS=1 -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 \
30		   -DFSYS_XFS=1 -DUSE_MD5_PASSWORDS=1 -DSUPPORT_HERCULES=1 \
31		   -DSUPPORT_SERIAL=1
32
33PROGRAMS	= $(GRUB)
34
35INSTALL_DIR	= $(ROOT_BOOT_GRUB)/bin
36INSTALL_TARGETS	= $(PROGRAMS:%=$(INSTALL_DIR)/%)
37
38$(INSTALL_DIR)/% := FILEMODE = 0555
39
40#
41# Source files to be installed in $(SRC_DIR).
42#
43SRC_DIR		= $(ROOT_SRC)/grub
44SRC_FILES	= Makefile.am Makefile.in asmstub.c main.c
45
46INSTALL_TARGETS	+= $(SRC_FILES:%=$(SRC_DIR)/%)
47
48
49all: $(PROGRAMS)
50
51$(GRUB): $(GRUB_OBJS) $(MAPFILES)
52	$(LINK) -o $@ $(GRUB_OBJS) $(LIBS)
53	$(POST_PROCESS)
54
55$(GRUB_OBJS): $$(@:.o=.c)
56	$(CC) $(CFLAGS) -c -o $@ $(@:.o=.c)
57
58
59install: all $(INSTALL_TARGETS)
60
61$(INSTALL_DIR)/%: $(INSTALL_DIR) %
62	$(INS.file)
63
64$(SRC_DIR)/%: $(SRC_DIR) %
65	$(INS.file)
66
67$(INSTALL_DIR) $(SRC_DIR):
68	$(INS.dir)
69
70
71clean: _FORCE
72	$(RM) *.o
73
74clobber: clean
75	$(RM) $(PROGRAMS)
76
77_FORCE:
78