xref: /titanic_52/usr/src/psm/stand/cpr/common/Makefile.com (revision 4201a95e0468170d576f82c3aa63afecf718497a)
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
75
76# lint stuff
77LINTFLAGS += -Dlint
78LOPTS = -hbxn
79
80# install rule
81$(ROOT_PSM_DIR)/$(ARCH)/%: %
82	$(INS.file)
83
84
85all:	$(ALL)
86
87install: all $(CPRFILES)
88
89
90LINT.c=	$(LINT) $(LINTFLAGS.c) $(LINT_DEFS) $(CPPFLAGS) -c
91LINT.s=	$(LINT) $(LINTFLAGS.s) $(LINT_DEFS) $(CPPFLAGS) -c
92
93# build rule
94
95compress.o: $(OSDIR)/compress.c
96	$(COMPILE.c) $(OSDIR)/compress.c
97
98support.o: $(COMDIR)/support.c
99	$(COMPILE.c) $(COMDIR)/support.c
100
101compress.ln: $(OSDIR)/compress.c
102	@$(LHEAD) $(LINT.c) $(OSDIR)/compress.c $(LTAIL)
103
104support.ln: $(COMDIR)/support.c
105	@$(LHEAD) $(LINT.c) $(COMDIR)/support.c $(LTAIL)
106
107%.ln: %.c
108	@$(LHEAD) $(LINT.c) $< $(LTAIL)
109
110%.ln: %.s
111	@$(LHEAD) $(LINT.s) $< $(LTAIL)
112
113.KEEP_STATE:
114
115.PARALLEL:	$(CPRBOOTOBJ) $(L_COBJ)
116
117cprboot: $(CPRBOOT_MAPFILE) $(CPRBOOTOBJ) $(SALIBS)
118	$(LD) $(LDFLAGS) -o $@ $(CPRBOOTOBJ) $(LDLIBS)
119	$(POST_PROCESS)
120	$(CHK4UBINARY)
121
122$(SALIBS): FRC
123	@cd $(@D); $(MAKE) $(MFLAGS)
124
125$(LINTLIBS): FRC
126	@cd $(@D); $(MAKE) $(MFLAGS) $(@F)
127
128$(ROOTDIR):
129	$(INS.dir)
130
131lint: $(L_COBJ) $(LINTLIBS)
132	@$(ECHO) "\n$@: global crosschecks:"
133	@$(LINT.2) $(L_COBJ) $(LDLIBS)
134
135clean.lint:
136	$(RM) *.ln
137
138clean:
139	$(RM) *.o *.ln
140
141clobber:
142	$(RM) *.o *.ln $(ALL)
143
144FRC:
145