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 =	-Wl,-dn -Wl,-Mmapfile $(MAP_FLAG)
47
48CPRBOOTOBJ +=	support.o compress.o
49
50L_SRCS	=	$(COMDIR)/support.c $(OSDIR)/compress.c
51L_COBJ	=	$(CPRBOOTOBJ:%.o=%.ln)
52
53CPPDEFS =	$(ARCHOPTS) -D$(ARCH) -D__$(ARCH) -D$(MACH) -D__$(MACH)
54CPPDEFS +=	-D_KERNEL -D_MACHDEP -D__ELF
55
56CPPINCS =	-I. -I$(ARCHDIR) -I$(MMUDIR) -I$(MACHDIR)
57CPPINCS +=	-I$(MACHDIR)/$(ARCHVER)	-I$(SYSDIR)/sun
58CPPINCS +=	-I$(SYSDIR)/sun4 -I$(SYSDIR)/common -I$(TOPDIR)/head
59
60CPPFLAGS =	$(CPPDEFS) $(CPPINCS) $(CPPFLAGS.master)
61CPPFLAGS +=	$(CCYFLAG)$(SYSDIR)/common
62
63CSTD =	$(CSTD_GNU99)
64CFLAGS =	$(CCVERBOSE) -O $(CSTD)
65
66ASFLAGS =	-P -D_ASM $(CPPDEFS) -DLOCORE -D_LOCORE -D__STDC__
67AS_CPPFLAGS =	$(CPPINCS) $(CPPFLAGS.master)
68
69# install values
70CPRFILES=	$(ALL:%=$(ROOT_PSM_DIR)/$(ARCH)/%)
71FILEMODE=	644
72
73# install rule
74$(ROOT_PSM_DIR)/$(ARCH)/%: %
75	$(INS.file)
76
77
78all:	$(ALL)
79
80install: all $(CPRFILES)
81
82# build rule
83
84compress.o: $(OSDIR)/compress.c
85	$(COMPILE.c) $(OSDIR)/compress.c
86
87support.o: $(COMDIR)/support.c
88	$(COMPILE.c) $(COMDIR)/support.c
89
90.KEEP_STATE:
91
92.PARALLEL:	$(CPRBOOTOBJ) $(L_COBJ)
93
94cprboot: $(CPRBOOT_MAPFILE) $(CPRBOOTOBJ) $(SALIBS)
95	$(LD) $(LDFLAGS) -o $@ $(CPRBOOTOBJ) $(LDLIBS)
96	$(POST_PROCESS)
97	$(CHK4UBINARY)
98
99$(SALIBS): FRC
100	@cd $(@D); $(MAKE) $(MFLAGS)
101
102$(ROOTDIR):
103	$(INS.dir)
104
105clean:
106	$(RM) *.o *.ln
107
108clobber:
109	$(RM) *.o *.ln $(ALL)
110
111FRC:
112