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# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# psm/stand/cpr/common/Makefile.com
26#
27GREP	=	egrep
28WC	=	wc
29TOPDIR	=	../../../../..
30
31include $(TOPDIR)/Makefile.master
32include $(TOPDIR)/Makefile.psm
33include $(TOPDIR)/psm/stand/lib/Makefile.lib
34
35SYSDIR	=  	$(TOPDIR)/uts
36COMDIR	=  	../../common
37OSDIR  =	$(SYSDIR)/common/os
38ARCHDIR	= 	$(SYSDIR)/$(ARCH)
39MACHDIR	= 	$(SYSDIR)/$(MACH)
40MMUDIR	=	$(SYSDIR)/$(MMU)
41PROMLIBDIR=	$(TOPDIR)/psm/stand/lib/promif/$(ARCH_PROMDIR)
42PROMLIB	=	$(PROMLIBDIR)/libprom.a
43
44SALIBS +=	$(PROMLIB)
45LDLIBS +=	-L$(PROMLIBDIR) -lprom
46LDFLAGS =	-dn -M mapfile $(MAP_FLAG)
47
48LINTLIBS +=	$(PROMLIBDIR)/llib-lprom.ln
49LINTFLAGS.lib =	-ysxmun
50
51CPRBOOTOBJ +=	support.o compress.o
52
53L_SRCS	=	$(COMDIR)/support.c $(OSDIR)/compress.c
54L_COBJ	=	$(CPRBOOTOBJ:%.o=%.ln)
55
56CPPDEFS =	$(ARCHOPTS) -D$(ARCH) -D__$(ARCH) -D$(MACH) -D__$(MACH)
57CPPDEFS +=	-D_KERNEL -D_MACHDEP -D__ELF
58
59CPPINCS =	-I. -I$(ARCHDIR) -I$(MMUDIR) -I$(MACHDIR)
60CPPINCS +=	-I$(MACHDIR)/$(ARCHVER)	-I$(SYSDIR)/sun
61CPPINCS +=	-I$(SYSDIR)/sun4 -I$(SYSDIR)/common -I$(TOPDIR)/head
62
63CPPFLAGS =	$(CPPDEFS) $(CPPINCS) $(CPPFLAGS.master)
64CPPFLAGS +=	$(CCYFLAG)$(SYSDIR)/common
65
66C99MODE =	$(C99_ENABLE)
67CFLAGS =	$(CCVERBOSE) -O $(C99MODE)
68
69ASFLAGS = 	-P -D_ASM $(CPPDEFS) -DLOCORE -D_LOCORE -D__STDC__
70AS_CPPFLAGS =	$(CPPINCS) $(CPPFLAGS.master)
71
72# install values
73CPRFILES=	$(ALL:%=$(ROOT_PSM_DIR)/$(ARCH)/%)
74FILEMODE=	644
75OWNER=		root
76GROUP=		sys
77
78# lint stuff
79LINTFLAGS += -Dlint
80LOPTS = -hbxn
81
82# install rule
83$(ROOT_PSM_DIR)/$(ARCH)/%: %
84	$(INS.file)
85
86
87all:	$(ALL)
88
89install: all $(CPRFILES)
90
91
92LINT.c=	$(LINT) $(LINTFLAGS.c) $(LINT_DEFS) $(CPPFLAGS) -c
93LINT.s=	$(LINT) $(LINTFLAGS.s) $(LINT_DEFS) $(CPPFLAGS) -c
94
95# build rule
96
97compress.o: $(OSDIR)/compress.c
98	$(COMPILE.c) $(OSDIR)/compress.c
99
100support.o: $(COMDIR)/support.c
101	$(COMPILE.c) $(COMDIR)/support.c
102
103compress.ln: $(OSDIR)/compress.c
104	@$(LHEAD) $(LINT.c) $(OSDIR)/compress.c $(LTAIL)
105
106support.ln: $(COMDIR)/support.c
107	@$(LHEAD) $(LINT.c) $(COMDIR)/support.c $(LTAIL)
108
109%.ln: %.c
110	@$(LHEAD) $(LINT.c) $< $(LTAIL)
111
112%.ln: %.s
113	@$(LHEAD) $(LINT.s) $< $(LTAIL)
114
115.KEEP_STATE:
116
117.PARALLEL:	$(CPRBOOTOBJ) $(L_COBJ)
118
119cprboot: $(CPRBOOT_MAPFILE) $(CPRBOOTOBJ) $(SALIBS)
120	$(LD) $(LDFLAGS) -o $@ $(CPRBOOTOBJ) $(LDLIBS)
121	$(POST_PROCESS)
122	$(CHK4UBINARY)
123
124$(SALIBS): FRC
125	@cd $(@D); $(MAKE) $(MFLAGS)
126
127$(LINTLIBS): FRC
128	@cd $(@D); $(MAKE) $(MFLAGS) $(@F)
129
130$(ROOTDIR):
131	$(INS.dir)
132
133lint: $(L_COBJ) $(LINTLIBS)
134	@$(ECHO) "\n$@: global crosschecks:"
135	@$(LINT.2) $(L_COBJ) $(LDLIBS)
136
137clean.lint:
138	$(RM) *.ln
139
140clean:
141	$(RM) *.o *.ln
142
143clobber:
144	$(RM) *.o *.ln $(ALL)
145
146FRC:
147