Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / obp / tools / promif / Makefile
CommitLineData
920dae64
AT
1# ========== Copyright Header Begin ==========================================
2#
3# Hypervisor Software File: Makefile
4#
5# Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
6#
7# - Do no alter or remove copyright notices
8#
9# - Redistribution and use of this software in source and binary forms, with
10# or without modification, are permitted provided that the following
11# conditions are met:
12#
13# - Redistribution of source code must retain the above copyright notice,
14# this list of conditions and the following disclaimer.
15#
16# - Redistribution in binary form must reproduce the above copyright notice,
17# this list of conditions and the following disclaimer in the
18# documentation and/or other materials provided with the distribution.
19#
20# Neither the name of Sun Microsystems, Inc. or the names of contributors
21# may be used to endorse or promote products derived from this software
22# without specific prior written permission.
23#
24# This software is provided "AS IS," without a warranty of any kind.
25# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
26# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
27# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
28# MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
29# ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
30# DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
31# OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
32# FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
33# DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
34# ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
35# SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
36#
37# You acknowledge that this software is not designed, licensed or
38# intended for use in the design, construction, operation or maintenance of
39# any nuclear facility.
40#
41# ========== Copyright Header End ============================================
42# id: @(#)Makefile 1.2 04/08/17
43# purpose:
44# copyright: Copyright 2004 Sun Microsystems, Inc. All Rights Reserved
45# copyright: Use is subject to license terms.
46
47ROOT = ../..
48
49include ${ROOT}/default.mk
50
51INSTALLDIR = ${ROOT}/lib
52TARGET = libsa.a
53TARGETDIR = ${INSTALLDIR}/
54PROMIF = ${ROOT}/tools/promif
55
56CC32 = ${CC5}
57CFLAGS32 =
58
59CC64 = ${CC5}
60CFLAGS64 = -xarch=v9
61
62ASFLAGS32 = -I/usr/include -I/usr/include/v9
63
64ASFLAGS64 = -D__sparcv9 -I/usr/include/v9
65
66CCSBIN = /usr/ccs/bin
67AR = ${CCSBIN}/ar
68ARFLAGS = cr
69LORDER = ${CCSBIN}/lorder
70TSORT = ${CCSBIN}/tsort
71
72INCS = -I${PROMIF}/include -I${PROMIF}/include/sun4u \
73 -I${PROMIF}/include/v9 -I/usr/include
74
75CFLAGS = ${INCS}
76
77LIBRARY_sparc = $(TARGETDIR)libsa.a
78LIBRARY_sparcv9 = $(TARGETDIR)sparcv9/libsa.a
79
80.KEEP_STATE:
81.PARALLEL:
82.SILENT:
83
84MKDIR = mkdir -p
85
86SFILES = crt0.s
87
88CFILES = common/prom_2path.c \
89 common/prom_boot.c \
90 common/prom_console.c \
91 common/prom_enter.c \
92 common/prom_exit.c \
93 common/prom_findnode.c \
94 common/prom_gettime.c \
95 common/prom_handler.c \
96 common/prom_interp.c \
97 common/prom_io.c \
98 common/prom_node.c \
99 common/prom_panic.c \
100 common/prom_path.c \
101 common/prom_phandle.c \
102 common/prom_printf.c \
103 common/prom_prop.c \
104 common/prom_propnames.c \
105 common/prom_reboot.c \
106 common/prom_string.c \
107 common/prom_sysnodes.c \
108 common/prom_test.c \
109 sun4u/prom_alloc.c \
110 sun4u/prom_cpuctl.c \
111 sun4u/prom_heartbeat.c \
112 sun4u/prom_init.c \
113 sun4u/prom_mem.c \
114 sun4u/prom_mmu.c \
115 sun4u/prom_power_off.c \
116 sun4u/prom_retain.c \
117 sun4u/prom_set_traptable.c \
118 sun4u/prom_sparc.c \
119 common/prom_file.c \
120 common/prom_mapin.c \
121 common/prom_ioctl.c \
122 prom_glue.c \
123 memz.c
124
125HDRS = include/sys/obpdefs.h \
126 include/sys/promif.h \
127 include/sys/promimpl.h \
128 include/sun4u/sys/prom_plat.h \
129 include/v9/sys/prom_isa.h
130
131OBJS = $(CFILES:%.c=%.o) $(SFILES:%.s=%.o)
132
133OBJS_sparcv9 = $(OBJS:%=sparcv9/%)
134
135OBJS_sparc = $(OBJS:%=sparc/%)
136
137TARGETS:sh = echo "sparc \${TARGETDIR}\${TARGET} " ; \
138 if [ -x /usr/bin/isalist ]; \
139 then if [ ! -z "`/usr/bin/isalist | grep v9`" ]; \
140 then echo "sparcv9 \${TARGETDIR}sparcv9/\${TARGET}"; fi; fi;
141
142OBPDEFS = ${ROOT}/include/sys/obpdefs.h
143
144all: sparcv9 ${TARGETDIR}sparcv9 ${LIBRARY_sparcv9} ${OBPDEFS}
145
146${ROOT}/include/sys:
147 ${MKDIR} ${ROOT}/include/sys
148
149${ROOT}/include/sys/obpdefs.h: ${PROMIF}/include/sys/obpdefs.h
150${ROOT}/include/sys/obpdefs.h: ${ROOT}/include/sys
151 cp -f ${PROMIF}/include/sys/obpdefs.h ${ROOT}/include/sys
152
153# Not building 32-bit promif library because crt0.s
154# file doesn't support it yet
155# all: ${TARGETS}
156
157sparc:
158 if [ ! -x $@ ]; then ${MKDIR} $@; ${MKDIR} $@/common; \
159 ${MKDIR} $@/sun4u ; fi
160
161sparc/%.o: %.c
162 $(CC32) $(CFLAGS32) $(CFLAGS) -c $< -o $@
163
164sparc/%.o: %.s
165 $(AS) $(ASFLAGS32) -P -D_ASM -xarch=v8plus $< -o $@
166
167AROBJS_sparc = `${LORDER} ${OBJS_sparc} | ${TSORT}`
168
169${LIBRARY_sparc}: ${OBJS_sparc}
170 ${AR} ${ARFLAGS} $@ ${AROBJS_sparc}
171
172${TARGETDIR}sparcv9:
173 if [ ! -x $@ ]; then ${MKDIR} $@; fi
174
175sparcv9:
176 if [ ! -x $@ ]; then ${MKDIR} $@; ${MKDIR} $@/common; \
177 ${MKDIR} $@/sun4u ; fi
178
179sparcv9/%.o: %.c
180 $(CC64) $(CFLAGS64) $(CFLAGS) -c $< -o $@
181
182sparcv9/%.o: %.s
183 $(AS) $(ASFLAGS64) -P -D_ASM -xarch=v9 $< -o $@
184
185AROBJS_sparcv9 = `${LORDER} ${OBJS_sparcv9} | ${TSORT}`
186
187${OBJS_sparcv9}: ${HDRS}
188
189${LIBRARY_sparcv9}: ${OBJS_sparcv9}
190 ${AR} ${ARFLAGS} $@ ${AROBJS_sparcv9}
191
192clean:
193 /bin/rm -f ${OBJS_sparcv9} ${LIBRARY_sparcv9} ${OBPDEFS}
194
195clobber:
196 ${SCCS} clean
197