xref: /illumos-gate/usr/src/psm/stand/cpr/common/Makefile.com (revision 74e12c43fe52f2c30f36e65a4d0fb0e8dfd7068a)
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
26GREP	=	egrep
27WC	=	wc
28TOPDIR	=	../../../../..
29
30include $(TOPDIR)/Makefile.master
31include $(TOPDIR)/Makefile.psm
32include $(TOPDIR)/psm/stand/lib/Makefile.lib
33
34SYSDIR	=	$(TOPDIR)/uts
35COMDIR	=	../../common
36OSDIR  =	$(SYSDIR)/common/os
37ARCHDIR	=	$(SYSDIR)/$(ARCH)
38MACHDIR	=	$(SYSDIR)/$(MACH)
39MMUDIR	=	$(SYSDIR)/$(MMU)
40PROMLIBDIR=	$(TOPDIR)/psm/stand/lib/promif/$(ARCH_PROMDIR)
41PROMLIB	=	$(PROMLIBDIR)/libprom.a
42
43SALIBS +=	$(PROMLIB)
44LDLIBS +=	-L$(PROMLIBDIR) -lprom
45LDFLAGS =	-Wl,-dn -Wl,-Mmapfile $(MAP_FLAG)
46
47CPRBOOTOBJ +=	support.o compress.o
48
49L_SRCS	=	$(COMDIR)/support.c $(OSDIR)/compress.c
50L_COBJ	=	$(CPRBOOTOBJ:%.o=%.ln)
51
52CPPDEFS =	$(ARCHOPTS) -D$(ARCH) -D__$(ARCH) -D$(MACH) -D__$(MACH)
53CPPDEFS +=	-D_KERNEL -D_MACHDEP -D__ELF
54
55CPPINCS =	-I. -I$(ARCHDIR) -I$(MMUDIR) -I$(MACHDIR)
56CPPINCS +=	-I$(MACHDIR)/$(ARCHVER)	-I$(SYSDIR)/sun
57CPPINCS +=	-I$(SYSDIR)/sun4 -I$(SYSDIR)/common -I$(TOPDIR)/head
58
59CPPFLAGS =	$(CPPDEFS) $(CPPINCS) $(CPPFLAGS.master)
60CPPFLAGS +=	$(CCYFLAG)$(SYSDIR)/common
61
62CSTD =	$(CSTD_GNU99)
63CFLAGS =	$(CCVERBOSE) -O $(CSTD)
64
65ASFLAGS =	-P -D_ASM $(CPPDEFS) -DLOCORE -D_LOCORE -D__STDC__
66AS_CPPFLAGS =	$(CPPINCS) $(CPPFLAGS.master)
67
68# install values
69CPRFILES=	$(ALL:%=$(ROOT_PSM_DIR)/$(ARCH)/%)
70FILEMODE=	644
71
72# install rule
73$(ROOT_PSM_DIR)/$(ARCH)/%: %
74	$(INS.file)
75
76
77all:	$(ALL)
78
79install: all $(CPRFILES)
80
81# build rule
82
83compress.o: $(OSDIR)/compress.c
84	$(COMPILE.c) $(OSDIR)/compress.c
85
86support.o: $(COMDIR)/support.c
87	$(COMPILE.c) $(COMDIR)/support.c
88
89.KEEP_STATE:
90
91.PARALLEL:	$(CPRBOOTOBJ) $(L_COBJ)
92
93cprboot: $(CPRBOOT_MAPFILE) $(CPRBOOTOBJ) $(SALIBS)
94	$(LD) $(LDFLAGS) -o $@ $(CPRBOOTOBJ) $(LDLIBS)
95	$(POST_PROCESS)
96	$(CHK4UBINARY)
97
98$(SALIBS): FRC
99	@cd $(@D); $(MAKE)
100
101$(ROOTDIR):
102	$(INS.dir)
103
104clean:
105	$(RM) *.o *.ln
106
107clobber:
108	$(RM) *.o *.ln $(ALL)
109
110FRC:
111