xref: /illumos-gate/usr/src/psm/stand/bootlst/common/Makefile.com (revision 46b592853d0f4f11781b6b0a7533f267c6aee132)
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# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
22# Use is subject to license terms.
23#
24# psm/stand/bootlst/common/Makefile.com
25#
26
27TOPDIR	=	../../../../..
28
29include $(TOPDIR)/Makefile.master
30include $(TOPDIR)/Makefile.psm
31include $(TOPDIR)/psm/stand/lib/Makefile.lib
32
33SYSDIR	=  	$(TOPDIR)/uts
34COMDIR	=  	../../common
35STANDDIR = 	$(TOPDIR)/stand
36
37SALIBDIR =	$(STANDDIR)/lib/sa
38SALIB =		$(SALIBDIR)/libsa.a
39PROMLIBDIR=	$(PROMIFDIR)/$(ARCH_PROMDIR)
40PROMLIB	=	$(PROMLIBDIR)/libprom.a
41
42SALIBS +=	$(SALIB) $(PROMLIB)
43LDLIBS =	-L$(SALIBDIR) -lsa -L$(PROMLIBDIR) -lprom $(LDPLATLIBS)
44LDFLAGS =	-dn -M $(MAPFILE) $(MAP_FLAG)
45
46LINTLIBS =	$(SALIBDIR)/llib-lsa.ln $(PROMLIBDIR)/llib-lprom.ln $(LINTPLATLIBS)
47LINTFLAGS.lib =	-ysxmun
48
49BOOTLSTOBJ +=	 bootlst.o sasubr.o
50BOOTLSTLINTS =	$(BOOTLSTOBJ:%.o=%.ln)
51
52CPPDEFS =	-D$(ARCH) -D__$(ARCH) -D$(TARG_MACH) -D__$(TARG_MACH)
53CPPDEFS +=	-D_KERNEL -D_MACHDEP -D__ELF
54
55CPPINCS	=	-I$(SYSDIR)/common -I$(SYSDIR)/sun
56CPPINCS +=	-I$(SYSDIR)/$(MACH) -I$(PLATDIR)
57CPPINCS +=	-I$(STANDDIR)/lib/sa
58
59CPPFLAGS =	$(CPPDEFS) $(CPPINCS)
60CPPFLAGS	+= $(CCYFLAG)$(STANDDIR)
61
62C99MODE =	$(C99_ENABLE)
63CFLAGS =	$(CCVERBOSE) -O $(C99MODE)
64
65ASFLAGS = 	-P -D_ASM $(CPPDEFS) -DLOCORE -D_LOCORE -D__STDC__
66AS_CPPFLAGS =	$(CPPINCS) $(CPPFLAGS.master)
67
68# install values
69LSTFILES=	$(ALL:%=$(ROOT_PSM_DIR)/$(ARCH)/%)
70FILEMODE=	644
71
72# lint stuff
73LINTFLAGS += -Dlint
74LOPTS = -hbxn
75
76# install rule
77$(ROOT_PSM_DIR)/$(ARCH)/%: %
78	$(INS.file)
79
80
81all:	$(ALL)
82
83install: all $(LSTFILES)
84
85
86LINT.c=	$(LINT) $(LINTFLAGS.c) $(LINT_DEFS) $(CPPFLAGS) -c
87LINT.s=	$(LINT) $(LINTFLAGS.s) $(LINT_DEFS) $(CPPFLAGS) -c
88LINT.2= $(LINT) $(LINTFLAGS.c) $(LINT_DEFS) $(CPPFLAGS)
89
90# build rules
91
92%.o: $(COMDIR)/%.c
93	$(COMPILE.c) -o $@ $<
94
95%.ln: $(COMDIR)/%.c
96	@$(LHEAD) $(LINT.c) $< $(LTAIL)
97
98.KEEP_STATE:
99
100.PARALLEL:	$(BOOTLSTOBJ) $(BOOTLSTLINTS)
101
102bootlst: $(MAPFILE) $(BOOTLSTOBJ) $(SALIBS)
103	$(LD) $(LDFLAGS) -o $@ $(BOOTLSTOBJ) $(LDLIBS)
104	$(POST_PROCESS)
105
106$(SALIBS): FRC
107	@cd $(@D); $(MAKE) $(MFLAGS)
108
109$(LINTLIBS): FRC
110	@cd $(@D); $(MAKE) $(MFLAGS) $(@F)
111
112$(ROOTDIR):
113	$(INS.dir)
114
115lint: $(BOOTLSTLINTS) $(LINTLIBS)
116	@$(ECHO) "\n$@: global crosschecks:"
117	$(LINT.2) $(BOOTLSTLINTS) $(LINTLIBS)
118
119clean.lint:
120	$(RM) *.ln
121
122clean:
123	$(RM) *.o *.ln
124
125clobber:
126	$(RM) *.o *.ln $(ALL)
127
128FRC:
129