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