xref: /illumos-gate/usr/src/lib/brand/shared/brand/Makefile.com (revision e0731422366620894c16c1ee6515551c5f00733d)
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
25COBJS =		brand_util.o
26ASOBJS =	crt.o handler.o runexe.o
27OFFSETS_SRC =	../common/offsets.in
28OFFSETS_H =	assym.h
29OBJECTS =	$(COBJS) $(ASOBJS)
30CLOBBERFILES +=	$(OFFSETS_H)
31
32include $(SRC)/lib/Makefile.lib
33
34SRCDIR =	../common
35CSRCS =		$(COBJS:%o=../common/%c)
36ASSRCS =	$(ASOBJS:%o=$(ISASRCDIR)/%s)
37SRCS =		$(CSRCS) $(ASSRCS)
38
39#
40# Ugh, this is a gross hack.  Our assembly routines uses lots of defines
41# to simplify variable access.  All these defines work fine for amd64
42# compiles because when compiling for amd64 we use the GNU assembler,
43# gas.  For 32-bit code we use the Sun assembler, as.  Unfortunatly
44# as does not handle certian constructs that gas does.  So rather than
45# make our code less readable, we'll just use gas to compile our 32-bit
46# code as well.
47#
48i386_AS		= $(amd64_AS)
49
50CPPFLAGS +=	-D_REENTRANT -U_ASM -I. -I../sys
51CFLAGS +=	$(CCVERBOSE)
52ASFLAGS =	-P $(ASFLAGS_$(CURTYPE)) -D_ASM -I. -I../sys
53
54.KEEP_STATE:
55
56#
57# build the offset header before trying to compile any files.  (it's included
58# by brand_misc.h, so it's needed for all objects, not just assembly ones.)
59#
60all: $(OFFSETS_H) pics .WAIT $(PICS)
61
62lint: lintcheck
63
64$(OBJECTS:%=pics/%): $(OFFSETS_H)
65
66$(OFFSETS_H): $(OFFSETS_SRC)
67	$(OFFSETS_CREATE) $(CTF_FLAGS) < $(OFFSETS_SRC) >$@
68
69pics/%.o: $(ISASRCDIR)/%.s
70	$(COMPILE.s) -o $@ $<
71	$(POST_PROCESS_O)
72
73include $(SRC)/lib/Makefile.targ
74