1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21#
22#ident	"%Z%%M%	%I%	%E% SMI"
23#
24# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
25# Use is subject to license terms.
26#
27# psm/stand/bootlst/common/Makefile.com
28#
29
30TOPDIR	=	../../../../..
31
32include $(TOPDIR)/Makefile.master
33include $(TOPDIR)/Makefile.psm
34include $(TOPDIR)/psm/stand/lib/Makefile.lib
35
36SYSDIR	=  	$(TOPDIR)/uts
37COMDIR	=  	../../common
38STANDDIR = 	$(TOPDIR)/stand
39
40SALIBDIR =	$(STANDDIR)/lib/sa
41SALIB =		$(SALIBDIR)/libsa.a
42PROMLIBDIR=	$(PROMIFDIR)/$(ARCH_PROMDIR)
43PROMLIB	=	$(PROMLIBDIR)/libprom.a
44
45SALIBS +=	$(SALIB) $(PROMLIB)
46LDLIBS =	-L$(SALIBDIR) -lsa -L$(PROMLIBDIR) -lprom $(LDPLATLIBS)
47LDFLAGS =	-dn -M $(MAPFILE) $(MAP_FLAG)
48
49LINTLIBS =	$(SALIBDIR)/llib-lsa.ln $(PROMLIBDIR)/llib-lprom.ln $(LINTPLATLIBS)
50LINTFLAGS.lib =	-ysxmun
51
52BOOTLSTOBJ +=	 bootlst.o sasubr.o
53BOOTLSTLINTS =	$(BOOTLSTOBJ:%.o=%.ln)
54
55CPPDEFS =	-D$(ARCH) -D__$(ARCH) -D$(TARG_MACH) -D__$(TARG_MACH)
56CPPDEFS +=	-D_KERNEL -D_MACHDEP -D__ELF
57
58CPPINCS	=	-I$(SYSDIR)/common -I$(SYSDIR)/sun
59CPPINCS +=	-I$(SYSDIR)/$(MACH) -I$(PLATDIR)
60CPPINCS +=	-I$(STANDDIR)/lib/sa
61
62CPPFLAGS =	$(CPPDEFS) $(CPPINCS)
63CPPFLAGS	+= $(CCYFLAG)$(STANDDIR)
64
65C99MODE =	$(C99_ENABLE)
66CFLAGS =	$(CCVERBOSE) -O $(C99MODE)
67
68ASFLAGS = 	-P -D_ASM $(CPPDEFS) -DLOCORE -D_LOCORE -D__STDC__
69AS_CPPFLAGS =	$(CPPINCS) $(CPPFLAGS.master)
70
71# install values
72LSTFILES=	$(ALL:%=$(ROOT_PSM_DIR)/$(ARCH)/%)
73FILEMODE=	644
74OWNER=		root
75GROUP=		sys
76
77# lint stuff
78LINTFLAGS += -Dlint
79LOPTS = -hbxn
80
81# install rule
82$(ROOT_PSM_DIR)/$(ARCH)/%: %
83	$(INS.file)
84
85
86all:	$(ALL)
87
88install: all $(LSTFILES)
89
90
91LINT.c=	$(LINT) $(LINTFLAGS.c) $(LINT_DEFS) $(CPPFLAGS) -c
92LINT.s=	$(LINT) $(LINTFLAGS.s) $(LINT_DEFS) $(CPPFLAGS) -c
93LINT.2= $(LINT) $(LINTFLAGS.c) $(LINT_DEFS) $(CPPFLAGS)
94
95# build rules
96
97%.o: $(COMDIR)/%.c
98	$(COMPILE.c) -o $@ $<
99
100%.ln: $(COMDIR)/%.c
101	@$(LHEAD) $(LINT.c) $< $(LTAIL)
102
103.KEEP_STATE:
104
105.PARALLEL:	$(BOOTLSTOBJ) $(BOOTLSTLINTS)
106
107bootlst: $(MAPFILE) $(BOOTLSTOBJ) $(SALIBS)
108	$(LD) $(LDFLAGS) -o $@ $(BOOTLSTOBJ) $(LDLIBS)
109	$(POST_PROCESS)
110
111$(SALIBS): FRC
112	@cd $(@D); $(MAKE) $(MFLAGS)
113
114$(LINTLIBS): FRC
115	@cd $(@D); $(MAKE) $(MFLAGS) $(@F)
116
117$(ROOTDIR):
118	$(INS.dir)
119
120lint: $(BOOTLSTLINTS) $(LINTLIBS)
121	@$(ECHO) "\n$@: global crosschecks:"
122	$(LINT.2) $(BOOTLSTLINTS) $(LINTLIBS)
123
124clean.lint:
125	$(RM) *.ln
126
127clean:
128	$(RM) *.o *.ln
129
130clobber:
131	$(RM) *.o *.ln $(ALL)
132
133FRC:
134