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 2010 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24# Copyright 2019 Peter tribble.
25#
26# psm/stand/boot/sparcv9/ieee1275/sun4v/Makefile
27#
28#
29TOPDIR =	../../../../../../..
30
31include $(TOPDIR)/Makefile.master
32include $(TOPDIR)/lib/Makefile.lib
33include $(TOPDIR)/psm/stand/lib/Makefile.lib
34include $(TOPDIR)/psm/Makefile.psm.64
35
36CFLAGS64	+= -xchip=ultra $(CCABS32)
37
38PLATDIR =	$(TOPDIR)/psm/promif/ieee1275/sun4u
39PLATSUN4DIR =	$(TOPDIR)/psm/promif/ieee1275/sun4
40SYSDIR =	$(TOPDIR)/uts
41
42LIBPLAT =	libplat.a
43LINTLIBPLAT =	llib-lplat.ln
44
45PLAT_PFILES =
46
47PLAT_PSUN4FILES =		\
48	prom_alloc.c		\
49	prom_cpuctl.c		\
50	prom_fio.c		\
51	prom_getunum.c		\
52	prom_heartbeat.c	\
53	prom_idprom.c		\
54	prom_init.c		\
55	prom_macaddr.c		\
56	prom_map.c		\
57	prom_mem.c		\
58	prom_mmu.c		\
59	prom_retain.c		\
60	prom_sparc.c		\
61	prom_vername.c
62
63KARCH =		sun4v
64MMU =		sfmmu
65
66OBJSDIR =	objs
67
68PLAT_POBJ =	$(PLAT_PFILES:%.c=$(OBJSDIR)/%.o)
69PLAT_PSUN4OBJ =	$(PLAT_PSUN4FILES:%.c=$(OBJSDIR)/%.o)
70OBJS =		$(PLAT_POBJ) $(PLAT_PSUN4OBJ)
71L_OBJS =	$(OBJS:%.o=%.ln)
72L_SRCS =	$(PLAT_PFILES:%=$(PLATDIR)/%)
73L_SRCS +=	$(PLAT_PSUN4FILES:%=$(PLATSUN4DIR)/%)
74
75ARCHOPTS=	-Dsun4v
76ASFLAGS =	-P -D__STDC__ -D_BOOT -D_ASM
77CPPDEFS	=	$(ARCHOPTS) -D$(KARCH) -D_BOOT -D_KERNEL -D_MACHDEP
78CPPINCS =	-I. -I$(SYSDIR)/sun4 -I$(SYSDIR)/$(KARCH) -I$(SYSDIR)/$(MMU) \
79		-I$(SYSDIR)/sun4u \
80		-I$(SYSDIR)/sparc/v9 -I$(SYSDIR)/sparc \
81		-I$(SYSDIR)/sun -I$(SYSDIR)/common
82CPPFLAGS=	$(CPPDEFS) $(CPPINCS) $(CPPFLAGS.master)
83CFLAGS +=	$(CCVERBOSE)
84
85.KEEP_STATE:
86
87.PARALLEL:	$(OBJS) $(L_OBJS)
88
89all install: $(LIBPLAT)
90
91lint: $(LINTLIBPLAT)
92
93clean:
94	$(RM) $(OBJS) $(L_OBJS)
95
96clobber: clean
97	$(RM) $(LIBPLAT) $(LINTLIBPLAT)
98
99$(LIBPLAT): $(OBJSDIR) .WAIT $(OBJS)
100	$(BUILD.AR) $(OBJS)
101
102$(LINTLIBPLAT): $(OBJSDIR) .WAIT $(L_OBJS)
103	@$(ECHO) "\nlint library construction:" $@
104	@$(LINT.lib) -o plat $(L_SRCS)
105
106$(OBJSDIR):
107	-@[ -d $@ ] || mkdir $@
108
109#
110# build rules using standard library object subdirectory
111#
112$(OBJSDIR)/%.o: $(PLATDIR)/%.c
113	$(COMPILE.c) -o $@ $<
114	$(POST_PROCESS_O)
115
116$(OBJSDIR)/%.o: $(PLATDIR)/%.s
117	$(COMPILE.s) -o $@ $<
118	$(POST_PROCESS_O)
119
120$(OBJSDIR)/%.o: $(PLATSUN4DIR)/%.c
121	$(COMPILE.c) -o $@ $<
122	$(POST_PROCESS_O)
123
124$(OBJSDIR)/%.o: $(PLATSUN4DIR)/%.s
125	$(COMPILE.s) -o $@ $<
126	$(POST_PROCESS_O)
127
128$(OBJSDIR)/%.ln: $(PLATDIR)/%.c
129	@($(LHEAD) $(LINT.c) $< $(LTAIL))
130	@$(MV) $(@F) $@
131
132$(OBJSDIR)/%.ln: $(PLATDIR)/%.s
133	@($(LHEAD) $(LINT.s) $< $(LTAIL))
134	@$(MV) $(@F) $@
135
136$(OBJSDIR)/%.ln: $(PLATSUN4DIR)/%.c
137	@($(LHEAD) $(LINT.c) $< $(LTAIL))
138	@$(MV) $(@F) $@
139
140$(OBJSDIR)/%.ln: $(PLATSUN4DIR)/%.s
141	@($(LHEAD) $(LINT.s) $< $(LTAIL))
142	@$(MV) $(@F) $@
143