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 (c) 2010, Oracle and/or its affiliates. All rights reserved.
23#
24# Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
25#
26# Copyright 2019 Joyent, Inc.
27#
28
29COBJS =		brand_util.o
30ASOBJS =	crt.o handler.o runexe.o
31OFFSETS_SRC =	../common/offsets.in
32OFFSETS_H =	assym.h
33OBJECTS =	$(COBJS) $(ASOBJS)
34CLOBBERFILES +=	$(OFFSETS_H)
35
36include $(SRC)/lib/Makefile.lib
37
38SRCDIR =	../common
39CSRCS =		$(COBJS:%o=../common/%c)
40ASSRCS =	$(ASOBJS:%o=$(ISASRCDIR)/%s)
41SRCS =		$(CSRCS) $(ASSRCS)
42
43CPPFLAGS +=	-D_REENTRANT -U_ASM -I. -I../sys
44CFLAGS +=	$(CCVERBOSE)
45ASFLAGS +=	$(ASFLAGS_$(CURTYPE)) -D_ASM -I. -I../sys
46ASFLAGS64 +=	$(ASFLAGS_$(CURTYPE)) -D_ASM -I. -I../sys
47
48#
49# Disable stack protection as this code might be running in an s10 context.
50#
51STACKPROTECT = none
52
53# intentional code after abort()
54SMOFF += unreachable
55
56.KEEP_STATE:
57
58#
59# build the offset header before trying to compile any files.  (it's included
60# by brand_misc.h, so it's needed for all objects, not just assembly ones.)
61#
62# Note we have to build assym.h via its dependency on pics/% so that the
63# target dependent assignment of CTF_FLAGS will be there, otherwise make
64# will see two different commands to build it (endless rebuilds).
65#
66all: pics .WAIT $$(PICS)
67
68$(OBJECTS:%=pics/%): $(OFFSETS_H)
69
70$(OFFSETS_H): $(OFFSETS_SRC)
71	$(OFFSETS_CREATE) < $(OFFSETS_SRC) >$@
72
73pics/%.o: $(ISASRCDIR)/%.S
74	$(COMPILE.s) -o $@ $<
75	$(POST_PROCESS_S_O)
76
77include $(SRC)/lib/Makefile.targ
78